[Cryptech-Commits] [wiki] 46/75: Handle quoting correctly

git at cryptech.is git at cryptech.is
Fri Oct 8 18:52:12 UTC 2021


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch production
in repository wiki.

commit b0815b4a49342682477e2ccf754aa83402744013
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Mon Feb 15 03:40:07 2021 +0000

    Handle quoting correctly
---
 trac2md.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/trac2md.py b/trac2md.py
index 249ddaa..2863892 100755
--- a/trac2md.py
+++ b/trac2md.py
@@ -50,8 +50,9 @@ def make_mdlink(text, slug):
     else:
         parts = [text]
     parts = [p.strip() for p in parts]
-    if parts[-1].startswith('"') and  parts[-1].endswith('"'):
-        parts[-1] = parts[-1][1:-1]
+    for i, part in enumerate(parts):
+        if any(part.startswith(q) and part.endswith(q) for q in ('"', "'")):
+            parts[i] = part[1:-1]
     if slug is None:
         return "[{}]({})".format(parts[-1], parts[0])
     else:



More information about the Commits mailing list