Skip to content

Commit

Permalink
Merge pull request #879 from schlatterbeck/sort-groups
Browse files Browse the repository at this point in the history
Add option to sort groups
  • Loading branch information
michaeljones authored Jan 16, 2023
2 parents 1860d37 + d75073d commit c4013f4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
pip install -r requirements/development.txt
sudo apt-get -y update
sudo apt-get -y install graphviz libclang1-9 libclang-cpp9
sudo apt-get -y install graphviz libclang1-11 libclang-cpp11
- name: install doxygen from SF binary archives
env:
Expand Down
2 changes: 1 addition & 1 deletion breathe/directives/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def warn(
self,
raw_text: str,
*,
rendered_nodes: Sequence[nodes.Node] = None,
rendered_nodes: Optional[Sequence[nodes.Node]] = None,
unformatted_suffix: str = ""
) -> List[nodes.Node]:
raw_text = self.format(raw_text) + unformatted_suffix
Expand Down
1 change: 1 addition & 0 deletions breathe/directives/content_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class _DoxygenContentBlockDirective(BaseDirective):
"undoc-members": flag,
"no-link": flag,
"desc-only": flag,
"sort": flag,
}
has_content = False

Expand Down
6 changes: 3 additions & 3 deletions breathe/file_state_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_outdated(
return []

stale = []
for filename, info in app.env.breathe_file_state.items(): # type: ignore
for filename, info in app.env.breathe_file_state.items():
old_mtime, docnames = info
if _getmtime(filename) > old_mtime:
stale.extend(docnames)
Expand All @@ -61,14 +61,14 @@ def _purge_doc(app: Sphinx, env: BuildEnvironment, docname: str) -> None:
return

toremove = []
for filename, info in app.env.breathe_file_state.items(): # type: ignore
for filename, info in app.env.breathe_file_state.items():
_, docnames = info
docnames.discard(docname)
if not docnames:
toremove.append(filename)

for filename in toremove:
del app.env.breathe_file_state[filename] # type: ignore
del app.env.breathe_file_state[filename]


def setup(app: Sphinx):
Expand Down
15 changes: 10 additions & 5 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,10 +649,10 @@ def handle_declaration(
node,
declaration: str,
*,
obj_type: str = None,
content_callback: ContentCallback = None,
display_obj_type: str = None,
declarator_callback: DeclaratorCallback = None,
obj_type: Optional[str] = None,
content_callback: Optional[ContentCallback] = None,
display_obj_type: Optional[str] = None,
declarator_callback: Optional[DeclaratorCallback] = None,
options={},
) -> List[Node]:
if obj_type is None:
Expand Down Expand Up @@ -1399,7 +1399,12 @@ def visit_sectiondef(self, node) -> List[Node]:
node_list.extend(self.render_optional(node.description))

# Get all the memberdef info
node_list.extend(self.render_iterable(node.memberdef))
if "sort" in options:
member_def = sorted(node.memberdef, key=lambda x: x.name)
else:
member_def = node.memberdef

node_list.extend(self.render_iterable(member_def))

if node_list:
if "members-only" in options:
Expand Down

0 comments on commit c4013f4

Please sign in to comment.