Skip to content

Commit

Permalink
Avoid orphan warning if notebook is included
Browse files Browse the repository at this point in the history
This is a bit of a hack, but it means that notebooks no longer need
to have the `orphan: true` metadata specified for any notebook that
is in the doc directory and is included through the `nbinclude`
directive, but is not in any toctrees.
  • Loading branch information
tbekolay committed Apr 8, 2016
1 parent 1b5c2f0 commit b1255d1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,13 @@ def run(self):
raise self.severe(
u'Problems with "nbinclude" directive:\n%s.' % error)

# Add the docname to the `files_to_rebuild` dictionary,
# which maps from files to files that include that file in a toctree.
# This suppresses the warning that is usually raised when a file
# is not in any toctree.
name, _ = os.path.splitext(os.path.relpath(path, settings.env.srcdir))
settings.env.files_to_rebuild.setdefault(name, set())

# Use the NotebookParser to get doctree nodes
nbparser = NotebookParser()
node = docutils.utils.new_document(path, settings)
Expand Down

0 comments on commit b1255d1

Please sign in to comment.