Files
computerhistory/90_builder/bookFold.sh
T

50 lines
1.8 KiB
Bash
Raw Normal View History

2026-07-20 19:44:35 +02:00
#!/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..."
2026-07-20 20:37:09 +02:00
asciidoctor -b html5 -a stylesheet=$TEMPLATES/retro-dark.css -a linkcss -a toc=left $1 -o $2
2026-07-20 19:44:35 +02:00
else
echo " [INFO] $1 nicht gefunden, überspringe..."
fi
}
echo '--- Baue README ---'
2026-07-20 20:37:09 +02:00
convert_adoc "$INPUT_DIR/README.adoc" "$OUTPUT_DIR/README.html"
2026-07-20 19:44:35 +02:00
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
2026-07-20 20:37:09 +02:00
rm -rf export
2026-07-20 19:44:35 +02:00
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"
2026-07-20 20:37:09 +02:00
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"