Remove extra newline in beginning of doxygen python \code command

If \code is used as a block command (probably the main use case), an
extra newline was included in the translated Python comments.  This is
now removed and doxygen python test case output updated.
This commit is contained in:
John McFarland 2019-05-25 13:14:14 -05:00
commit 3d64a2c037
2 changed files with 5 additions and 1 deletions

View file

@ -49,7 +49,6 @@ Warning: This may not work as expected
.. code-block:: c++
int main() { while(true); }
}"""

View file

@ -493,6 +493,11 @@ void PyDocConverter::handleCode(DoxygenEntity &tag, std::string &translatedComme
std::string code;
handleTagVerbatim(tag, code, arg);
// Try and remove leading newline, which is present for block \code
// command:
if (code[0] == '\n')
code.erase(code.begin());
translatedComment += codeIndent;
for (size_t n = 0; n < code.length(); n++) {
if (code[n] == '\n') {