forked from premiere/premiere-libtorrent
escape underscores in function signatures
Underscores can be interpreted as hyperlinks so they must be escaped in code. Also fix spliting of the function name and formal parameters when the parameters contain default values with parens in them.
This commit is contained in:
parent
df353bc3f9
commit
dcee303120
|
@ -149,7 +149,7 @@ def is_visible(desc):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def highlight_signature(s):
|
def highlight_signature(s):
|
||||||
name = s.split('(')
|
name = s.split('(', 1)
|
||||||
name2 = name[0].split(' ')
|
name2 = name[0].split(' ')
|
||||||
if len(name2[-1]) == 0: return s
|
if len(name2[-1]) == 0: return s
|
||||||
|
|
||||||
|
@ -168,6 +168,9 @@ def highlight_signature(s):
|
||||||
# we also have to escape colons
|
# we also have to escape colons
|
||||||
name[1] = name[1].replace(':', '\\:')
|
name[1] = name[1].replace(':', '\\:')
|
||||||
|
|
||||||
|
# escape trailing underscores
|
||||||
|
name[1] = name[1].replace('_', '\\_')
|
||||||
|
|
||||||
# comments in signatures are italic
|
# comments in signatures are italic
|
||||||
name[1] = name[1].replace('/\\*', '*/\\*')
|
name[1] = name[1].replace('/\\*', '*/\\*')
|
||||||
name[1] = name[1].replace('\\*/', '\\*/*')
|
name[1] = name[1].replace('\\*/', '\\*/*')
|
||||||
|
|
Loading…
Reference in New Issue