From: martin f. krafft Date: Sun, 12 Sep 2021 23:56:00 +0000 (+1200) Subject: Fix matching of blockquotes X-Git-Url: https://git.madduck.net/etc/mutt.git/commitdiff_plain/a83d50d5a64488deb3796bbd0ca0a03b0516cc77?ds=inline;hp=62090a10f51ee6ec80a6385dde9cb41c8f2b2089 Fix matching of blockquotes Thanks to Tomas Janousek for the patch. --- diff --git a/.mutt/markdown2html b/.mutt/markdown2html index dccecf2..487d3db 100755 --- a/.mutt/markdown2html +++ b/.mutt/markdown2html @@ -178,7 +178,7 @@ def _identify_quotes_for_later(mdwn): # The lead-in to a quote is a single line immediately preceding the # quote, and ending with ':'. Note that there could be multiple of # these: - if re.match(r'^.+:\s*$', cur) and nxt.startswith('>'): + if re.match(r'^[^>]+.*:\s*$', cur) and nxt.startswith('>'): ret.append(f'{{.quotelead}}{cur.strip()}') # pandoc needs an empty line before the blockquote, so # we enter one for the purpose of HTML rendition: @@ -187,13 +187,13 @@ def _identify_quotes_for_later(mdwn): # The first blockquote after such a lead-in gets marked as the # "initial" quote: - elif prev and re.match(r'^.+:\s*$', prev) and cur.startswith('>'): + 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, flags=re.MULTILINE)) # All other occurrences of blockquotes get the "subsequent" marker: - elif cur.startswith('>') and prev and not prev.startswith('>'): + elif cur.startswith('>') and prev is not None and not prev.startswith('>'): ret.append(re.sub(r'^((?:\s*>\s*)+)(.+)', r'\g<1>{.quotesubsequent}\g<2>', cur, flags=re.MULTILINE))