Skip to content

Commit

Permalink
Removing any unsupported extensions (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkent authored Sep 25, 2024
1 parent 24c51d5 commit 54dbcc5
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
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

0 comments on commit 54dbcc5

Please sign in to comment.