Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Adding rst generator script #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions build_rst.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh
# ------------------------------------------------------------
# Script to generate the html and .rst stubs to show the
# ipynb within Sphinx generated docs
#
# Requires jupyter nbconvert
# ------------------------------------------------------------
set -e

# Create a clean index.rst
echo "
Tutorials
=========

.. toctree::
:maxdepth: 2
" > index.rst

for filename in *.ipynb; do
jupyter nbconvert --to html $filename
name="${filename%.*}"

# Create stub rst
echo "$name
----------------

.. raw:: html
:file: $name.html
" > $name.rst

# Add to index
echo " $name" >> index.rst

done