Ensure empty line before code and math blocks in doxygen pydoc
Sphinx requires an empty line before code and math blocks, whereas doxygen does not. This update ensures that a blank line is included before generated code and math blocks in the pydoc output. This is done by post-processing the docstring line by line to check whether any newlines need to be added. This way, if the original doxygen source already includes an empty line before a block, an additional unnecessary empty line is not added. Updating the expected test output for doxygen_basic_translate, which now adds the necessary empty line before the code block. Adding further test cases to doxygen_translate_all_tags to explicitly verify that a newline is added in the pydoc output before both code and math blocks that appear within a paragraph. Additionally, empty lines previously appearing at the beginning of the generated docstrings are now removed. This does not alter the behavior of the tests.
This commit is contained in:
parent
3476565665
commit
daad5d664d
6 changed files with 75 additions and 6 deletions
|
|
@ -46,6 +46,7 @@ Title: Minuses:
|
|||
* it\'s null
|
||||
|
||||
Warning: This may not work as expected
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
int main() { while(true); }
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ Title: Minuses:
|
|||
* it\'s null
|
||||
|
||||
Warning: This may not work as expected
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
int main() { while(true); }
|
||||
|
|
|
|||
|
|
@ -36,7 +36,14 @@ Not everything works right now...
|
|||
|
||||
.. code-block:: c++
|
||||
|
||||
some test code""")
|
||||
some test code
|
||||
|
||||
Code immediately following text. Pydoc translation must add an
|
||||
empty line before:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
more test code""")
|
||||
|
||||
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func02),
|
||||
r"""Conditional comment: SOMECONDITION
|
||||
|
|
@ -97,6 +104,13 @@ r""":raises: SuperError
|
|||
|
||||
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
|
||||
Math immediately following text. Pydoc translation must add an
|
||||
empty line before:
|
||||
|
||||
.. math::
|
||||
|
||||
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue