[Telepathy-commits] [telepathy-qt4/master] libqt4codegen: escape backslashes when generating doc-comments from the spec

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Feb 24 03:09:10 PST 2009


Otherwise, doxygen thinks they're a doxygen command and gets confused.
---
 tools/libqt4codegen.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libqt4codegen.py b/tools/libqt4codegen.py
index bd814f3..de30d05 100644
--- a/tools/libqt4codegen.py
+++ b/tools/libqt4codegen.py
@@ -146,7 +146,7 @@ def format_docstring(el, indent=' * ', brackets=None, maxwidth=80):
         splitted = ''.join([el.toxml() for el in docstring_el.childNodes]).strip(' ').strip('\n').split('\n')
         level = min([not match and maxint or match.end() - 1 for match in [re.match('^ *[^ ]', line) for line in splitted]])
         assert level != maxint
-        lines = [line[level:] for line in splitted]
+        lines = [line[level:].replace('\\', '\\\\') for line in splitted]
     else:
         content = xml_escape(get_descendant_text(docstring_el).replace('\n', ' ').strip())
 
@@ -169,7 +169,7 @@ def format_docstring(el, indent=' * ', brackets=None, maxwidth=80):
             content = content[step:]
 
         if line:
-            lines.append(line)
+            lines.append(line.replace('\\', '\\\\'))
 
     output = []
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list