diff options
author | Rob Austein <sra@hactrn.net> | 2021-02-15 03:40:07 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2021-02-15 03:40:07 +0000 |
commit | b0815b4a49342682477e2ccf754aa83402744013 (patch) | |
tree | 2b5a916d665507483edd96cb74007a3213040f63 | |
parent | cd878ed275ad8d9c8fd047863e5e687d13e87578 (diff) |
Handle quoting correctly
-rwxr-xr-x | trac2md.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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: |