From: martin f. krafft Date: Thu, 24 Aug 2023 13:36:52 +0000 (+1200) Subject: buildmimetree.py: add --related-to-html-only X-Git-Url: https://git.madduck.net/etc/neomutt.git/commitdiff_plain/086bc4c3a8284b39d27fc18de147f5bd41fed877 buildmimetree.py: add --related-to-html-only --- diff --git a/.config/neomutt/buildmimetree.py b/.config/neomutt/buildmimetree.py index 2396c49..36298ca 100755 --- a/.config/neomutt/buildmimetree.py +++ b/.config/neomutt/buildmimetree.py @@ -76,6 +76,12 @@ def parse_cli_args(*args, **kwargs): else: parser.set_defaults(css_file=None) + parser.add_argument( + "--related-to-html-only", + action="store_true", + help="Make related content be sibling to HTML parts only" + ) + parser.add_argument( "--only-build", action="store_true", @@ -499,6 +505,7 @@ def do_massage( extensions=None, cssfile=None, converter=convert_markdown_to_html, + related_to_html_only=True, only_build=False, tempdir=None, debug_commands=False, @@ -527,6 +534,7 @@ def do_massage( draft_f.read(), draftpath, cssfile=cssfile, + related_to_html_only=related_to_html_only, tempdir=tempdir, extensions=extensions, ) @@ -665,6 +673,7 @@ if __name__ == "__main__": cmd_f, extensions=args.extensions, cssfile=args.css_file, + related_to_html_only=args.related_to_html_only, only_build=args.only_build, tempdir=args.tempdir, debug_commands=args.debug_commands, @@ -844,7 +853,14 @@ try: return StringIO(text or const1) def test_do_massage_basic(self, const1, string_io, capsys): - def converter(drafttext, draftpath, cssfile, extensions, tempdir): + def converter( + drafttext, + draftpath, + cssfile, + related_to_html_only, + extensions, + tempdir, + ): return Part("text", "plain", draftpath, orig=True) do_massage( @@ -869,7 +885,14 @@ try: def test_do_massage_fulltree( self, string_io, const1, mime_tree_related_to_alternative, capsys ): - def converter(drafttext, draftpath, cssfile, extensions, tempdir): + def converter( + drafttext, + draftpath, + cssfile, + related_to_html_only, + extensions, + tempdir, + ): return mime_tree_related_to_alternative do_massage( @@ -881,7 +904,6 @@ try: captured = capsys.readouterr() lines = captured.out.splitlines()[4:-2] - print(lines) assert "first-entry" in lines.pop() assert "update-encoding" in lines.pop() assert "Plain" in lines.pop() @@ -1122,7 +1144,14 @@ try: def test_mime_tree_relative_within_alternative( self, string_io, const1, capsys, mime_tree_related_to_html ): - def converter(drafttext, draftpath, cssfile, extensions, tempdir): + def converter( + drafttext, + draftpath, + cssfile, + related_to_html_only, + extensions, + tempdir, + ): return mime_tree_related_to_html do_massage(