Hello community,

here is the log from the commit of package python-nbsphinx for openSUSE:Factory 
checked in at 2020-02-10 21:56:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-nbsphinx (Old)
 and      /work/SRC/openSUSE:Factory/.python-nbsphinx.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-nbsphinx"

Mon Feb 10 21:56:11 2020 rev:4 rq:773155 version:0.5.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-nbsphinx/python-nbsphinx.changes  
2020-01-16 18:20:49.360960620 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-nbsphinx.new.26092/python-nbsphinx.changes   
    2020-02-10 21:56:13.110283693 +0100
@@ -1,0 +2,8 @@
+Mon Feb 10 16:03:30 UTC 2020 - Todd R <toddrme2...@gmail.com>
+
+- Update to 0.5.1
+  * This will be the last release supporting Python 2.x!
+  * Support for https://github.com/choldgraf/sphinx-copybutton
+  * Executed notebooks are now saved in the HTML output directory
+
+-------------------------------------------------------------------

Old:
----
  nbsphinx-0.5.0.tar.gz

New:
----
  nbsphinx-0.5.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-nbsphinx.spec ++++++
--- /var/tmp/diff_new_pack.ccYUkh/_old  2020-02-10 21:56:14.538284482 +0100
+++ /var/tmp/diff_new_pack.ccYUkh/_new  2020-02-10 21:56:14.542284484 +0100
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define         skip_python2 1
 Name:           python-nbsphinx
-Version:        0.5.0
+Version:        0.5.1
 Release:        0
 Summary:        Jupyter Notebook Tools for Sphinx
 License:        MIT

++++++ nbsphinx-0.5.0.tar.gz -> nbsphinx-0.5.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/LICENSE new/nbsphinx-0.5.1/LICENSE
--- old/nbsphinx-0.5.0/LICENSE  2019-09-30 19:30:19.000000000 +0200
+++ new/nbsphinx-0.5.1/LICENSE  2020-01-28 10:45:38.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2019 Matthias Geier
+Copyright (c) 2015-2020 Matthias Geier
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/NEWS.rst new/nbsphinx-0.5.1/NEWS.rst
--- old/nbsphinx-0.5.0/NEWS.rst 2019-11-20 11:39:29.000000000 +0100
+++ new/nbsphinx-0.5.1/NEWS.rst 2020-01-28 10:57:05.000000000 +0100
@@ -1,3 +1,8 @@
+Version 0.5.1 (2020-01-28):
+ * This will be the last release supporting Python 2.x!
+ * Support for https://github.com/choldgraf/sphinx-copybutton
+ * Executed notebooks are now saved in the HTML output directory
+
 Version 0.5.0 (2019-11-20):
  * Automatic support for Jupyter widgets, customizable with
    ``nbsphinx_widgets_path`` (and ``nbsphinx_widgets_options``)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/PKG-INFO new/nbsphinx-0.5.1/PKG-INFO
--- old/nbsphinx-0.5.0/PKG-INFO 2019-11-20 11:46:18.000000000 +0100
+++ new/nbsphinx-0.5.1/PKG-INFO 2020-01-28 11:01:43.000000000 +0100
@@ -1,12 +1,12 @@
 Metadata-Version: 1.2
 Name: nbsphinx
-Version: 0.5.0
+Version: 0.5.1
 Summary: Jupyter Notebook Tools for Sphinx
-Home-page: UNKNOWN
+Home-page: https://nbsphinx.readthedocs.io/
 Author: Matthias Geier
 Author-email: matthias.ge...@gmail.com
 License: MIT
-Project-URL: Documentation, http://nbsphinx.readthedocs.io/
+Project-URL: Documentation, https://nbsphinx.readthedocs.io/
 Project-URL: Source Code, https://github.com/spatialaudio/nbsphinx/
 Project-URL: Bug Tracker, https://github.com/spatialaudio/nbsphinx/issues/
 Description: Jupyter Notebook Tools for Sphinx
@@ -53,3 +53,4 @@
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
 Classifier: Topic :: Documentation :: Sphinx
+Requires-Python: >=2.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/code-cells.ipynb 
new/nbsphinx-0.5.1/doc/code-cells.ipynb
--- old/nbsphinx-0.5.0/doc/code-cells.ipynb     2019-11-16 11:23:33.000000000 
+0100
+++ new/nbsphinx-0.5.1/doc/code-cells.ipynb     2020-01-28 10:45:38.000000000 
+0100
@@ -382,9 +382,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "scrolled": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "fig, ax = plt.subplots(figsize=[6, 3])\n",
@@ -650,9 +648,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "scrolled": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "link = w.IntSlider(description='link')\n",
@@ -736,9 +732,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "scrolled": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "print('BEWARE: \\x1b[1;33;41mugly colors\\x1b[m!', file=sys.stderr)\n",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/conf.py 
new/nbsphinx-0.5.1/doc/conf.py
--- old/nbsphinx-0.5.0/doc/conf.py      2019-11-16 11:23:37.000000000 +0100
+++ new/nbsphinx-0.5.1/doc/conf.py      2020-01-28 10:45:38.000000000 +0100
@@ -1,11 +1,14 @@
 #!/usr/bin/env python3
 
+import os
+
 # Use sphinx-quickstart to create your own conf.py file!
 # After that, you have to edit a few things.  See below.
 
 # Select nbsphinx and, if needed, other Sphinx extensions:
 extensions = [
     'nbsphinx',
+    'sphinx_copybutton',  # for "copy to clipboard" buttons
     'sphinx.ext.mathjax',  # for math equations
     'sphinxcontrib.bibtex',  # for bibliographic references
     'sphinxcontrib.rsvgconverter',  # for SVG->PDF conversion in LaTeX output
@@ -29,23 +32,37 @@
     "--InlineBackend.rc={'figure.dpi': 96}",
 ]
 
