Skip to content

Commit

Permalink
Allow to hide in which headers the entity is defined
Browse files Browse the repository at this point in the history
When something like "doxygennamespace" is used, structures gain
additional line about in which header they are defined.

If the API simply serves as a generic description and no public headers
are provided, this info is redundant. This can be worked around by
manually by using "doxygenstruct" directive instead, but this can get
messy quickly with large namespaces. Also, namespace description is
lost.

Allow to hide these lines by setting 'breathe_show_include' to
'False'. The default behavior stays unchanged.

See breathe-doc#57.
  • Loading branch information
rhssk committed Sep 20, 2021
1 parent a06ad44 commit b0ed71f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions breathe/directives/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def setup(app: Sphinx) -> None:
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_show_include", True, '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
3 changes: 3 additions & 0 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,9 @@ def visit_verbatim(self, node) -> List[Node]:
return [rst_node]

def visit_inc(self, node) -> List[Node]:
if not self.app.config.breathe_show_include:
return []

if node.local == u"yes":
text = '#include "%s"' % node.content_[0].getValue()
else:
Expand Down
17 changes: 17 additions & 0 deletions documentation/source/directives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,23 @@ Config Values
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_show_include

A boolean flag which can be set to ``False`` to hide the header in which each
entity (struct, function, macro, etc.) is defined.

For example, when set to ``True`` (the default) a ``struct Foo`` is rendered
similarly to::

struct Foo
#include <foo.hpp>
Description of Foo.

but when set to ``False`` it is instead rendered as::

struct Foo
Description of Foo.

.. confval:: breathe_use_project_refids

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

0 comments on commit b0ed71f

Please sign in to comment.