close but not there yet
This commit is contained in:
Executable
+47
@@ -0,0 +1,47 @@
|
|||||||
|
#!/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 "$INPUT_DIR/$1" -o "$OUTPUT_DIR/$2"
|
||||||
|
else
|
||||||
|
echo " [INFO] $1 nicht gefunden, überspringe..."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo '--- Baue README ---'
|
||||||
|
convert_adoc README.adoc 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"
|
||||||
|
chown -R appuser:appgroup "$OUTPUT_DIR"
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
FROM debian:stable-slim
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get upgrade && apt-get -y install asciidoctor pandoc bash
|
||||||
|
|
||||||
|
RUN groupadd --gid 1000 appgroup && \
|
||||||
|
useradd --uid 1000 --gid appgroup --shell /bin/bash --create-home appuser
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
|
||||||
|
ADD ./90_builder/templates templates
|
||||||
|
ADD ./90_builder/bookFold.sh ./
|
||||||
|
|
||||||
|
RUN chown -R appuser:appgroup /workspace
|
||||||
|
|
||||||
|
|
||||||
|
CMD ["/usr/bin/bash" "./bookFold.sh"]
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Name des lokalen Docker-Images
|
# Name des lokalen Docker-Images
|
||||||
IMAGE_NAME="lore-builder"
|
IMAGE_NAME="ian-lore-builder"
|
||||||
# Input Ordner
|
# Input Ordner
|
||||||
INP_DIR=$(pwd)
|
INP_DIR=$(pwd)
|
||||||
# Build Ordner
|
# Build Ordner
|
||||||
BID_DIR="90_builder"
|
# BID_DIR="90_builder"
|
||||||
# Build templares
|
# Build templares
|
||||||
TEMPLATES="$BID_DIR/templates"
|
# TEMPLATES="$BID_DIR/templates"
|
||||||
# Ausgabeordner
|
# Ausgabeordner
|
||||||
OUT_DIR="91_sonnensystem"
|
OUT_DIR="$INP_DIR/91_sonnensystem"
|
||||||
|
|
||||||
# Farben für Output
|
# Farben für Output
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
@@ -26,11 +26,7 @@ echo -e "Output-Ordner '${GREEN}$OUT_DIR${NC}' bereinigt und bereit."
|
|||||||
# 2. Prüfen, ob das Docker-Image existiert, ansonsten on-the-fly bauen
|
# 2. Prüfen, ob das Docker-Image existiert, ansonsten on-the-fly bauen
|
||||||
if [[ "$(docker images -q $IMAGE_NAME 2> /dev/null)" == "" ]]; then
|
if [[ "$(docker images -q $IMAGE_NAME 2> /dev/null)" == "" ]]; then
|
||||||
echo -e "${BLUE}Baue flüchtiges Docker-Image '$IMAGE_NAME' (Alpine, Asciidoctor, Pandoc)...${NC}"
|
echo -e "${BLUE}Baue flüchtiges Docker-Image '$IMAGE_NAME' (Alpine, Asciidoctor, Pandoc)...${NC}"
|
||||||
docker build -t $IMAGE_NAME - <<EOF
|
docker build -t $IMAGE_NAME -f ./90_builder/container/deb_Dockerfile .
|
||||||
FROM alpine:latest
|
|
||||||
RUN apk add --no-cache asciidoctor pandoc bash
|
|
||||||
WORKDIR /workspace
|
|
||||||
EOF
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 3. CSS Datei für Retro Space Dark Theme in den Export-Ordner generieren
|
# 3. CSS Datei für Retro Space Dark Theme in den Export-Ordner generieren
|
||||||
@@ -39,40 +35,8 @@ fi
|
|||||||
echo -e "${BLUE}Starte Build-Container und generiere Dokumente...${NC}"
|
echo -e "${BLUE}Starte Build-Container und generiere Dokumente...${NC}"
|
||||||
|
|
||||||
# 4. Container starten und Build-Schritte im Container ausführen
|
# 4. Container starten und Build-Schritte im Container ausführen
|
||||||
docker run --rm -v "$INP_DIR:/workspace" $IMAGE_NAME bash -c "
|
# docker run --rm -v "$INP_DIR:/workspace" $IMAGE_NAME /workspace/bookFold.sh
|
||||||
function convert_adoc() {
|
docker run --rm -v "$(pwd):/workspace/input" -v "$(pwd)/91_sonnensystem:/workspace/91_sonnensystem" $IMAGE_NAME
|
||||||
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 \"$OUT_DIR/\$2\"
|
|
||||||
else
|
|
||||||
echo \" [INFO] \$1 nicht gefunden, überspringe...\"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '--- Baue README ---'
|
|
||||||
convert_adoc README.adoc README.html
|
|
||||||
|
|
||||||
echo '--- Baue Lore (Master-Dokument) ---'
|
|
||||||
LORE_SRC=\"index.adoc\"
|
|
||||||
if [ -f master.adoc ]; then LORE_SRC=\"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 \"$OUT_DIR/lore.html\"
|
|
||||||
asciidoctor -b docbook -d book \"\$LORE_SRC\" -o \"$OUT_DIR/temp_lore.xml\"
|
|
||||||
pandoc -f docbook -t markdown_strict \"$OUT_DIR/temp_lore.xml\" -o \"$OUT_DIR/lore.md\"
|
|
||||||
rm \"$OUT_DIR/temp_lore.xml\"
|
|
||||||
else
|
|
||||||
echo \" [WARNUNG] Weder index.adoc noch master.adoc gefunden!\"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo '--- Baue Fließtexte / Geschichten ---'
|
|
||||||
if [ -f 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 darkCenter.adoc -o \"$OUT_DIR/darkCenter.html\"
|
|
||||||
fi
|
|
||||||
|
|
||||||
"
|
|
||||||
|
|
||||||
# 5. index.html vollautomatisch und direkt generieren
|
# 5. index.html vollautomatisch und direkt generieren
|
||||||
# moved to $BID_OUT/templates/index.html
|
# moved to $BID_OUT/templates/index.html
|
||||||
|
|||||||
Reference in New Issue
Block a user