Repository: sphinx-gallery/sphinx-gallery

Issue:
Allow removal of "download jupyter notebook" link
It would be nice if it was possible to globally remove the "download jupyter notebook" links (e.g. if one only wants to support examples run from the command-line).

Discussion:
choldgraf: This all looks good to me! Will plan to merge in a bit if nobody protests

Patch:
diff --git a/sphinx_gallery/downloads.py b/sphinx_gallery/downloads.py
index a80a8e4..7869692 100644
--- a/sphinx_gallery/downloads.py
+++ b/sphinx_gallery/downloads.py
@@ -23,11 +23,11 @@ CODE_DOWNLOAD = """
     :class: sphx-glr-footer-example
 
 {2}
-\n  .. container:: sphx-glr-download
+\n  .. container:: sphx-glr-download sphx-glr-download-python
 
      :download:`Download Python source code: {0} <{0}>`\n
 
-\n  .. container:: sphx-glr-download
+\n  .. container:: sphx-glr-download sphx-glr-download-jupyter
 
      :download:`Download Jupyter notebook: {1} <{1}>`\n"""
 
@@ -37,11 +37,11 @@ CODE_ZIP_DOWNLOAD = """
  .. container:: sphx-glr-footer
     :class: sphx-glr-footer-gallery
 
-\n  .. container:: sphx-glr-download
+\n  .. container:: sphx-glr-download sphx-glr-download-python
 
     :download:`Download all examples in Python source code: {0} </{1}>`\n
 
-\n  .. container:: sphx-glr-download
+\n  .. container:: sphx-glr-download sphx-glr-download-jupyter
 
     :download:`Download all examples in Jupyter notebooks: {2} </{3}>`\n"""
 


Test patch:
diff --git a/sphinx_gallery/tests/test_full.py b/sphinx_gallery/tests/test_full.py
index f61decd..a123b71 100644
--- a/sphinx_gallery/tests/test_full.py
+++ b/sphinx_gallery/tests/test_full.py
@@ -267,6 +267,8 @@ def test_embed_links_and_styles(sphinx_app):
     # CSS styles
     assert 'class="sphx-glr-signature"' in lines
     assert 'class="sphx-glr-timing"' in lines
+    for kind in ('python', 'jupyter'):
+        assert 'class="sphx-glr-download sphx-glr-download-%s docutils container"' % kind in lines  # noqa:E501
 
     # highlight language
     fname = op.join(src_dir, 'auto_examples', 'plot_numpy_matplotlib.rst')
diff --git a/sphinx_gallery/tests/test_gen_rst.py b/sphinx_gallery/tests/test_gen_rst.py
index 865c0ce..e097c6f 100644
--- a/sphinx_gallery/tests/test_gen_rst.py
+++ b/sphinx_gallery/tests/test_gen_rst.py
@@ -431,6 +431,13 @@ def test_download_link_note_only_html(gallery_conf, req_pil):
     assert download_link_note in rst
 
 
+def test_download_link_classes(gallery_conf, req_pil):
+    """Test classes for download links."""
+    rst = _generate_rst(gallery_conf, 'test.py', CONTENT)
+    for kind in ('python', 'jupyter'):
+        assert 'sphx-glr-download sphx-glr-download-' + kind in rst
+
+
 @pytest.mark.parametrize('ext', ('.txt', '.rst', '.bad'))
 def test_gen_dir_rst(gallery_conf, fakesphinxapp, ext):
     """Test gen_dir_rst."""