Skip to content

Commit

Permalink
Add support for innergroup
Browse files Browse the repository at this point in the history
Doxygen groups that are defined inside another group, either by scope or
by using \ingroup, are not automatically added to the documentation
unless an explicit reference is created.

This commit adds parsing of innergroup elements inside compound defs.

When using a group directive, .. doxygengroup:: myGroup, a new option
":inner:" must be added to include all innergroup elements. This allows
maintaining compatibility with previous projects.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
  • Loading branch information
utzig committed Jul 9, 2020
1 parent e3fcc6c commit 3e36e59
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions breathe/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ class DoxygenNamespaceDirective(_DoxygenContentBlockDirective):

class DoxygenGroupDirective(_DoxygenContentBlockDirective):
kind = "group"
option_spec = {
**_DoxygenContentBlockDirective.option_spec,
"inner": flag,
}


# TODO: is this comment still relevant?
Expand Down
6 changes: 6 additions & 0 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,12 @@ def render_derivedcompoundref(node):
addnode('innerclass', lambda: self.render_iterable(node.innerclass))
addnode('innernamespace', lambda: self.render_iterable(node.innernamespace))

if 'inner' in options:
for node in node.innergroup:
file_data = self.compound_parser.parse(node.refid)
inner = file_data.compounddef
addnode('innergroup', lambda: self.visit_compounddef(inner))

nodelist = []
for i, nodes_ in sorted(nodemap.items()):
nodelist += nodes_
Expand Down
7 changes: 6 additions & 1 deletion documentation/source/group.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source comments as cover in the `doxygen documentation`_.

It takes the standard ``project``, ``path``, ``outline`` and ``no-link`` options
and additionally the ``content-only``, ``members``, ``protected-members``,
``private-members`` and ``undoc-members`` options.
``private-members``, ``undoc-members`` and ``inner`` options.

``content-only``
If this flag is specified, then the directive does not output the name of the
Expand Down Expand Up @@ -42,6 +42,11 @@ If you would like to always specify some combination of ``members``,
use the :ref:`breathe_default_members <breathe-default-members>` configuration
variable to set it in the ``conf.py``.

``inner``
If specified, the groups that were defined inside this group, by either
defining them inside the scope of another group, or by using the Doxygen
\ingroup command, are also parsed and loaded.

.. _doxygen documentation: http://www.stack.nl/~dimitri/doxygen/manual/grouping.html

.. contents::
Expand Down

0 comments on commit 3e36e59

Please sign in to comment.