+# Environment variables to be passed to the kernel:
+os.environ['MY_DUMMY_VARIABLE'] = 'Hello from conf.py!'
+
 # This is processed by Jinja2 and inserted before each notebook
 nbsphinx_prolog = r"""
 {% set docname = 'doc/' + env.doc2path(env.docname, base=None) %}
 
-.. only:: html
-
-    .. role:: raw-html(raw)
-        :format: html
+.. raw:: html
 
-    .. nbinfo::
-
-        This page was generated from `{{ docname }}`__.
+    <div class="admonition note">
+      <p>This page was generated from
+        <a class="reference external" 
href="https://github.com/spatialaudio/nbsphinx/blob/{{ env.config.release|e 
}}/{{ docname|e }}">{{ docname|e }}</a>.
         Interactive online version:
-        :raw-html:`<a 
href="https://mybinder.org/v2/gh/spatialaudio/nbsphinx/{{ env.config.release 
}}?filepath={{ docname }}"><img alt="Binder badge" 
src="https://mybinder.org/badge_logo.svg"; 
style="vertical-align:text-bottom"></a>`
-
-    __ https://github.com/spatialaudio/nbsphinx/blob/
-        {{ env.config.release }}/{{ docname }}
+        <a href="https://mybinder.org/v2/gh/spatialaudio/nbsphinx/{{ 
env.config.release|e }}?filepath={{ docname|e }}"><img alt="Binder badge" 
src="https://mybinder.org/badge_logo.svg"; 
style="vertical-align:text-bottom"></a>.
+      </p>
+      <script>
+        if (document.location.host) {
+          var p = document.currentScript.previousSibling.previousSibling;
+          var a = document.createElement('a');
+          a.innerHTML = 'View in <em>nbviewer</em>';
+          a.href = `https://nbviewer.jupyter.org/url${
+            (window.location.protocol == 'https:' ? 's/' : '/') +
+            window.location.host +
+            window.location.pathname.slice(0, -4) }ipynb`;
+          a.classList.add('reference');
+          a.classList.add('external');
+          p.appendChild(a);
+          p.appendChild(document.createTextNode('.'));
+        }
+      </script>
+    </div>
 
 .. raw:: latex
 
@@ -77,7 +94,7 @@
 
 project = 'nbsphinx'
 author = 'Matthias Geier'
-copyright = '2019, ' + author
+copyright = '2020, ' + author
 
 linkcheck_ignore = [r'http://localhost:\d+/']
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/configuring-kernels.ipynb 
new/nbsphinx-0.5.1/doc/configuring-kernels.ipynb
--- old/nbsphinx-0.5.0/doc/configuring-kernels.ipynb    1970-01-01 
01:00:00.000000000 +0100
+++ new/nbsphinx-0.5.1/doc/configuring-kernels.ipynb    2020-01-25 
13:05:31.000000000 +0100
@@ -0,0 +1,141 @@
+{
+ "cells": [
+  {
+   "cell_type": "markdown",
+   "metadata": {
+    "nbsphinx": "hidden"
+   },
+   "source": [
+    "This notebook is part of the `nbsphinx` documentation: 
https://nbsphinx.readthedocs.io/.";
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "# Configuring the Kernels"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Kernel Name\n",
+    "\n",
+    "If we have multiple kernels installed, we can choose to override the 
kernel saved in the notebook using 
[nbsphinx_kernel_name](usage.ipynb#nbsphinx_kernel_name):\n",
+    "```python\n",
+    "nbsphinx_kernel_name = 'python-upstream-dev'\n",
+    "```\n",
+    "which uses the kernel named `python-upstream-dev` instead of the kernel 
name stored in the notebook."
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Kernel Arguments\n",
+    "\n",
+    "We can also pass options to the kernel by setting 
[nbsphinx_execute_arguments](usage.ipynb#nbsphinx_execute_arguments) in 
`conf.py`. These work the same way as `ipython_kernel_config.py`. For example, 
using\n",
+    "```python\n",
+    "nbsphinx_execute_arguments = [\n",
+    "    \"--InlineBackend.rc={'figure.dpi': 96}\",\n",
+    "]\n",
+    "```\n",
+    "to set [plot options](code-cells.ipynb#Plots) is the same as writing:\n",
+    "```python\n",
+    "c.InlineBackend.rc = {'figure.dpi': 96}\n",
+    "```\n",
+    "in `ipython_kernel_config.py` or using:\n",
+    "```ipython\n",
+    "%config InlineBackend.rc={'figure.dpi': 96}\n",
+    "```\n",
+    "at the top of a notebook:"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "get_ipython().config.InlineBackend.rc"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Environment Variables\n",
+    "\n",
+    "The contents of `os.environ` after the execution of `conf.py` will be 
passed as environment variables to the kernel. As an example, 
`MY_DUMMY_VARIABLE` has been set in [conf.py](conf.py) like this:\n",
+    "\n",
+    "```python\n",
+    "import os\n",
+    "os.environ['MY_DUMMY_VARIABLE'] = 'Hello from conf.py!'\n",
+    "```\n",
+    "\n",
+    "... and it can be checked in the notebook like this:"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import os\n",
+    "os.environ['MY_DUMMY_VARIABLE']"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "This is useful if we want to edit `PYTHONPATH` in order to compile the 
documentation without installing the project:\n",
+    "```python\n",
+    "import os\n",
+    "\n",
+    "src = os.path.abspath('../src')\n",
+    "os.environ['PYTHONPATH'] = src\n",
+    "```"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "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/config_files.html#start-run-code-before-the-user-sessions-starts))\n",
+    "containing definitions like this:\n",
+    "\n",
+    "```bash\n",
+    "#!/bin/bash\n",
+    "export MY_DUMMY_VARIABLE=\"Hello from .binder/start!\"\n",
+    "exec \"$@\"\n",
+    "```"
+   ]
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "Python 3",
+   "language": "python",
+   "name": "python3"
+  },
+  "language_info": {
+   "codemirror_mode": {
+    "name": "ipython",
+    "version": 3
+   },
+   "file_extension": ".py",
+   "mimetype": "text/x-python",
+   "name": "python",
+   "nbconvert_exporter": "python",
+   "pygments_lexer": "ipython3",
+   "version": "3.7.6rc1"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/contributing.rst 
new/nbsphinx-0.5.1/doc/contributing.rst
--- old/nbsphinx-0.5.0/doc/contributing.rst     1970-01-01 01:00:00.000000000 
+0100
+++ new/nbsphinx-0.5.1/doc/contributing.rst     2020-01-28 10:45:38.000000000 
+0100
@@ -0,0 +1 @@
+.. include:: ../CONTRIBUTING.rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/executing-notebooks.ipynb 
new/nbsphinx-0.5.1/doc/executing-notebooks.ipynb
--- old/nbsphinx-0.5.0/doc/executing-notebooks.ipynb    2019-09-30 
19:30:19.000000000 +0200
+++ new/nbsphinx-0.5.1/doc/executing-notebooks.ipynb    2020-01-25 
13:05:31.000000000 +0100
@@ -31,6 +31,7 @@
     "* [Explicitly Dis-/Enabling Notebook Execution](never-execute.ipynb)\n",
     "* [Ignoring Errors](allow-errors.ipynb)\n",
     "* [Ignoring Errors on a Per-Cell Basis](allow-errors-per-cell.ipynb)\n",
+    "* [Configuring Kernels](configuring-kernels.ipynb)\n",
     "* [Cell Execution Timeout](timeout.ipynb)"
    ]
   }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/index.rst 
new/nbsphinx-0.5.1/doc/index.rst
--- old/nbsphinx-0.5.0/doc/index.rst    2019-11-16 11:23:33.000000000 +0100
+++ new/nbsphinx-0.5.1/doc/index.rst    2020-01-28 10:45:38.000000000 +0100
@@ -1,6 +1,7 @@
 .. include:: ../README.rst
 
-All content shown below -- except for the section :doc:`a-normal-rst-file` --
+All content shown below -- except for the sections :doc:`a-normal-rst-file`,
+:doc:`contributing` and :doc:`version-history` --
 was generated from Jupyter notebooks.
 
 .. toctree::
@@ -19,6 +20,8 @@
     subdir/*
     a-normal-rst-file
     links
+    contributing
+    version-history
 
 .. only:: html
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/installation.ipynb 
new/nbsphinx-0.5.1/doc/installation.ipynb
--- old/nbsphinx-0.5.0/doc/installation.ipynb   2019-09-30 19:30:19.000000000 
+0200
+++ new/nbsphinx-0.5.1/doc/installation.ipynb   2020-01-28 10:45:38.000000000 
+0100
@@ -17,7 +17,7 @@
     "\n",
     "Note that some packages may be out of date.\n",
     "You can always get the newest `nbsphinx` release from 
[PyPI](https://pypi.org/project/nbsphinx) (using `pip`).\n",
-    "If you want to try the latest development version, have a look at the 
file 
[CONTRIBUTING.rst](https://github.com/spatialaudio/nbsphinx/blob/master/CONTRIBUTING.rst).\n",
+    "If you want to try the latest development version, have a look at the 
section [Contributing](contributing.rst).\n",
     "\n",
     "## nbsphinx Packages\n",
     "\n",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/links.ipynb 
new/nbsphinx-0.5.1/doc/links.ipynb
--- old/nbsphinx-0.5.0/doc/links.ipynb  2019-09-30 19:30:19.000000000 +0200
+++ new/nbsphinx-0.5.1/doc/links.ipynb  2020-01-25 13:05:31.000000000 +0100
@@ -36,18 +36,30 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "**notebook_sphinxext.py**\n",
+    "**RunNotebook (notebook_sphinxext.py)**\n",
     "\n",
     "Notebooks can be included in `*.rst` files with a custom `notebook` 
directive.\n",
-    "Uses `runipy` to execute notebooks and `nbconvert` to convert the result 
to HTML.\n",
+    "Uses `nbconvert` to execute notebooks and to convert the result to 
HTML.\n",
     "\n",
     "No LaTeX support.\n",
     "\n",
     "https://github.com/ngoldbaum/RunNotebook\n";,
     "\n",
-    
"https://bitbucket.org/yt_analysis/yt-doc/src/default/extensions/notebook_sphinxext.py\n";,
+    "There are some forks:\n",
     "\n",
-    
"https://github.com/matthew-brett/perrin-academy/blob/master/sphinxext/notebook_sphinxext.py";
+    "* 
https://bitbucket.org/yt_analysis/yt-doc/src/default/extensions/notebook_sphinxext.py\n";,
+    "* 
https://github.com/matthew-brett/perrin-academy/blob/master/sphinxext/notebook_sphinxext.py";
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "**nbsite**\n",
+    "\n",
+    "Build a tested, sphinx-based website from notebooks.\n",
+    "\n",
+    "https://nbsite.pyviz.org/";
    ]
   },
   {
@@ -252,7 +264,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.7.3"
+   "version": "3.7.6"
   }
  },
  "nbformat": 4,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/requirements.txt 
new/nbsphinx-0.5.1/doc/requirements.txt
--- old/nbsphinx-0.5.0/doc/requirements.txt     2019-11-16 11:23:37.000000000 
+0100
+++ new/nbsphinx-0.5.1/doc/requirements.txt     2020-01-26 17:00:36.000000000 
+0100
@@ -5,3 +5,4 @@
 sphinxcontrib-bibtex
 sphinxcontrib-svg2pdfconverter
 ipywidgets
+sphinx-copybutton
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/usage.ipynb 
new/nbsphinx-0.5.1/doc/usage.ipynb
--- old/nbsphinx-0.5.0/doc/usage.ipynb  2019-11-17 12:30:50.000000000 +0100
+++ new/nbsphinx-0.5.1/doc/usage.ipynb  2020-01-28 10:45:38.000000000 +0100
@@ -95,7 +95,10 @@
     "* `'sphinxcontrib.bibtex'`\n",
     "  for [bibliographic references](a-normal-rst-file.rst#references)\n",
     "* `'sphinxcontrib.rsvgconverter'`\n",
-    "  for [SVG->PDF conversion in LaTeX 
output](markdown-cells.ipynb#SVG-support-for-LaTeX)"
+    "  for [SVG->PDF conversion in LaTeX 
output](markdown-cells.ipynb#SVG-support-for-LaTeX)\n",
+    "* `'sphinx_copybutton'`\n",
+    "  for [adding \"copy to clipboard\" 
buttons](https://sphinx-copybutton.readthedocs.io/)\n",
+    "  to all text/code boxes"
    ]
   },
   {
@@ -260,7 +263,9 @@
     "```\n",
     "\n",
     "If you don't use LaTeX/PDF output,\n",
-    "you can drop the `'pdf'` figure format."
+    "you can drop the `'pdf'` figure format.\n",
+    "\n",
+    "See [Configuring the 
Kernels](configuring-kernels.ipynb#Kernel-Arguments)."
    ]
   },
   {
@@ -288,7 +293,9 @@
     "\n",
     "```python\n",
     "nbsphinx_kernel_name = 'python3'\n",
-    "```"
+    "```\n",
+    "\n",
+    "See [Configuring the Kernels](configuring-kernels.ipynb#Kernel-Name)."
    ]
   },
   {
@@ -497,17 +504,31 @@
     "\n",
     "There are two different methods, both of which are described below.\n",
     "\n",
-    "In both cases, you'll first have to create an account on 
https://readthedocs.org/ and connect your GitLab/Github/Bitbucket account. 
Instead of connecting, you can also manually add any publicly available 
Git/Subversion/Mercurial/Bazaar repository.\n",
-    "\n",
-    "After doing the steps described below, you only have to \"push\" to your 
repository, and the HTML pages and the PDF file of your stuff are automagically 
created on readthedocs.org. Awesome!\n",
-    "\n",
-    "You can even have different versions of your stuff, just use Git tags and 
branches and select in the readthedocs.org settings (under \"Admin\", 
\"Versions\") which of those should be created.\n",
+    "In both cases, you'll first have to create an account on 
https://readthedocs.org/\n";,
+    "and connect your GitLab/Github/Bitbucket/... account.\n",
+    "Instead of connecting, you can also manually add\n",
+    "any publicly available Git/Subversion/Mercurial/Bazaar/... repository.\n",
+    "\n",
+    "After doing the steps described below,\n",
+    "you only have to \"push\" to your repository,\n",
+    "and the HTML pages and the PDF file of your stuff\n",
+    "are automagically created on readthedocs.org.\n",
+    "Awesome!\n",
+    "\n",
+    "You can even have different versions of your stuff,\n",
+    "just use Git tags and branches and select in the\n",
+    "[readthedocs.org settings](https://readthedocs.org/dashboard/)\n",
+    "which of those should be created.\n",
     "\n",
     "<div class=\"alert alert-info\">\n",
     "\n",
     "**Note:**\n",
     "\n",
-    "If you want to execute notebooks (see [Controlling Notebook 
Execution](executing-notebooks.ipynb)), you'll need to install the appropriate 
Jupyter kernel.  In the examples below, the IPython kernel ist installed from 
the packet `ipykernel`.\n",
+    "If you want to execute notebooks\n",
+    "(see [Controlling Notebook Execution](executing-notebooks.ipynb)),\n",
+    "you'll need to install the appropriate Jupyter kernel.\n",
+    "In the examples below,\n",
+    "the IPython kernel is installed from the packet `ipykernel`.\n",
     "\n",
     "</div>"
    ]
@@ -518,18 +539,32 @@
    "source": [
     "### Using `requirements.txt`\n",
     "\n",
-    "1. Create a file named `requirements.txt` (or whatever name you wish) in 
your repository containing the required pip packages:\n",
+    "1. Create a file named `.readthedocs.yml`\n",
+    "   in the main directory of your repository\n",
+    "   with the following contents:\n",
+    "\n",
+    "   ```yaml\n",
+    "   version: 2\n",
+    "   formats: all\n",
+    "   python:\n",
+    "     version: 3\n",
+    "     install:\n",
+    "       - requirements: doc/requirements.txt\n",
+    "     system_packages: true\n",
+    "   ```\n",
+    "   \n",
+    "   For further options see 
https://docs.readthedocs.io/en/latest/config-file/.\n";,
+    "\n",
+    "1. Create a file named `doc/requirements.txt`\n",
+    "   (or whatever you chose in the previous step)\n",
+    "   containing the required `pip` packages:\n",
     "\n",
-    "        ipykernel\n",
-    "        nbsphinx\n",
+    "       ipykernel\n",
+    "       nbsphinx\n",
     "        \n",
     "    You can also install directly from Github et al., using a specific 
branch/tag/commit, e.g.\n",
     "\n",
-    "        git+https://github.com/spatialaudio/nbsphinx.git@master\n";,
-    "\n",
-    "1. In the \"Advanced Settings\" on readthedocs.org, specify the path to 
your `requirements.txt` file (or however you called it) in the box labeled 
\"Requirements file\". Kinda obvious, isn't it?\n",
-    "\n",
-    "1. Still in the \"Advanced Settings\", make sure the right Python 
interpreter is chosen.  This must be the same version (2.x or 3.x) as you were 
using in your notebooks!"
+    "       git+https://github.com/spatialaudio/nbsphinx.git@master";
    ]
   },
   {
@@ -538,29 +573,47 @@
    "source": [
     "### Using `conda`\n",
     "\n",
-    "1. Create a file named `readthedocs.yml` in the main directory of your 
repository, containing the name of yet another file:\n",
-    "\n",
-    "        conda:\n",
-    "          file: readthedocs-environment.yml\n",
-    "\n",
-    "1. Create the file mentioned above.\n",
-    "You can choose whatever name you want (it may also live in a 
subdirectory, e.g. `doc/environment.yml`), it just has to match whatever is 
specified in `readthedocs.yml`.\n",
-    "The second file describes a [conda 
environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)
 and should contain something like this:\n",
-    "\n",
-    "        channels:\n",
-    "          - conda-forge\n",
-    "        dependencies:\n",
-    "          - python>=3\n",
-    "          - pandoc\n",
-    "          - ipykernel\n",
-    "          - pip:\n",
-    "            - nbsphinx\n",
-    "\n",
-    "    It is up to you if you want to install `nbsphinx` with `conda` or 
with `pip` (but note that the `conda` package might be outdated).\n",
-    "    And you can of course add further `conda` and `pip` packages. You can 
also install packages directly from Github et al., using a specific 
branch/tag/commit, e.g.\n",
+    "1. Create a file named `.readthedocs.yml`\n",
+    "   in the main directory of your repository\n",
+    "   with the following contents:\n",
+    "\n",
+    "   ```yaml\n",
+    "   version: 2\n",
+    "   formats: all\n",
+    "   conda:\n",
+    "     file: doc/environment.yml\n",
+    "   ```\n",
+    "   \n",
+    "   For further options see 
https://docs.readthedocs.io/en/latest/config-file/.\n";,
+    "\n",
+    "1. Create a file named `doc/environment.yml`\n",
+    "   (or whatever you chose in the previous step)\n",
+    "   describing a\n",
+    "   [conda 
environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)\n",
+    "   like this:\n",
+    "\n",
+    "   ```yaml\n",
+    "   channels:\n",
+    "     - conda-forge\n",
+    "   dependencies:\n",
+    "     - python>=3\n",
+    "     - pandoc\n",
+    "     - ipykernel\n",
+    "     - pip\n",
+    "     - pip:\n",
+    "       - nbsphinx\n",
+    "   ```\n",
+    "\n",
+    "   It is up to you if you want to install `nbsphinx` with `conda` or with 
`pip`\n",
+    "   (but note that the `conda` package might be outdated).\n",
+    "   And you can of course add further `conda` and `pip` packages.\n",
+    "   You can also install packages directly from Github et al.,\n",
+    "   using a specific branch/tag/commit, e.g.\n",
     "    \n",
-    "          - pip:\n",
-    "            - git+https://github.com/spatialaudio/nbsphinx.git@master\n";,
+    "   ```yaml\n",
+    "     - pip:\n",
+    "       - git+https://github.com/spatialaudio/nbsphinx.git@master\n";,
+    "   ```\n",
     "\n",
     "<div class=\"alert alert-info\">\n",
     "\n",
@@ -568,23 +621,6 @@
     "\n",
     "The specification of the `conda-forge` channel is recommended because it 
tends to have more recent package versions than the default channel.\n",
     "\n",
-    "</div>\n",
-    "\n",
-    "<div class=\"alert alert-info\">\n",
-    "\n",
-    "**Note:**\n",
-    "\n",
-    "Most of the \"Advanced Settings\" on readthedocs.org will be ignored if 
you have a `readthedocs.yml` file.\n",
-    "In this file you can control all the settings, see 
https://docs.readthedocs.io/en/latest/yaml-config.html.\n";,
-    "\n",
-    "</div>\n",
-    "\n",
-    "<div class=\"alert alert-warning\">\n",
-    "\n",
-    "**Warning:**\n",
-    "\n",
-    "If you have a very long repository name (or branch name), you might run 
into this quite obscure problem: ['placeholder too 
short'](https://github.com/readthedocs/readthedocs.org/issues/1902).\n",
-    "\n",
     "</div>"
    ]
   },
@@ -636,12 +672,20 @@
     "  [example](https://nbsphinx.readthedocs.io/en/scrolls-theme/),\n",
     "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/scrolls-theme^...scrolls-theme)\n",
     "\n",
+    "* `sphinxdoc`:\n",
+    "  [example](https://nbsphinx.readthedocs.io/en/sphinxdoc-theme/),\n",
+    "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/sphinxdoc-theme^...sphinxdoc-theme)\n",
+    "\n",
     "* `traditional`:\n",
     "  [example](https://nbsphinx.readthedocs.io/en/traditional-theme/),\n",
     "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/traditional-theme^...traditional-theme)\n",
     "\n",
     "### 3rd-Party Themes\n",
     "\n",
+    "* 
[alabaster_jupyterhub](https://github.com/jupyterhub/alabaster-jupyterhub):\n",
+    "  
[example](https://nbsphinx.readthedocs.io/en/alabaster-jupyterhub-theme/),\n",
+    "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/alabaster-jupyterhub-theme^...alabaster-jupyterhub-theme)\n",
+    "  \n",
     "* [basicstrap](https://pythonhosted.org/sphinxjp.themes.basicstrap/):\n",
     "  [example](https://nbsphinx.readthedocs.io/en/basicstrap-theme/),\n",
     "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/basicstrap-theme^...basicstrap-theme)\n",
@@ -654,7 +698,11 @@
     "  [example](https://nbsphinx.readthedocs.io/en/bootstrap-theme/),\n",
     "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/bootstrap-theme^...bootstrap-theme)\n",
     "\n",
-    "* [cloud](https://pythonhosted.org/cloud_sptheme/):\n",
+    "* 
[bootstrap-astropy](https://github.com/astropy/astropy-sphinx-theme):\n",
+    "  [example](https://nbsphinx.readthedocs.io/en/astropy-theme/),\n",
+    "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/astropy-theme^...astropy-theme)\n",
+    "\n",
+    "* [cloud/redcloud/greencloud](https://cloud-sptheme.readthedocs.io/):\n",
     "  [example](https://nbsphinx.readthedocs.io/en/cloud-theme/),\n",
     "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/cloud-theme^...cloud-theme)\n",
     "\n",
@@ -662,10 +710,6 @@
     "  [example](https://nbsphinx.readthedocs.io/en/guzzle-theme/),\n",
     "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/guzzle-theme^...guzzle-theme)\n",
     "\n",
-    "* [itcase](https://github.com/ITCase/itcase_sphinx_theme):\n",
-    "  [example](https://nbsphinx.readthedocs.io/en/itcase-theme/),\n",
-    "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/itcase-theme^...itcase-theme)\n",
-    "\n",
     "* [julia](https://github.com/JuliaLang/JuliaDoc):\n",
     "  [example](https://nbsphinx.readthedocs.io/en/julia-theme/),\n",
     "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/julia-theme^...julia-theme)\n",
@@ -698,6 +742,10 @@
     "  [example](https://nbsphinx.readthedocs.io/en/sizzle-theme/),\n",
     "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/sizzle-theme^...sizzle-theme)\n",
     "\n",
+    "* [sphinx_material](https://github.com/bashtage/sphinx-material):\n",
+    "  [example](https://nbsphinx.readthedocs.io/en/material-theme/),\n",
+    "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/material-theme^...material-theme)\n",
+    "\n",
     "* 
[sphinx_py3doc_enhanced_theme](https://github.com/ionelmc/sphinx-py3doc-enhanced-theme):\n",
     "  
[example](https://nbsphinx.readthedocs.io/en/py3doc-enhanced-theme/),\n",
     "  
[usage](https://github.com/spatialaudio/nbsphinx/compare/py3doc-enhanced-theme^...py3doc-enhanced-theme)\n",
@@ -769,7 +817,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.7.5"
+   "version": "3.7.6"
   }
  },
  "nbformat": 4,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/doc/version-history.rst 
new/nbsphinx-0.5.1/doc/version-history.rst
--- old/nbsphinx-0.5.0/doc/version-history.rst  1970-01-01 01:00:00.000000000 
+0100
+++ new/nbsphinx-0.5.1/doc/version-history.rst  2020-01-28 10:45:38.000000000 
+0100
@@ -0,0 +1,4 @@
+Version History
+===============
+
+.. include:: ../NEWS.rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/setup.py new/nbsphinx-0.5.1/setup.py
--- old/nbsphinx-0.5.0/setup.py 2019-11-16 11:23:29.000000000 +0100
+++ new/nbsphinx-0.5.1/setup.py 2020-01-25 13:05:31.000000000 +0100
@@ -12,6 +12,7 @@
     version=__version__,
     package_dir={'': 'src'},
     py_modules=['nbsphinx'],
+    python_requires='>=2.7',
     install_requires=[
         'docutils',
         'jinja2',
@@ -26,8 +27,9 @@
     long_description=open('README.rst').read(),
     license='MIT',
     keywords='Sphinx Jupyter notebook'.split(),
+    url='https://nbsphinx.readthedocs.io/',
     project_urls={
-        'Documentation': 'http://nbsphinx.readthedocs.io/',
+        'Documentation': 'https://nbsphinx.readthedocs.io/',
         'Source Code': 'https://github.com/spatialaudio/nbsphinx/',
         'Bug Tracker': 'https://github.com/spatialaudio/nbsphinx/issues/',
     },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/src/nbsphinx.egg-info/PKG-INFO 
new/nbsphinx-0.5.1/src/nbsphinx.egg-info/PKG-INFO
--- old/nbsphinx-0.5.0/src/nbsphinx.egg-info/PKG-INFO   2019-11-20 
11:46:18.000000000 +0100
+++ new/nbsphinx-0.5.1/src/nbsphinx.egg-info/PKG-INFO   2020-01-28 
11:01:43.000000000 +0100
@@ -1,12 +1,12 @@
 Metadata-Version: 1.2
 Name: nbsphinx
-Version: 0.5.0
+Version: 0.5.1
 Summary: Jupyter Notebook Tools for Sphinx
-Home-page: UNKNOWN
+Home-page: https://nbsphinx.readthedocs.io/
 Author: Matthias Geier
 Author-email: matthias.ge...@gmail.com
 License: MIT
-Project-URL: Documentation, http://nbsphinx.readthedocs.io/
+Project-URL: Documentation, https://nbsphinx.readthedocs.io/
 Project-URL: Source Code, https://github.com/spatialaudio/nbsphinx/
 Project-URL: Bug Tracker, https://github.com/spatialaudio/nbsphinx/issues/
 Description: Jupyter Notebook Tools for Sphinx
@@ -53,3 +53,4 @@
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
 Classifier: Topic :: Documentation :: Sphinx
+Requires-Python: >=2.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/src/nbsphinx.egg-info/SOURCES.txt 
new/nbsphinx-0.5.1/src/nbsphinx.egg-info/SOURCES.txt
--- old/nbsphinx-0.5.0/src/nbsphinx.egg-info/SOURCES.txt        2019-11-20 
11:46:18.000000000 +0100
+++ new/nbsphinx-0.5.1/src/nbsphinx.egg-info/SOURCES.txt        2020-01-28 
11:01:43.000000000 +0100
@@ -10,6 +10,8 @@
 doc/allow-errors.ipynb
 doc/code-cells.ipynb
 doc/conf.py
+doc/configuring-kernels.ipynb
+doc/contributing.rst
 doc/custom-formats.ipynb
 doc/executing-notebooks.ipynb
 doc/hidden-cells.ipynb
@@ -27,6 +29,7 @@
 doc/requirements.txt
 doc/timeout.ipynb
 doc/usage.ipynb
+doc/version-history.rst
 doc/yet-another.ipynb
 doc/images/notebook_icon.png
 doc/images/python_logo.svg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsphinx-0.5.0/src/nbsphinx.py 
new/nbsphinx-0.5.1/src/nbsphinx.py
--- old/nbsphinx-0.5.0/src/nbsphinx.py  2019-11-20 11:36:58.000000000 +0100
+++ new/nbsphinx-0.5.1/src/nbsphinx.py  2020-01-28 10:52:21.000000000 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2015-2019 Matthias Geier
+# Copyright (c) 2015-2020 Matthias Geier
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -23,7 +23,7 @@
 https://nbsphinx.readthedocs.io/
 
 """
-__version__ = '0.5.0'
+__version__ = '0.5.1'
 
 import copy
 import json
@@ -178,7 +178,7 @@
 
     .. raw:: html
 
-        <div></div>
+        <div class="output_javascript"></div>
         <script type="text/javascript">
         var element = document.currentScript.previousSibling.previousSibling;
 {{ output.data['application/javascript'] | indent | indent }}
@@ -479,8 +479,8 @@
 div.nbinput.container div.prompt,
 div.nboutput.container div.prompt {
     min-width: %(nbsphinx_prompt_width)s;
-    padding-top: 0.4em;
-    padding-right: 0.4em;
+    padding-top: 0.3rem;
+    padding-right: 0.3rem;
     text-align: right;
     flex: 0;
 }
@@ -504,7 +504,6 @@
 /* input/output area */
 div.nbinput.container div.input_area,
 div.nboutput.container div.output_area {
-    padding: 0.4em;
     -webkit-flex: 1;
     flex: 1;
     overflow: auto;
@@ -578,6 +577,27 @@
 .ansi-bold { font-weight: bold; }
 .ansi-underline { text-decoration: underline; }
 
+
+div.nbinput.container div.input_area div[class*=highlight] > pre,
+div.nboutput.container div.output_area div[class*=highlight] > pre,
+div.nboutput.container div.output_area div[class*=highlight].math,
+div.nboutput.container div.output_area.rendered_html,
+div.nboutput.container div.output_area > div.output_javascript,
+div.nboutput.container div.output_area:not(.rendered_html) > img{
+    padding: 0.3rem;
+}
+
+/* fix copybtn overflow problem in chromium (needed for 'sphinx_copybutton') */
+div.nbinput.container div.input_area > div[class^='highlight'],
+div.nboutput.container div.output_area > div[class^='highlight']{
+    overflow-y: hidden;
+}
+
+/* hide copybtn icon on prompts (needed for 'sphinx_copybutton') */
+.prompt a.copybtn {
+    display: none;
+}
+
 /* Some additional styling taken form the Jupyter notebook CSS */
 div.rendered_html table {
   border: none;
@@ -726,6 +746,8 @@
                 'replace_attachments': replace_attachments,
                 'get_output_type': _get_output_type,
                 'json_dumps': json.dumps,
+                'basename': os.path.basename,
+                'dirname': os.path.dirname,
             })
 
     def from_notebook_node(self, nb, resources=None, **kw):
@@ -760,6 +782,10 @@
                 allow_errors=allow_errors, timeout=timeout)
             nb, resources = pp.preprocess(nb, resources)
 
+        if 'nbsphinx_save_notebook' in resources:
+            # Save *executed* notebook *before* the Exporter can change it:
+            nbformat.write(nb, resources['nbsphinx_save_notebook'])
+
         # Call into RSTExporter
         rststr, resources = super(Exporter, self).from_notebook_node(
             nb, resources, **kw)
@@ -835,8 +861,7 @@
             return
 
         srcdir = os.path.dirname(env.doc2path(env.docname))
-        auxdir = os.path.join(env.doctreedir, 'nbsphinx')
-        sphinx.util.ensuredir(auxdir)
+        auxdir = env.nbsphinx_auxdir
 
         resources = {}
         # Working directory for ExecutePreprocessor
@@ -845,6 +870,14 @@
         resources['output_files_dir'] = os.path.relpath(auxdir, srcdir)
         resources['unique_key'] = re.sub('[/ ]', '_', env.docname)
 
+        # NB: The source file could have a different suffix
+        #     if nbsphinx_custom_formats is used.
+        notebookfile = env.docname + '.ipynb'
+        env.nbsphinx_notebooks[env.docname] = notebookfile
+        auxfile = os.path.join(auxdir, notebookfile)
+        sphinx.util.ensuredir(os.path.dirname(auxfile))
+        resources['nbsphinx_save_notebook'] = auxfile
+
         exporter = Exporter(
             execute=env.config.nbsphinx_execute,
             kernel_name=env.config.nbsphinx_kernel_name,
@@ -897,8 +930,6 @@
             rst.Parser.parse(self, epilog, document)
 
         if resources.get('nbsphinx_widgets', False):
-            if not hasattr(env, 'nbsphinx_widgets'):
-                env.nbsphinx_widgets = set()
             env.nbsphinx_widgets.add(env.docname)
 
 
@@ -1363,9 +1394,14 @@
     default_priority = 200  # Before CreateSectionLabels (250)
 
     def apply(self):
+        all_ids = set()
         for section in self.document.traverse(docutils.nodes.section):
             title = section.children[0].astext()
             link_id = title.replace(' ', '-')
+            if link_id in all_ids:
+                # Avoid duplicated anchors on the same page
+                continue
+            all_ids.add(link_id)
             section['ids'] = [link_id]
 
 
@@ -1507,8 +1543,6 @@
                 logger.warning('Link outside source directory: %r', file,
                                location=node)
                 continue  # Link is ignored
-            if not hasattr(env, 'nbsphinx_files'):
-                env.nbsphinx_files = {}
             env.nbsphinx_files.setdefault(env.docname, []).append(file)
 
 
@@ -1539,26 +1573,38 @@
     # Set default value for CSS prompt width (optimized for two-digit numbers)
     if config.nbsphinx_prompt_width is None:
         config.nbsphinx_prompt_width = {
-            'agogo': '4ex',
-            'alabaster': '5ex',
-            'better': '5ex',
-            'classic': '4ex',
+            'agogo': '4.5ex',
+            'alabaster': '5.5ex',
+            'alabaster_jupyterhub': '5.5ex',
+            'basicstrap': '5.5ex',
+            'better': '4.5ex',
+            'bizstyle': '5.5ex',
+            'bootstrap': '5.5ex',
+            'bootstrap-astropy': '5.5ex',
+            'classic': '4.5ex',
             'cloud': '5ex',
             'dotted': '5ex',
-            'guzzle_sphinx_theme': '6ex',
-            'haiku': '4ex',
-            'julia': '5ex',
-            'maisie_sphinx_theme': '6ex',
+            'greencloud': '5ex',
+            'guzzle_sphinx_theme': '5.5ex',
+            'haiku': '4.5ex',
+            'julia': '5.5ex',
+            'jupyter': '5.5ex',
+            'maisie_sphinx_theme': '5.5ex',
             'nature': '5ex',
+            'pandas_sphinx_theme': '5.5ex',
             'pangeo': '5ex',
-            'pyramid': '5ex',
+            'pyramid': '4.5ex',
+            'pytorch_sphinx_theme': '14ex',
             'redcloud': '5ex',
-            'sizzle': '5.5ex',
-            'sphinx_py3doc_enhanced_theme': '6ex',
+            'scrolls': '5.5ex',
+            'sizzle': '5ex',
+            'sphinxdoc': '5.5ex',
+            'sphinx_material': '5.5ex',
+            'sphinx_py3doc_enhanced_theme': '6.5ex',
             'sphinx_pyviz_theme': '5.5ex',
             'sphinx_rtd_theme': '5ex',
             'sphinx_typlog_theme': '5.5ex',
-            'traditional': '4ex',
+            'traditional': '5ex',
         }.get(config.html_theme, '7ex')
 
     for suffix in config.nbsphinx_custom_formats:
@@ -1578,6 +1624,14 @@
             **config.nbsphinx_requirejs_options)
 
 
+def builder_inited(app):
+    app.env.nbsphinx_notebooks = {}
+    app.env.nbsphinx_files = {}
+    app.env.nbsphinx_widgets = set()
+    app.env.nbsphinx_auxdir = os.path.join(app.env.doctreedir, 'nbsphinx')
+    sphinx.util.ensuredir(app.env.nbsphinx_auxdir)
+
+
 def html_page_context(app, pagename, templatename, context, doctree):
     """Add CSS string to HTML pages that contain code cells."""
     style = ''
@@ -1585,7 +1639,7 @@
         style += CSS_STRING % app.config
     if doctree and app.config.html_theme in ('sphinx_rtd_theme', 'julia'):
         style += CSS_STRING_READTHEDOCS
-    if doctree and app.config.html_theme in ('cloud', 'redcloud'):
+    if doctree and app.config.html_theme.endswith('cloud'):
         style += CSS_STRING_CLOUD
     if style:
         context['body'] = '\n<style>' + style + '</style>\n' + context['body']
@@ -1594,7 +1648,7 @@
 def html_collect_pages(app):
     """This event handler is abused to copy local files around."""
     files = set()
-    for file_list in getattr(app.env, 'nbsphinx_files', {}).values():
+    for file_list in app.env.nbsphinx_files.values():
         files.update(file_list)
     status_iterator = sphinx.util.status_iterator
     for file in status_iterator(files, 'copying linked files... ',
@@ -1606,25 +1660,33 @@
         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(
+            notebooks, 'copying notebooks ... ',
+            'brown', len(notebooks)):
+        sphinx.util.copyfile(
+            os.path.join(app.env.nbsphinx_auxdir, notebook),
+            os.path.join(app.builder.outdir, notebook))
     return []  # No new HTML pages are created
 
 
 def env_purge_doc(app, env, docname):
     """Remove list of local files for a given document."""
     try:
-        del env.nbsphinx_files[docname]
-    except (AttributeError, KeyError):
+        del env.nbsphinx_notebooks[docname]
+    except KeyError:
         pass
     try:
-        env.nbsphinx_widgets.discard(docname)
-    except AttributeError:
+        del env.nbsphinx_files[docname]
+    except KeyError:
         pass
+    env.nbsphinx_widgets.discard(docname)
 
 
 def env_updated(app, env):
     widgets_path = app.config.nbsphinx_widgets_path
     if widgets_path is None:
-        if getattr(env, 'nbsphinx_widgets', set()):
+        if env.nbsphinx_widgets:
             try:
                 from ipywidgets.embed import DEFAULT_EMBED_REQUIREJS_URL
             except ImportError:
@@ -1801,6 +1863,7 @@
     app.add_node(AdmonitionNode,
                  html=(visit_admonition_html, depart_admonition_html),
                  latex=(visit_admonition_latex, depart_admonition_latex))
+    app.connect('builder-inited', builder_inited)
     app.connect('config-inited', config_inited)
     app.connect('html-page-context', html_page_context)
     app.connect('html-collect-pages', html_collect_pages)
@@ -1839,5 +1902,5 @@
         'version': __version__,
         'parallel_read_safe': True,
         'parallel_write_safe': True,
-        'env_version': 1,
+        'env_version': 2,
     }


Reply via email to