From 8be08dfe23a1020daa3f08b4ce31cef3d030cfed Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 13 Sep 2021 11:23:07 +1200 Subject: [PATCH] Preprocess signature separately --- .mutt/markdown2html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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) -- 2.39.2