Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support titles in verbatim blocks #517

Merged
merged 1 commit into from
May 2, 2020
Merged

Support titles in verbatim blocks #517

merged 1 commit into from
May 2, 2020

Conversation

lshamis
Copy link
Contributor

@lshamis lshamis commented May 1, 2020

@vermeeren vermeeren self-assigned this May 2, 2020
@vermeeren vermeeren added code Source code enhancement Improvements, additions (also cosmetics) labels May 2, 2020
@vermeeren vermeeren self-requested a review May 2, 2020 01:19
Copy link
Collaborator

@vermeeren vermeeren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lshamis I notice in tests/test_renderer.py:94 there is currently a dummy nested_parse, I think we should also change that one to match the change to nested_parse_with_titles().

The doc you linked makes it kinda obvious, this method is indeed just better without any downsides. Probably appeared in some later Sphinx version sometime ago.

@lshamis
Copy link
Contributor Author

lshamis commented May 2, 2020

@vermeeren I'm not sure how to replace the one at tests/test_renderer.py:94.

nested_parse_with_titles is a free floating function. MockState.nested_parse is a bound method.

class MockState:
    def __init__(self, app):
        env = sphinx.environment.BuildEnvironment(app)
        env.setup(app)
        env.temp_data['docname'] = 'mock-doc'
        settings = frontend.OptionParser(
            components=(parsers.rst.Parser,)).get_default_values()
        settings.env = env
        self.document = utils.new_document('', settings)

    def nested_parse(self, content, content_offset, contentnode):  # <-- :94
        pass

@vermeeren
Copy link
Collaborator

@lshamis My bad, I wasn't fully awake when I posted it. I believe it is safe to remove the nested_parse in the test render, since no other Breathe code uses nested_parse. At the same time, perhaps functions called by Breathe call nested_parse internally, in which case we should probably not remove it.

Do you think it is better to keep the nested_parse in the test renderer just in case? If so this is good for merging really, I'll probably bump version after so you can use it right away.

@lshamis
Copy link
Contributor Author

lshamis commented May 2, 2020

Removing nested_parse breaks the tests:

================================================ short test summary info ================================================
FAILED test_renderer.py::test_render_func - AttributeError: 'MockState' object has no attribute 'nested_parse'
FAILED test_renderer.py::test_render_typedef - AttributeError: 'MockState' object has no attribute 'nested_parse'
FAILED test_renderer.py::test_render_c_typedef - AttributeError: 'MockState' object has no attribute 'nested_parse'
FAILED test_renderer.py::test_render_c_function_typedef - AttributeError: 'MockState' object has no attribute 'nested_...
FAILED test_renderer.py::test_render_using_alias - AttributeError: 'MockState' object has no attribute 'nested_parse'
FAILED test_renderer.py::test_render_const_func - AttributeError: 'MockState' object has no attribute 'nested_parse'
FAILED test_renderer.py::test_render_lvalue_func - AttributeError: 'MockState' object has no attribute 'nested_parse'
FAILED test_renderer.py::test_render_rvalue_func - AttributeError: 'MockState' object has no attribute 'nested_parse'
FAILED test_renderer.py::test_render_const_lvalue_func - AttributeError: 'MockState' object has no attribute 'nested_p...
FAILED test_renderer.py::test_render_const_rvalue_func - AttributeError: 'MockState' object has no attribute 'nested_p...
FAILED test_renderer.py::test_render_variable_initializer - AttributeError: 'MockState' object has no attribute 'neste...
FAILED test_renderer.py::test_render_define_initializer - AttributeError: 'MockState' object has no attribute 'nested_...
FAILED test_renderer.py::test_render_define_no_initializer - AttributeError: 'MockState' object has no attribute 'nest...
============================================= 13 failed, 5 passed in 3.69s ==============================================

@vermeeren
Copy link
Collaborator

Suspected that could happen, everything is fine then as-is.

@vermeeren vermeeren linked an issue May 2, 2020 that may be closed by this pull request
@vermeeren vermeeren merged commit 4ed5352 into breathe-doc:master May 2, 2020
vermeeren added a commit that referenced this pull request May 2, 2020
@vermeeren
Copy link
Collaborator

Released as 4.18.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Source code enhancement Improvements, additions (also cosmetics)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Section titles in comments
2 participants