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

Removing any unsupported extensions #146

Merged
merged 1 commit into from
Sep 25, 2024
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
36 changes: 36 additions & 0 deletions rosdoc2/verbs/build/builders/sphinx_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,42 @@ def ensure_global(name, default):
ensure_global('release', "{package.version}")
ensure_global('version', "{package_version_short}")

# Remove any unsupported extensions
allowed_extensions = set((
# Shipped with sphinx
'sphinx.ext.autodoc',
'sphinx.ext.autosectionlabel',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.duration',
'sphinx.ext.extlinks',
'sphinx.ext.githubpages',
'sphinx.ext.graphviz',
'sphinx.ext.ifconfig',
'sphinx.ext.imgconverter',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.intersphinx',
'sphinx.ext.linkcode',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
# Sphinx-included math extensions
'sphinx.ext.imgmath',
'sphinx.ext.mathjax',
# Installed by us
'breathe',
'exhale',
'myst_parser',
'sphinx_rtd_theme',
))
for extension in extensions[:]:
if extension not in allowed_extensions:
print(f'[rosdoc2] *** Warning *** removing extension "{{extension}}", not supported')
extensions.remove(extension)
if extensions:
print(f'[rosdoc2] user conf.py specified allowed extensions: {{extensions}}')

if rosdoc2_settings.get('enable_autodoc', True):
print('[rosdoc2] enabling autodoc', file=sys.stderr)
extensions.append('sphinx.ext.autodoc')
Expand Down
28 changes: 28 additions & 0 deletions test/packages/basic_cpp/doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@
## See the rosdoc2_settings below for some options on avoiding that.
extensions = [
'sphinx_rtd_theme',
'i_do_not_exist',
# Shipped with sphinx
'sphinx.ext.autodoc',
'sphinx.ext.autosectionlabel',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.duration',
'sphinx.ext.extlinks',
'sphinx.ext.githubpages',
'sphinx.ext.graphviz',
'sphinx.ext.ifconfig',
'sphinx.ext.imgconverter',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.intersphinx',
'sphinx.ext.linkcode',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
# Sphinx-included math extensions
'sphinx.ext.imgmath',
'sphinx.ext.mathjax',

]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -126,3 +149,8 @@
## Support markdown
# 'support_markdown': True,
}

## This function is required by the linkcode extension.
## See https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html
def linkcode_resolve(domain, info):
return None