Skip to content

Commit

Permalink
start collecting jupyter notebooks in toolbox
Browse files Browse the repository at this point in the history
support jupyter notebook in examples #150
  • Loading branch information
prudhomm committed Nov 7, 2022
1 parent 6e26658 commit 6311df4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
14 changes: 14 additions & 0 deletions examples/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@ nav:
- modules/maxwell/nav.adoc
- modules/multifluid/nav.adoc
- modules/hdg/nav.adoc
ext:
collector:
- run:
command: ./generate-jupyter.sh examples/modules/csm/
scan:
dir: jupyter/
files: '**/*.ipynb'
base: modules/csm/attachments/
- run:
command: ./generate-jupyter.sh examples/modules/heat/
scan:
dir: jupyter/
files: '**/*.ipynb'
base: modules/heat/attachments/
2 changes: 1 addition & 1 deletion examples/modules/csm/pages/sensor/index.adoc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
= Sensor
:experimental:
:page-vtkjs: true
:page-jupyter: true
:uri-data: https://github.com/feelpp/toolbox/blob/master/examples/modules/csm/examples
:uri-data-edit: https://github.com/feelpp/toolbox/edit/master/examples/modules/csm/examples
:imagesprefix:
ifdef::env-github,env-browser,env-vscode,backend-jupyter[:imagesprefix: ../../assets/images/]
:page-jupyter: true
:jupyter-language-name: python
:jupyter-language-version: 3.8
:url-ipywidgets: https://ipywidgets.readthedocs.io/en/stable/
Expand Down
14 changes: 14 additions & 0 deletions generate-jupyter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /bin/sh

dir=${1:-.}
for i in $(find $dir -name "*.adoc" | grep pages ); do
if grep ":page-jupyter:" $i; then
echo "Generating Jupyter Notebook for $i: "
ipynb=$(echo $i | sed 's/.*\/pages\///' )
dir=$(dirname $ipynb)
mkdir -p jupyter/$dir
echo "generating jupyter/$dir/$(basename $ipynb .adoc).ipynb..."
pwd
asciidoctor -r asciidoctor-jupyter -b jupyter $i -o jupyter/$dir/$(basename $ipynb .adoc).ipynb
fi;
done

0 comments on commit 6311df4

Please sign in to comment.