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

Prevent adding a source suffix twice #637

Merged
merged 2 commits into from
Sep 2, 2022
Merged
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
9 changes: 7 additions & 2 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import collections.abc
import copy
import html
from itertools import chain
import json
import os
import re
Expand Down Expand Up @@ -1929,10 +1930,14 @@ def patched_toctree_resolve(self, docname, builder, toctree, *args, **kwargs):


def config_inited(app, config):
if '.ipynb' not in config.source_suffix:
app.add_source_suffix('.ipynb', 'jupyter_notebook')
for suffix in config.nbsphinx_custom_formats:
app.add_source_suffix(suffix, 'jupyter_notebook')
if '.ipynb' in chain(config.source_suffix, app.registry.source_suffix):
# We don't interfere if '.ipynb' has been added by the user in conf.py
# or by another Sphinx extension that has been loaded earlier.
pass
else:
app.add_source_suffix('.ipynb', 'jupyter_notebook')

if '**.ipynb_checkpoints' not in config.exclude_patterns:
config.exclude_patterns.append('**.ipynb_checkpoints')
Expand Down