Escape < and > even if only one of them exists or if found multiple times (#7154)
* Escape < and > even if only one of them exists In python negative index counts from the end, so without this change or another solution "example with only < one side" would be converted to "example with only < one sid>example with only < one side" * Escape < and > even if found multiple times
This commit is contained in:
parent
73a1b46bbf
commit
07dc953875
1 changed files with 2 additions and 7 deletions
|
@ -1592,14 +1592,9 @@ def pangoize(message, filename, line):
|
|||
# Check for unescaped < and >
|
||||
if "<" in message or ">" in message:
|
||||
reduced = pangostrip(message)
|
||||
if "<" in reduced or ">" in reduced:
|
||||
if ("<" in reduced or ">" in reduced) and not rgb :
|
||||
if message == reduced: # No pango markup
|
||||
here = message.find('<')
|
||||
if message[here:here+4] != "<":
|
||||
message = message[:here] + "<" + message[here+1:]
|
||||
here = message.find('>')
|
||||
if message[here:here+4] != ">":
|
||||
message = message[:here] + ">" + message[here+1:]
|
||||
message = message.replace("<", "<").replace(">", ">")
|
||||
else:
|
||||
print('"%s", line %d: < or > in pango string requires manual fix.' % (filename, line))
|
||||
return message
|
||||
|
|
Loading…
Add table
Reference in a new issue