From 6d900601163e87f851fa17a2859f9370be1df3e3 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sat, 20 Aug 2022 21:47:22 +0200 Subject: [PATCH 1/1] Control the title added --- .config/mutt/markdown2html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.config/mutt/markdown2html b/.config/mutt/markdown2html index 2431bb8..808ba2c 100755 --- a/.config/mutt/markdown2html +++ b/.config/mutt/markdown2html @@ -217,7 +217,7 @@ def _reformat_quotes(html): def _convert_with_pandoc(mdwn, inputfmt='markdown', outputfmt='html5', ext_enabled=None, ext_disabled=None, - standalone=True, selfcontained=True, title=None): + standalone=True, selfcontained=True, title='Untitled'): ''' Invoke pandoc to do the actual conversion of Markdown to HTML5. ''' @@ -263,7 +263,7 @@ def _convert_with_pandoc(mdwn, inputfmt='markdown', outputfmt='html5', if selfcontained: args.append('--self-contained') if title: - args.append(f'--metadata=pagetitle:"{title}"') + args.append(f'--metadata=title:{title}') return pypandoc.convert_text(mdwn, format=inputfmt, to=outputfmt, extra_args=args) @@ -304,15 +304,15 @@ def convert_markdown_to_html(mdwn): body = _preprocess_markdown(body) body = _identify_quotes_for_later(body) html = _convert_with_pandoc(body, standalone=True, selfcontained=True, - title=None) - html = html.replace('Untitled\n','') + title="Body") + html = html.replace('Body\n','') html = _reformat_quotes(html) if sig: sig = _preprocess_signature(sig) sig = _preprocess_markdown(sig) - print(sig, file=sys.stderr, end='') - sig = _convert_with_pandoc(sig, standalone=False, selfcontained=False) + sig = _convert_with_pandoc(sig, standalone=False, selfcontained=False, + title="Signature") sig = SIGNATURE_HTML.format(sig=sig) eob = html.find('') html = f'{html[:eob]}{sig}\n{html[eob:]}' -- 2.39.2