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

Add warning for notebooks without title #402

Merged
merged 2 commits into from
Mar 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

_ipynbversion = 4

logger = sphinx.util.logging.getLogger(__name__)

# See nbconvert/exporters/html.py:
DISPLAY_DATA_PRIORITY_HTML = (
'application/vnd.jupyter.widget-state+json',
Expand Down Expand Up @@ -1399,6 +1401,10 @@ def apply(self):
continue
all_ids.add(link_id)
section['ids'] = [link_id]
if not all_ids:
logger.warning(
'Each notebook should have at least one section title',
location=self.document[0])


class CreateSectionLabels(docutils.transforms.Transform):
Expand Down Expand Up @@ -1531,11 +1537,9 @@ def apply(self):
file = os.path.normpath(
os.path.join(os.path.dirname(env.docname), relpath))
if not os.path.isfile(os.path.join(env.srcdir, file)):
logger = sphinx.util.logging.getLogger(__name__)
logger.warning('File not found: %r', file, location=node)
continue # Link is ignored
elif file.startswith('..'):
logger = sphinx.util.logging.getLogger(__name__)
logger.warning('Link outside source directory: %r', file,
location=node)
continue # Link is ignored
Expand Down Expand Up @@ -1654,7 +1658,6 @@ def html_collect_pages(app):
try:
sphinx.util.copyfile(os.path.join(app.env.srcdir, file), target)
except OSError as err:
logger = sphinx.util.logging.getLogger(__name__)
logger.warning('Cannot copy local file %r: %s', file, err)
notebooks = app.env.nbsphinx_notebooks.values()
for notebook in status_iterator(
Expand Down Expand Up @@ -1686,7 +1689,6 @@ def env_updated(app, env):
try:
from ipywidgets.embed import DEFAULT_EMBED_REQUIREJS_URL
except ImportError:
logger = sphinx.util.logging.getLogger(__name__)
logger.warning(
'nbsphinx_widgets_path not given '
'and ipywidgets module unavailable')
Expand Down