summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Alburquerque <jaalburqu@svn.gnome.org>2010-04-11 17:46:40 -0400
committerJosé Alburquerque <jaalburqu@svn.gnome.org>2010-04-11 17:48:12 -0400
commitf00b9ce91fc9c3aabd4af4132fc112d9e415e12e (patch)
treebedc5a6fa147f3988f68b2292e30ad4230f418e7
parenta2fcdecbb5e109da5568084d7acb2332af83b6f5 (diff)
downloadpygobject-f00b9ce91fc9c3aabd4af4132fc112d9e415e12e.tar.gz
pygobject-f00b9ce91fc9c3aabd4af4132fc112d9e415e12e.tar.xz
pygobject-f00b9ce91fc9c3aabd4af4132fc112d9e415e12e.zip
codegen/docextract_to_xml.py: Handle C++ multi-line comments.
* codegen/docextract_to_xml.py (escape_text): Translate '/*' and '*/' in text to '/ *' and '* /' respectively so that comment errors don't show up when the descriptions that include C++ code with C++ multi-line comments are used in Doxygen blocks.
-rwxr-xr-xcodegen/docextract_to_xml.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/codegen/docextract_to_xml.py b/codegen/docextract_to_xml.py
index 638ac94..0e6daa1 100755
--- a/codegen/docextract_to_xml.py
+++ b/codegen/docextract_to_xml.py
@@ -20,6 +20,11 @@ def usage():
'[-i | --with-signals ]\n')
sys.exit(1)
+# Translates special texts to &... HTML acceptable format. Also replace
+# occurrences of '/*' and '*/' with '/ *' and '* /' respectively to avoid
+# comment errors (note the spaces). Some function descriptions include C++
+# multi-line comments which cause errors when the description is included in a
+# C++ Doxygen comment block.
def escape_text(unescaped_text):
# Escape every "&" not part of an entity reference
escaped_text = re.sub(r'&(?![A-Za-z]+;)', '&amp;', unescaped_text)
@@ -35,6 +40,10 @@ def escape_text(unescaped_text):
escaped_text = string.replace(escaped_text, '>', '&gt;')
escaped_text = string.replace(escaped_text, '"', '&quot;')
+ # Replace C++ comment begin and ends to ones that don't affect Doxygen.
+ escaped_text = string.replace(escaped_text, '/*', '/ *')
+ escaped_text = string.replace(escaped_text, '*/', '* /')
+
return escaped_text
def print_annotations(annotations):