From dcee303120700f9b42ffc5dbeb8ec8f1c8d17c3d Mon Sep 17 00:00:00 2001 From: Steven Siloti Date: Sat, 6 Feb 2016 19:41:40 -0800 Subject: [PATCH] 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. --- docs/gen_reference_doc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) mode change 100755 => 100644 docs/gen_reference_doc.py diff --git a/docs/gen_reference_doc.py b/docs/gen_reference_doc.py old mode 100755 new mode 100644 index b3ef661db..10c0645f4 --- a/docs/gen_reference_doc.py +++ b/docs/gen_reference_doc.py @@ -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('\\*/', '\\*/*')