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

apidoc: add -m, --members option flag #694

Merged
merged 2 commits into from
May 6, 2021
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: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: build the documentation
run: |
make html
PYTHONPATH="${PWD}${PYTHONPATH:+:$PYTHONPATH}" make html
rm documentation/build/html/.buildinfo

- uses: actions/upload-artifact@v1
Expand Down
21 changes: 17 additions & 4 deletions breathe/apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
'namespace': 'Namespace',
'group': 'Group'}

# Types that accept the :members: option.
MEMBERS_TYPES = [
'class',
'group',
'interface',
'namespace',
'struct'
]


def print_info(msg, args):
if not args.quiet:
Expand Down Expand Up @@ -85,11 +94,13 @@ def format_heading(level, text):
return '%s\n%s\n\n' % (text, underlining)


def format_directive(package_type, package, project):
def format_directive(package_type, package, args):
"""Create the breathe directive and add the options."""
directive = '.. doxygen%s:: %s\n' % (package_type, package)
if project:
directive += ' :project: %s\n' % project
if args.project:
directive += ' :project: %s\n' % args.project
if args.members and package_type in MEMBERS_TYPES:
directive += ' :members:\n'
return directive


Expand All @@ -99,7 +110,7 @@ def create_package_file(package, package_type, package_id, args):
if package_type not in args.outtypes:
return
text = format_heading(1, '%s %s' % (TYPEDICT[package_type], package))
text += format_directive(package_type, package, args.project)
text += format_directive(package_type, package, args)

write_file(os.path.join(package_type, package_id), text, args)

Expand Down Expand Up @@ -157,6 +168,8 @@ def main():
help='Directory to place all output', required=True)
parser.add_argument('-f', '--force', action='store_true', dest='force',
help='Overwrite existing files')
parser.add_argument('-m', '--members', action='store_true', dest='members',
help='Include members for types: %s' % MEMBERS_TYPES)
parser.add_argument('-n', '--dry-run', action='store_true', dest='dryrun',
help='Run the script without creating files')
parser.add_argument('-T', '--no-toc', action='store_true', dest='notoc',
Expand Down