doc: Improve readability of script

This commit is contained in:
Glenn Y. Rolland 2022-11-02 20:53:20 +01:00
parent b601b7b865
commit 6b315b2f44

View file

@ -69,6 +69,7 @@ echo "basedir = $BASEDIR"
echo "docker_image = $DOCKER_IMAGE"
echo "action = $ACTION"
## Detect Marp SCSS
if [ -f "$BASEDIR/.marp/theme.scss" ]; then
DOCKER_OPT_MARP_THEME="-v $BASEDIR/.marp:/app/.marp"
echo "Theme: detected Marp files. Adding option to command line ($DOCKER_OPT_MARP_THEME)"
@ -76,11 +77,13 @@ else
echo "Theme: no theme detected. Using default files"
fi
## Detect Mkdocs configuration - old format (full)
if [ -f "$BASEDIR/mkdocs.yml" ]; then
>&2 echo "Mkdocs: detected mkdocs.yml file. Please rename to mkdocs-patch.yml"
exit 1
fi
## Detect Mkdocs configuration - new format (patch)
if [ -f "$BASEDIR/mkdocs-patch.yml" ]; then
DOCKER_OPT_MKDOCS_CONFIG="-v $BASEDIR/mkdocs-patch.yml:/app/mkdocs-patch.yml"
echo "Mkdocs: detected mkdocs-patch.yml file. Adding option to command line ($DOCKER_OPT_MKDOCS_CONFIG)"
@ -88,10 +91,12 @@ else
echo "Mkdocs: no mkdocs-patch.yml detected. Using default files"
fi
## Detect slides
if [ -d "$BASEDIR/slides" ]; then
DOCKER_OPT_MARP_PORT="-p 5200:5200"
fi
## Detect docs
if [ -d "$BASEDIR/docs" ]; then
DOCKER_OPT_MKDOCS_PORT="-p 5100:5100"
fi
@ -112,6 +117,7 @@ docker run -i $DOCKER_OPT_TTY \
$DOCKER_OPT_MKDOCS_PORT \
$DOCKER_OPT_MARP_PORT \
"$DOCKER_IMAGE" "$ACTION"
if [ "$VERBOSITY" -gt 0 ]; then
set +x
fi