From 92bf5acabb0fe36314f2a5290add2494fbe430c3 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sat, 16 Aug 2025 16:57:46 +0200 Subject: [PATCH 1/3] DOC: fix latexmk link --- doc/usage.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/usage.ipynb b/doc/usage.ipynb index ab0f895e..bfe8187a 100644 --- a/doc/usage.ipynb +++ b/doc/usage.ipynb @@ -93,7 +93,7 @@ "\n", " python3 -m sphinx -b latex\n", "\n", - "If you don't know how to create a PDF file from the LaTeX output, you should have a look at [Latexmk](http://personal.psu.edu/jcc8//software/latexmk-jcc/) (see also [this tutorial](https://mg.readthedocs.io/latexmk.html)).\n", + "If you don't know how to create a PDF file from the LaTeX output, you should have a look at [Latexmk](https://www.cantab.net/users/johncollins/latexmk/index.html) (see also [this tutorial](https://mg.readthedocs.io/latexmk.html)).\n", "\n", "Sphinx can automatically check if the links you are using are still valid.\n", "Just invoke it like this:\n", From 05971054f56ba7676dc8dffedd55542853213f62 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sat, 16 Aug 2025 17:19:10 +0200 Subject: [PATCH 2/3] DOC: remove broken link --- doc/configuring-kernels.ipynb | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/configuring-kernels.ipynb b/doc/configuring-kernels.ipynb index 27b859e5..0bdd1157 100644 --- a/doc/configuring-kernels.ipynb +++ b/doc/configuring-kernels.ipynb @@ -91,7 +91,6 @@ "source": [ "If you are using https://mybinder.org/ and you want to define environment variables,\n", "you should create a file `.binder/start` in your repository\n", - "(see [Binder docs](https://mybinder.readthedocs.io/en/latest/using/config_files.html#start-run-code-before-the-user-sessions-starts))\n", "containing definitions like this:\n", "\n", "```bash\n", From 9a9c5369575cca4fde3af0738d4670f7ee28ca65 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 5 Oct 2025 18:12:59 +0200 Subject: [PATCH 3/3] doc2path: use base=False instead of base=None --- doc/conf.py | 4 ++-- doc/prolog-and-epilog.ipynb | 8 ++++---- src/nbsphinx/__init__.py | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 90304635..6cc95ab3 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -41,7 +41,7 @@ # This is processed by Jinja2 and inserted before each notebook nbsphinx_prolog = r""" -{% set docname = 'doc/' + env.doc2path(env.docname, base=None)|string %} +{% set docname = 'doc/' + env.doc2path(env.docname, base=False)|string %} .. raw:: html @@ -77,7 +77,7 @@ # This is processed by Jinja2 and inserted after each notebook nbsphinx_epilog = r""" -{% set docname = 'doc/' + env.doc2path(env.docname, base=None)|string %} +{% set docname = 'doc/' + env.doc2path(env.docname, base=False)|string %} .. raw:: latex \nbsphinxstopnotebook{\scriptsize\noindent\strut diff --git a/doc/prolog-and-epilog.ipynb b/doc/prolog-and-epilog.ipynb index 8aea2902..5fcd0be4 100644 --- a/doc/prolog-and-epilog.ipynb +++ b/doc/prolog-and-epilog.ipynb @@ -26,7 +26,7 @@ "You have access to the current [Sphinx build environment](https://www.sphinx-doc.org/en/master/extdev/envapi.html) via the variable `env`.\n", "Most notably, you can get the file name of the current notebook with\n", "\n", - " {{ env.doc2path(env.docname, base=None)|string }}\n", + " {{ env.doc2path(env.docname, base=False)|string }}\n", "\n", "Have a look at the [Jinja2 template documentation](https://jinja.palletsprojects.com/templates/) for more information.\n", "\n", @@ -42,7 +42,7 @@ "To avoid clashing braces you can try to insert additional spaces or LaTeX macros that don't have a visible effect, like e.g. `\\strut{}`.\n", "For example, you can avoid three consecutive opening braces with something like that:\n", "\n", - " \\texttt{\\strut{}{{ env.doc2path(env.docname, base=None)|string }}}\n", + " \\texttt{\\strut{}{{ env.doc2path(env.docname, base=False)|string }}}\n", "\n", "NB: The three consecutive closing braces in this example are not problematic.\n", " \n", @@ -83,7 +83,7 @@ "\n", "```python\n", "nbsphinx_prolog = \"\"\"\n", - "Go there: https://example.org/notebooks/{{ env.doc2path(env.docname, base=None)|string }}\n", + "Go there: https://example.org/notebooks/{{ env.doc2path(env.docname, base=False)|string }}\n", "\n", "----\n", "\"\"\"\n", @@ -93,7 +93,7 @@ "\n", "```python\n", "nbsphinx_prolog = r\"\"\"\n", - "{% set docname = env.doc2path(env.docname, base=None)|string %}\n", + "{% set docname = env.doc2path(env.docname, base=False)|string %}\n", "\n", ".. only:: html\n", "\n", diff --git a/src/nbsphinx/__init__.py b/src/nbsphinx/__init__.py index e597aed4..6edb4f82 100644 --- a/src/nbsphinx/__init__.py +++ b/src/nbsphinx/__init__.py @@ -597,7 +597,7 @@ def parse(self, inputstring, document): formats = { '.ipynb': lambda s: nbformat.reads(s, as_version=_ipynbversion)} formats.update(env.config.nbsphinx_custom_formats) - srcfile = str(env.doc2path(env.docname, base=None)) + srcfile = str(env.doc2path(env.docname, base=False)) for format, converter in formats.items(): if srcfile.endswith(format): break @@ -655,14 +655,14 @@ def parse(self, inputstring, document): except nbconvert.preprocessors.CellExecutionError as e: lines = str(e).split('\n') lines[0] = 'CellExecutionError in {}:'.format( - env.doc2path(env.docname, base=None)) + env.doc2path(env.docname, base=False)) lines.append("You can ignore this error by setting the following " "in conf.py:\n\n nbsphinx_allow_errors = True\n") raise NotebookError('\n'.join(lines)) except Exception as e: raise NotebookError( type(e).__name__ + ' in ' + - str(env.doc2path(env.docname, base=None)) + ':\n' + str(e)) + str(env.doc2path(env.docname, base=False)) + ':\n' + str(e)) rststring = """ .. role:: nbsphinx-math(raw) @@ -1348,7 +1348,7 @@ class CreateSectionLabels(docutils.transforms.Transform): def apply(self): env = self.document.settings.env - file_ext = str(env.doc2path(env.docname, base=None))[len(env.docname):] + file_ext = str(env.doc2path(env.docname, base=False))[len(env.docname):] i_still_have_to_create_the_document_label = True for section in self.document.findall(docutils.nodes.section): assert section.children @@ -1379,7 +1379,7 @@ class CreateDomainObjectLabels(docutils.transforms.Transform): def apply(self): env = self.document.settings.env - file_ext = str(env.doc2path(env.docname, base=None))[len(env.docname):] + file_ext = str(env.doc2path(env.docname, base=False))[len(env.docname):] for sig in self.document.findall(sphinx.addnodes.desc_signature): try: title = sig['ids'][0]