diff --git a/docs/source/conf.py b/docs/source/conf.py index 2d12d2d83092f961e8ded13adc53f89a069b3996..e7504aad11b7b322ab4da2ed4ff8f004ca724334 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -31,12 +31,22 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ + 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinx.ext.ifconfig', + 'sphinx.ext.viewcode', ] +import sys +import os +from subprocess import Popen + +sys.path.append(os.path.abspath("../pycalibration/")) +p = Popen(["./makeAllDocs.sh"]) +p.communicate() + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -259,6 +269,7 @@ latex_elements = { # Latex figure (float) alignment # # 'figure_align': 'htbp', + 'extraclassoptions': 'openany', } # Grouping the document tree into LaTeX files. List of tuples diff --git a/docs/source/index.rst b/docs/source/index.rst index a55b1f41d11a73757b1b68786f0a410d99e28860..561aa4a85f1308d921af058aa6bba98131d6ccf8 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -18,6 +18,7 @@ Contents: available_notebooks advanced tutorial + _notebooks/index Indices and tables diff --git a/docs/source/makeAllDocs.sh b/docs/source/makeAllDocs.sh new file mode 100755 index 0000000000000000000000000000000000000000..f1c2d96b063a72af2b033bb0c3d7a60120b97964 --- /dev/null +++ b/docs/source/makeAllDocs.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# first convert notebooks to rst files +# the list of notebooks to convert: + +notebooks=(calversion) + +cd _notebooks + +echo "Tutorial Example"> index.rst +echo "================">> index.rst +echo "" >> index.rst +echo "Tutorial Notebook:" >> index.rst +echo "" >> index.rst +echo ".. toctree::" >> index.rst +echo " :maxdepth: 5" >> index.rst +echo " :titlesonly:" >> index.rst +echo "" >> index.rst + +for nb in ${notebooks[*]} +do + jupyter nbconvert --to rst ../../../notebooks/Tutorial/${nb}.ipynb --output-dir=./ + ##fix code blocks + sed -i.bak 's/code::/code-block::/g' ${nb}.rst + sed -i.bak 's/ipython3/python/g' ${nb}.rst + sed -i.bak 's/raw:: latex/math::/g' ${nb}.rst + sed -i.bak 's/``/`/g' ${nb}.rst + mv ${nb}.rst ${nb}.rst.end + echo ".. _${nb}:" > ${nb}.rst + cat ${nb}.rst.end >> ${nb}.rst + rm ${nb}.rst.end + echo " ${nb}" >> index.rst +done +rm *.bak + +#cd .. rm api/* sphinx-apidoc -o ./api/ -E ../../iCalibrationDB/ +