Eliminate extra newlines in doxygen python \verbatim blocks
Eliminate extra leading and trailing newlines present in translated doxygen \verbatim comments for python. Updating doxygen python tests accordingly.
This commit is contained in:
parent
321cb096a8
commit
c52bed2e66
4 changed files with 19 additions and 5 deletions
|
|
@ -283,13 +283,11 @@ r"""TODO: Some very important task
|
|||
|
||||
|
||||
|
||||
|
||||
very long
|
||||
text with tags <sometag>
|
||||
|
||||
|
||||
|
||||
|
||||
Version: 0.0.0.2
|
||||
|
||||
Warning: This is senseless!
|
||||
|
|
|
|||
|
|
@ -120,11 +120,9 @@ TODO: Some very important task
|
|||
:type b: float
|
||||
:param b: B is mentioned again...
|
||||
|
||||
|
||||
very long
|
||||
text with tags <sometag>
|
||||
|
||||
|
||||
Version: 0.0.0.2
|
||||
|
||||
Warning: This is senseless!
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ void PyDocConverter::fillStaticTables() {
|
|||
tagHandlers["short"] = make_handler(&PyDocConverter::handleParagraph);
|
||||
tagHandlers["todo"] = make_handler(&PyDocConverter::handleParagraph);
|
||||
tagHandlers["version"] = make_handler(&PyDocConverter::handleParagraph);
|
||||
tagHandlers["verbatim"] = make_handler(&PyDocConverter::handleParagraph);
|
||||
tagHandlers["verbatim"] = make_handler(&PyDocConverter::handleVerbatimBlock);
|
||||
tagHandlers["warning"] = make_handler(&PyDocConverter::handleParagraph);
|
||||
tagHandlers["xmlonly"] = make_handler(&PyDocConverter::handleParagraph);
|
||||
// these commands have special handlers
|
||||
|
|
@ -419,6 +419,19 @@ void PyDocConverter::handleParagraph(DoxygenEntity &tag, std::string &translated
|
|||
translatedComment += translateSubtree(tag);
|
||||
}
|
||||
|
||||
void PyDocConverter::handleVerbatimBlock(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
|
||||
string verb = translateSubtree(tag);
|
||||
|
||||
if ((! verb.empty()) && verb[0] == '\n')
|
||||
verb.erase(verb.begin());
|
||||
|
||||
// Remove the last newline to prevent doubling the newline already present after \endverbatim
|
||||
trimWhitespace(verb); // Needed to catch trailing newline below
|
||||
if ((! verb.empty()) && verb[verb.size()-1] == '\n')
|
||||
verb = verb.substr(0, verb.size()-1);
|
||||
translatedComment += verb;
|
||||
}
|
||||
|
||||
void PyDocConverter::handleMath(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
|
||||
IndentGuard indent;
|
||||
|
||||
|
|
|
|||
|
|
@ -79,6 +79,11 @@ protected:
|
|||
*/
|
||||
void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg = std::string());
|
||||
|
||||
/*
|
||||
* Handle Doxygen verbatim tag
|
||||
*/
|
||||
void handleVerbatimBlock(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg = std::string());
|
||||
|
||||
/*
|
||||
* Handle one of the Doxygen formula-related tags.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue