Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved doc gen script; converts rst files to ipynb and html and sto…
…res both
- Loading branch information
sperka
committed
Jun 18, 2015
1 parent
743e667
commit f58970d
Showing
2 changed files
with
55 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,44 @@ | ||
#!/bin/bash | ||
|
||
# set target output directory | ||
TARGETDIR=_build/html | ||
HTMLDIR=_build/html | ||
IPYNBDIR=_build/ipynb | ||
|
||
# if does not exist, create it | ||
if [ ! -d "$TARGETDIR" ]; then | ||
mkdir -p $TARGETDIR | ||
if [ ! -d "$HTMLDIR" ]; then | ||
mkdir -p $HTMLDIR | ||
fi | ||
if [ ! -d "$IPYNBDIR" ]; then | ||
mkdir -p $IPYNBDIR | ||
fi | ||
|
||
# files to load from | ||
# files' path | ||
FILES=tutorials/*.rst | ||
|
||
# convert the files | ||
for f in $FILES | ||
do | ||
base=$(basename $f) | ||
fname="${base%.*}" | ||
echo "Converting $f..." | ||
sh rst2html.sh $f $TARGETDIR/$fname.html | ||
|
||
echo "Converting $f and moving results..." | ||
sh rst2html.sh $f $IPYNBDIR/$fname.ipynb $HTMLDIR/$fname.html | ||
#echo "sh rst2html.sh $f $IPYNBDIR/$fname.ipynb $HTMLDIR/$fname.html" | ||
done | ||
|
||
# copy assets next to htmls | ||
echo "Copying assets/ to target directory" | ||
cp -r assets/ $TARGETDIR/assets/ | ||
echo "Copying assets/ to html directory" | ||
|
||
# copy assets/ dir to HTMLDIR/ -- but don't delete if they're the same | ||
if [ -d "$HTMLDIR/assets" ]; then | ||
ASSETS_ABSPATH_REAL=`cd "./assets/"; pwd` | ||
ASSETS_ABSPATH_TARGET=`cd "$HTMLDIR/assets"; pwd` | ||
|
||
if [ $ASSETS_ABSPATH_REAL -ne $ASSETS_ABSPATH_TARGET ]; then | ||
if [ -d "$HTMLDIR/assets" ]; then | ||
rm -rf $HTMLDIR/assets | ||
fi | ||
|
||
cp -r assets/ $HTMLDIR/assets/ | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters