]> git.madduck.net Git - etc/neomutt.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

buildmimetree.py: argparser cleanup
authormartin f. krafft <madduck@madduck.net>
Wed, 23 Aug 2023 10:26:39 +0000 (22:26 +1200)
committermartin f. krafft <madduck@madduck.net>
Wed, 23 Aug 2023 11:56:56 +0000 (23:56 +1200)
.config/neomutt/buildmimetree.py

index f7d7c56b8f8861aa6b327821dc0ba9f0fb5058f7..c277e6344477f5fa025eebf36176c22dfeb26046 100755 (executable)
@@ -63,7 +63,7 @@ def parse_cli_args(*args, **kwargs):
         "--extensions",
         type=str,
         default="",
-        help="Markdown extension to use (comma-separated list)"
+        help="Markdown extension to use (comma-separated list)",
     )
 
     parser.add_argument(
@@ -85,7 +85,9 @@ def parse_cli_args(*args, **kwargs):
     )
 
     subp = parser.add_subparsers(help="Sub-command parsers", dest="mode")
-    massage_p = subp.add_parser("massage", help="Massaging phase (internal use)")
+    massage_p = subp.add_parser(
+        "massage", help="Massaging phase (internal use)"
+    )
 
     massage_p.add_argument(
         "--write-commands-to",
@@ -223,7 +225,12 @@ def collect_inline_images(
         filewriter_fn(path, data.read(), "w+b")
 
         relparts.append(
-            Part(*mimetype.split("/"), path, cid=info.cid, desc=f"Image: {info.desc}")
+            Part(
+                *mimetype.split("/"),
+                path,
+                cid=info.cid,
+                desc=f"Image: {info.desc}",
+            )
         )
 
     return relparts
@@ -426,7 +433,13 @@ def do_massage(
     cmds.flush()
 
     extensions = extensions.split(",") if extensions else []
-    tree = converter(draft_f.read(), draftpath, tempdir=tempdir, extensions=extensions)
+    tree = converter(
+        draft_f.read(),
+        draftpath,
+        cssfile=cssfile,
+        tempdir=tempdir,
+        extensions=extensions,
+    )
 
     mimetree = MIMETreeDFWalker(debug=debug_walk)
 
@@ -436,7 +449,7 @@ def do_massage(
         depth-first, and responsible for telling NeoMutt how to assemble
         the tree.
         """
-        KILL_LINE=r'\Ca\Ck'
+        KILL_LINE = r"\Ca\Ck"
 
         if isinstance(item, Part):
             # We've hit a leaf-node, i.e. an alternative or a related part