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:
Steven Siloti 2016-02-06 19:41:40 -08:00
parent df353bc3f9
commit dcee303120
1 changed files with 4 additions and 1 deletions

5
docs/gen_reference_doc.py Executable file → Normal file
View File

@ -149,7 +149,7 @@ def is_visible(desc):
return True
def highlight_signature(s):
name = s.split('(')
name = s.split('(', 1)
name2 = name[0].split(' ')
if len(name2[-1]) == 0: return s
@ -168,6 +168,9 @@ def highlight_signature(s):
# we also have to escape colons
name[1] = name[1].replace(':', '\\:')
# escape trailing underscores
name[1] = name[1].replace('_', '\\_')
# comments in signatures are italic
name[1] = name[1].replace('/\\*', '*/\\*')
name[1] = name[1].replace('\\*/', '\\*/*')