Skip to content

Commit

Permalink
Merge branch 'binder'
Browse files Browse the repository at this point in the history
  • Loading branch information
wtbarnes committed Jul 23, 2018
2 parents b869014 + 0155032 commit af2e7a7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
numpy
scipy
astropy
sunpy
29 changes: 29 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from sunpy_sphinx_theme.conf import *


sys.path.append(os.path.abspath('exts'))
extensions = ['sphinx.ext.githubpages', 'ablog', 'sphinxcontrib.rawfiles', 'cards',
'sphinx.ext.intersphinx', 'nbsphinx', 'sphinx.ext.mathjax']
Expand Down Expand Up @@ -66,3 +67,31 @@
'team': ['localtoc.html'],
'newcomers': ['localtoc.html']
}

# nbsphinx options
nbsphinx_prolog = r"""
{% set docname = env.doc2path(env.docname, base=None) %}
.. only:: html
.. role:: raw-html(raw)
:format: html
.. nbinfo::
This blog post was written in a `Jupyter notebook`__.
Click here for an interactive version:
:raw-html:`<a href="https://mybinder.org/v2/gh/sunpy/sunpy.org/{{ env.config.release }}?filepath={{ docname }}"><img alt="Binder badge" src="https://mybinder.org/badge.svg" style="vertical-align:text-bottom"></a>`
__ https://github.com/sunpy/sunpy.org/blob/{{ env.config.release }}/{{ docname }}
"""
# Get release info
try:
from subprocess import check_output
release = check_output(['git', 'describe', '--tags', '--always'])
release = release.decode().strip()
today = check_output(['git', 'show', '-s', '--format=%ad', '--date=short'])
today = today.decode().strip()
except Exception:
release = '<unknown>'
today = '<unknown date>'

0 comments on commit af2e7a7

Please sign in to comment.