Skip to content

Commit

Permalink
Fix appending to existing template path (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw authored Jan 10, 2024
1 parent ef38c2b commit 4d63ee5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sphinx_apipages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ def setup(app: sphinx.application.Sphinx):
app.add_config_value("apipages_dst_dir", "docs/api", False)
app.add_config_value("apipages_hidden_methods", ["__call__"], False)

# Extend templates_path for autosummary templates
templates_path = audeer.path(package_dir, "templates")
if hasattr(app.config, "templates_path"):
app.config.templates_path.append(templates_path)
else:
app.config.templates_path = templates_path

# Disable auto-generation of TOC entries in the API
# https://github.com/sphinx-doc/sphinx/issues/6316
app.config.toc_object_entries = False
Expand Down Expand Up @@ -71,6 +64,13 @@ def config_inited(app: sphinx.application.Sphinx, config):
src_dir = app.config.apipages_src_dir
dst_dir = app.config.apipages_dst_dir

# Extend templates_path for autosummary templates
templates_path = audeer.path(package_dir, "templates")
if hasattr(app.config, "templates_path"):
app.config.templates_path.append(templates_path)
else:
app.config.templates_path = templates_path

# Copy API (sub-)module RST files to dst folder
if os.path.exists(src_dir):
audeer.mkdir(dst_dir)
Expand Down

0 comments on commit 4d63ee5

Please sign in to comment.