From 45ecc9cb84cf8d894c57832f893350cfdf7eb3f6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 17 Feb 2015 00:10:37 +0100 Subject: [PATCH] Fix trimming whitespace from Doxygen comments. Also trim the string (making it empty) if it consists solely of whitespace. --- Examples/test-suite/python/doxygen_misc_constructs_runme.py | 2 +- Source/DoxygenTranslator/src/PyDocConverter.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Examples/test-suite/python/doxygen_misc_constructs_runme.py b/Examples/test-suite/python/doxygen_misc_constructs_runme.py index 81e0ee0a9..3dc083b6b 100644 --- a/Examples/test-suite/python/doxygen_misc_constructs_runme.py +++ b/Examples/test-suite/python/doxygen_misc_constructs_runme.py @@ -45,7 +45,7 @@ may be specified.""" ) commentVerifier.check(doxygen_misc_constructs.getConnection.__doc__, - r""" + r""" This function returns connection id.""" ) diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 5bcf8f174..e1bae2792 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -117,7 +117,9 @@ static size_t determineIndent(const string& s) static void trimWhitespace(string& s) { const size_t lastNonSpace = s.find_last_not_of(' '); - if (lastNonSpace != string::npos) + if (lastNonSpace == string::npos) + s.clear(); + else s.erase(lastNonSpace + 1); }