Files

50 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/bash
BASEDIR=$(pwd)
INPUT_DIR="$BASEDIR/input"
OUTPUT_DIR="$BASEDIR/91_sonnensystem"
TEMPLATES="$BASEDIR/templates"
chown -R appuser:appgroup "$OUTPUT_DIR"
function convert_adoc() {
if [ -f "$1" ]; then
echo "-> Konvertiere $1 zu HTML..."
asciidoctor -b html5 -a stylesheet=$TEMPLATES/retro-dark.css -a linkcss -a toc=left $1 -o $2
else
echo " [INFO] $1 nicht gefunden, überspringe..."
fi
}
echo '--- Baue README ---'
convert_adoc "$INPUT_DIR/README.adoc" "$OUTPUT_DIR/README.html"
echo '--- Baue Lore (Master-Dokument) ---'
LORE_SRC="$INPUT_DIR/index.adoc"
if [ -f "$INPUT_DIR/master.adoc" ]; then LORE_SRC="$INPUT_DIR/master.adoc"; fi
if [ -f "$LORE_SRC" ]; then
echo "-> Generiere Lore-Dokument (HTML & Markdown) aus $LORE_SRC..."
asciidoctor -b html5 -d book -a stylesheet=$TEMPLATES/retro-dark.css -a linkcss -a toc=left "$LORE_SRC" -o "$OUTPUT_DIR/lore.html"
asciidoctor -b docbook -d book "$LORE_SRC" -o "$OUTPUT_DIR/temp_lore.xml"
pandoc -f docbook -t markdown_strict "$OUTPUT_DIR/temp_lore.xml" -o "$OUTPUT_DIR/lore.md"
rm "$OUTPUT_DIR/temp_lore.xml"
else
echo " [WARNUNG] Weder index.adoc noch master.adoc gefunden!"
fi
echo '--- Baue Fließtexte / Geschichten ---'
if [ -f "$INPUT_DIR/darkCenter.adoc" ]; then
echo "-> Konvertiere darkCenter.adoc zu HTML..."
asciidoctor -b html5 -d book -a stylesheet=$TEMPLATES/retro-dark.css -a linkcss -a toc=left "$INPUT_DIR/darkCenter.adoc" -o "$OUTPUT_DIR/darkCenter.html"
fi
rm -rf export
mkdir "$OUTPUT_DIR/css"
cp "$TEMPLATES/retro-dark.css" "$OUTPUT_DIR/css/"
cp "$TEMPLATES/index.html" "$OUTPUT_DIR/"
sed -i 's/\/workspace\/templates/css/g' "$OUTPUT_DIR/darkCenter.html"
sed -i 's/\/workspace\/templates/css/g' "$OUTPUT_DIR/lore.html"
sed -i 's/\/workspace\/templates/css/g' "$OUTPUT_DIR/README.html"
chown -R appuser:appgroup "$OUTPUT_DIR"