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

@ -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.