Also prevent unknown roles from causing formatting to error
This commit is contained in:
parent
6c8eb4a19a
commit
bc895eacc5
@ -204,7 +204,10 @@ def prettify(text: str) -> str:
|
||||
|
||||
def sub(m: Match) -> str:
|
||||
role, text = m.group(1, 2)
|
||||
try:
|
||||
return str(role_map[role](text))
|
||||
except KeyError:
|
||||
return str(text)
|
||||
|
||||
text = re.sub(r':([a-z]+):`([^`]+)`', sub, text)
|
||||
return text
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user