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