format_links: parse punctuation inside brackets
Also, consolidate all punctuation tests into a single table-driven one.
This commit is contained in:
parent
7d13cbb10b
commit
954a02126e
2 changed files with 24 additions and 19 deletions
|
@ -333,6 +333,12 @@ def _unwrap(text):
|
|||
# Split out wrapping chars.
|
||||
suffix = text[-1] + suffix
|
||||
prefix, text = text[:1], text[1:-1]
|
||||
break # Nested wrappers not supported atm.
|
||||
|
||||
if punct.search(text):
|
||||
# Move inner punctuation to suffix segment.
|
||||
text, inner_punct, _ = punct.split(text)
|
||||
suffix = inner_punct + suffix
|
||||
|
||||
return prefix, text, suffix
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue