Remove any whitespace before ignored Doxygen commands.

This is done mainly to avoid problems with trailing whitespace in the
generated Python code as this provokes pep8 problems, but is also, arguably,
more logical, as if a command which is on its own on a line is ignored, we
shouldn't leave any whitespace neither (and perhaps should even suppress the
line entirely, in fact).
This commit is contained in:
Vadim Zeitlin 2014-12-17 04:57:17 +01:00
commit b7160d92c9
3 changed files with 19 additions and 6 deletions

View file

@ -24,13 +24,13 @@ public class doxygen_ignore_runme {
wantedComments.put("doxygen_ignore.doxygen_ignore.func()",
" A contrived example of ignoring too many commands in one comment.<br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" This is specific to <i>Java</i>.<br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" Command ignored, but anything here is still included.<br>\n" +
" <br>\n" +

View file

@ -7,11 +7,11 @@ commentVerifier.check(doxygen_ignore.func.__doc__,
r"""
A contrived example of ignoring too many commands in one comment.
This is specific to **Python**.

View file

@ -946,6 +946,19 @@ int DoxygenParser::ignoreCommand(const std::string& theCommand,
return 0;
}
// If we ignore the command, also ignore any whitespace preceding it as we
// want to avoid having lines consisting of whitespace only or trailing
// whitespace in general (at least Python, with its pep8 tool, really
// doesn't like it).
if (!doxyList.empty()) {
DoxygenEntityList::iterator i = doxyList.end();
--i;
if (i->typeOfEntity == "plainstd::string" &&
i->data.find_first_not_of(" \t") == std::string::npos) {
doxyList.erase(i);
}
}
// Determine what to do with the part of the comment between the start and
// end commands: by default, we simply throw it away, but "contents"
// attribute may be used to change this.