-
Notifications
You must be signed in to change notification settings - Fork 15
/
update_web_docs.sh
executable file
·55 lines (46 loc) · 1.26 KB
/
update_web_docs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Run this script to build and deploy the mkdocs docs in /docs
JUPYTER_SOURCE=""
JUPYTER_BUILD=""
AUTODOC_MODULES=()
AUTODOC_BUILD=""
USAGE_TEMPLATE="docs/usage_template.md"
USAGE_CMDS=("python pipelines/pepatac.py --help")
RENDERED_DIR="$CODEBASE/code.databio.org/PEPATAC"
# Build jupyter source documents into markdown
if [ ! -z "$JUPYTER_SOURCE" ]
then
for NB in `ls "$JUPYTER_SOURCE"/*.ipynb`
do
jupyter nbconvert --to markdown "$NB" --output-dir "$JUPYTER_BUILD"
done
else
echo "No JUPYTER_SOURCE provided."
fi
# Build python autodocs into markdown
if [ ! -z "$AUTODOC_MODULES" ]
then
for MODULE in $AUTODOC_MODULES
do
$CODEBASE/gendocs.py $MODULE > $AUTODOC_BUILD/$MODULE.md
done
else
echo "No AUTODOC_MODULES provided."
fi
# Build an auto-usage page in markdown
if [ ! -z "$USAGE_CMDS" ]
then
cp $USAGE_TEMPLATE usage_template.md
for cmd in "$USAGE_CMDS"; do
echo $cmd
echo -e "\n\`$cmd\`" >> usage_template.md
echo -e '```{console}' >> usage_template.md
$cmd >> usage_template.md 2>&1
echo -e '```' >> usage_template.md
done
mv usage_template.md docs/usage.md
cat docs/usage.md
else
echo "No USAGE_CMDS provided."
fi
# Render completed docs into output folder with `mkdocs`
mkdocs build -f mkdocs.yml -d "$RENDERED_DIR"