X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/d60226ed4be8d76d12ee1db8f46ee49de9c3a567..e90ca40d33d14a23aae53b74f9b35b37637d0c01:/.mutt/markdown2html?ds=inline diff --git a/.mutt/markdown2html b/.mutt/markdown2html index 44ec07c..e3c2b30 100755 --- a/.mutt/markdown2html +++ b/.mutt/markdown2html @@ -98,7 +98,7 @@ def _preprocess_markdown(mdwn): # convert hard line breaks within paragraphs to 2 trailing spaces, which # is the markdown way of representing hard line breaks. Note how the # regexp will not match between paragraphs. - ret = re.sub(r'(\S)\n(\s*\S)', r'\g<1> \n\g<2>', mdwn, re.MULTILINE) + ret = re.sub(r'(\S)\n(\s*\S)', r'\g<1> \n\g<2>', mdwn, flags=re.MULTILINE) return ret @@ -153,13 +153,13 @@ def _identify_quotes_for_later(mdwn): elif prev and re.match(r'^.+:\s*$', prev) and cur.startswith('>'): ret.append(re.sub(r'^(\s*>\s*)+(.+)', r'\g<1>{.quoteinitial}\g<2>', - cur, re.MULTILINE)) + cur, flags=re.MULTILINE)) # All other occurrences of blockquotes get the "subsequent" marker: - elif cur.startswith('>') and not prev.startswith('>'): + elif cur.startswith('>') and prev and not prev.startswith('>'): ret.append(re.sub(r'^((?:\s*>\s*)+)(.+)', r'\g<1>{.quotesubsequent}\g<2>', - cur, re.MULTILINE)) + cur, flags=re.MULTILINE)) else: # pass through everything else. ret.append(cur) @@ -174,7 +174,7 @@ def _reformat_quotes(html): ''' ret = html.replace('
{.quotelead}', '
') ret = re.sub(r'
\n((?:\n)*)(?:\{\.quote(\w+)\})', - r'
\n\g<1>', ret, re.MULTILINE) + r'
\n\g<1>', ret, flags=re.MULTILINE) return ret