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

Add breathe_show_enumvalue_initializer option #581

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ Inspired by `Keepachangelog.com <http://keepachangelog.com/>`__.
- Unreleased - Breathe v4.21.1

- Fix Read the Docs build (again). #576
- New boolean `breathe_show_enumvalue_initializer` option specifying
whether value of enumvalue should be displayed. #581

- 2020-09-10 - Breathe v4.21.0

Expand Down
1 change: 1 addition & 0 deletions breathe/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ def setup(app: Sphinx) -> None:
app.add_config_value("breathe_build_directory", '', True)
app.add_config_value("breathe_default_members", (), True)
app.add_config_value("breathe_show_define_initializer", False, 'env')
app.add_config_value("breathe_show_enumvalue_initializer", False, 'env')
app.add_config_value("breathe_implementation_filename_extensions", ['.c', '.cc', '.cpp'], True)
app.add_config_value("breathe_doxygen_config_options", {}, True)
app.add_config_value("breathe_use_project_refids", False, "env")
Expand Down
5 changes: 4 additions & 1 deletion breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,10 @@ def content(contentnode):
return self.handle_declaration(node, declaration, content_callback=content)

def visit_enumvalue(self, node) -> List[Node]:
declaration = node.name + self.make_initializer(node)
if self.app.config.breathe_show_enumvalue_initializer: # type: ignore
declaration = node.name + self.make_initializer(node)
else:
declaration = node.name
return self.handle_declaration(node, declaration, obj_type='enumvalue')

def visit_typedef(self, node) -> List[Node]:
Expand Down
7 changes: 7 additions & 0 deletions documentation/source/directives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,13 @@ Config Values
For example a define ``MAX_LENGTH 100`` would be shown with the value 100 if this is set to ``True``,
and without if it is set to ``False``.

.. confval:: breathe_show_enumvalue_initializer

A boolean flag which can be set to ``True`` to display the initializer of an enum value in the output.

For example an enum value ``TWO = 2`` would be shown with the value 2 if this is set to ``True``,
and without if it is set to ``False``.

.. confval:: breathe_use_project_refids

True or False setting to control if the refids generated by breathe for doxygen
Expand Down