[pygobject] codegen/docextract_to_xml.py: Handle C++ multi-line comments.



commit f00b9ce91fc9c3aabd4af4132fc112d9e415e12e
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Sun Apr 11 17:46:40 2010 -0400

    	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.

 codegen/docextract_to_xml.py |    9 +++++++++
 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):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]