From: martin f. krafft Date: Sun, 12 Sep 2021 23:23:07 +0000 (+1200) Subject: Preprocess signature separately X-Git-Url: https://git.madduck.net/etc/mutt.git/commitdiff_plain/8be08dfe23a1020daa3f08b4ce31cef3d030cfed Preprocess signature separately --- diff --git a/.mutt/markdown2html b/.mutt/markdown2html index 60e6bea..8930c88 100755 --- a/.mutt/markdown2html +++ b/.mutt/markdown2html @@ -116,6 +116,12 @@ SIGNATURE_HTML = \ '
-- {sig}
' +def _preprocess_signature(sig): + ''' + Preprocess the signature before markdown processing. + ''' + return sig + def _preprocess_markdown(mdwn): ''' Preprocess Markdown for handling by the converter. @@ -311,8 +317,12 @@ def convert_markdown_to_html(mdwn): html = _reformat_quotes(html) if sig: + sig = _preprocess_signature(sig) sig = _preprocess_markdown(sig) - html += SIGNATURE_HTML.format(sig='
'.join(sig.splitlines())) + sig = _convert_with_pandoc(sig, standalone=False, selfcontained=False) + sig = SIGNATURE_HTML.format(sig='
'.join(sig.splitlines())) + eob = html.find('') + html = f'{html[:eob]}{sig}\n{html[eob:]}' html = HTML_DOCUMENT.format(htmlbody=html) html = _apply_styling(html)