From f00b9ce91fc9c3aabd4af4132fc112d9e415e12e Mon Sep 17 00:00:00 2001 From: José Alburquerque Date: Sun, 11 Apr 2010 17:46:40 -0400 Subject: 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 file changed, 9 insertions(+) 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]+;)', '&', unescaped_text) @@ -35,6 +40,10 @@ def escape_text(unescaped_text): escaped_text = string.replace(escaped_text, '>', '>') escaped_text = string.replace(escaped_text, '"', '"') + # 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): -- cgit