Files
computerhistory/build.sh
T

153 lines
4.6 KiB
Bash
Raw Normal View History

2026-07-11 01:10:09 +02:00
#!/bin/bash
# Name des lokalen Docker-Images
IMAGE_NAME="lore-builder"
2026-07-12 21:14:58 +02:00
# Ausgabeordner
2026-07-12 13:39:33 +02:00
OUT_DIR="export"
2026-07-11 01:10:09 +02:00
2026-07-12 21:14:58 +02:00
# Farben für Output
2026-07-12 13:39:33 +02:00
GREEN='\033[0;32m'
BLUE='\033[0;34m'
2026-07-12 21:14:58 +02:00
NC='\033[0m' # No Color
2026-07-12 13:39:33 +02:00
echo -e "${BLUE}=== Starte Build-Prozess (Maschinen-Instanzen) ===${NC}"
# 1. Output-Verzeichnis erstellen
mkdir -p "$OUT_DIR"
echo -e "Output-Ordner '${GREEN}$OUT_DIR${NC}' steht bereit."
2026-07-12 21:14:58 +02:00
# 2. Prüfen, ob das Docker-Image existiert, ansonsten bauen
2026-07-11 01:10:09 +02:00
if [[ "$(docker images -q $IMAGE_NAME 2> /dev/null)" == "" ]]; then
2026-07-12 13:39:33 +02:00
echo -e "${BLUE}Baue flüchtiges Docker-Image '$IMAGE_NAME' (Alpine, Asciidoctor, Pandoc)...${NC}"
2026-07-11 01:10:09 +02:00
docker build -t $IMAGE_NAME - <<EOF
FROM alpine:latest
RUN apk add --no-cache asciidoctor pandoc bash
WORKDIR /workspace
EOF
fi
2026-07-12 21:14:58 +02:00
# 3. CSS Datei für Retro Space Dark Theme in den Export-Ordner generieren
cat << 'EOF' > "$OUT_DIR/retro-dark.css"
:root {
--bg-color: #0d1117;
--text-color: #c9d1d9;
--link-color: #58a6ff;
--accent-color: #ff7b72;
--border-color: #30363d;
--code-bg: #161b22;
--font-main: 'Courier New', Courier, monospace;
}
body {
background-color: var(--bg-color);
color: var(--text-color);
font-family: var(--font-main);
line-height: 1.6;
max-width: 900px;
margin: 0 auto;
padding: 2rem;
}
h1, h2, h3, h4, h5, h6 {
color: var(--accent-color);
border-bottom: 1px solid var(--border-color);
padding-bottom: 0.3em;
font-weight: normal;
text-transform: uppercase;
letter-spacing: 1px;
}
h1 { font-size: 2.5em; border-bottom: 2px solid var(--accent-color); }
h2 { font-size: 1.5em; }
a { color: var(--link-color); text-decoration: none; }
a:hover { text-decoration: underline; color: #79c0ff; }
code, kbd, pre {
font-family: var(--font-main);
background-color: var(--code-bg);
color: #a5d6ff;
border-radius: 3px;
}
code { padding: 0.2em 0.4em; }
pre { padding: 16px; overflow: auto; border: 1px solid var(--border-color); }
blockquote {
border-left: 4px solid var(--accent-color);
color: #8b949e;
padding: 0 1em;
margin-left: 0;
font-style: italic;
}
table {
border-collapse: collapse;
width: 100%;
margin-bottom: 1rem;
}
th, td {
border: 1px solid var(--border-color);
padding: 8px 12px;
}
th { background-color: var(--code-bg); color: var(--accent-color); }
hr {
height: 1px;
background-color: var(--border-color);
border: none;
margin: 2rem 0;
}
EOF
2026-07-12 13:39:33 +02:00
echo -e "${BLUE}Starte Build-Container und generiere Dokumente...${NC}"
2026-07-11 01:10:09 +02:00
2026-07-12 21:14:58 +02:00
# 4. Container starten und Build-Schritte im Container ausführen
2026-07-11 01:10:09 +02:00
docker run --rm -v "$(pwd):/workspace" $IMAGE_NAME bash -c "
2026-07-12 21:14:58 +02:00
# Helfer-Funktion für Einzeldateien (README)
2026-07-12 13:39:33 +02:00
function convert_adoc() {
if [ -f \"\$1\" ]; then
echo \"-> Konvertiere \$1 zu HTML...\"
2026-07-12 21:14:58 +02:00
asciidoctor -b html5 -a stylesheet=retro-dark.css -a linkcss -a toc=left \"\$1\" -o \"$OUT_DIR/\$2\"
2026-07-12 13:39:33 +02:00
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
2026-07-12 21:14:58 +02:00
echo \"-> Generiere Lore-Dokument (HTML & Markdown) aus \$LORE_SRC...\"
2026-07-12 13:39:33 +02:00
2026-07-12 21:14:58 +02:00
# 1. HTML Output (MIT '-d book' als Fix für den Error und Retro-CSS)
asciidoctor -b html5 -d book -a stylesheet=retro-dark.css -a linkcss -a toc=left \"\$LORE_SRC\" -o \"$OUT_DIR/lore.html\"
2026-07-12 13:39:33 +02:00
2026-07-12 21:14:58 +02:00
# 2. Markdown Output (Ebenfalls mit '-d book')
asciidoctor -b docbook -d book \"\$LORE_SRC\" -o \"$OUT_DIR/temp_lore.xml\"
2026-07-12 13:39:33 +02:00
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 ---'
2026-07-12 21:14:58 +02:00
# darkCenter braucht sicherheitshalber auch '-d book', falls du dort Level-0-Includes nutzt
if [ -f darkCenter.adoc ]; then
echo \"-> Konvertiere darkCenter.adoc zu HTML...\"
asciidoctor -b html5 -d book -a stylesheet=retro-dark.css -a linkcss -a toc=left darkCenter.adoc -o \"$OUT_DIR/darkCenter.html\"
fi
2026-07-11 01:10:09 +02:00
2026-07-12 21:14:58 +02:00
# Konvertiert masterOfTheWorld (Pandoc bindet das CSS für Markdown ebenfalls ein)
2026-07-12 13:39:33 +02:00
if [ -f masterOfTheWorld-sf.md ]; then
echo \"-> Konvertiere masterOfTheWorld-sf.md zu HTML...\"
2026-07-12 21:14:58 +02:00
pandoc masterOfTheWorld-sf.md -f markdown -t html -s -c retro-dark.css -o \"$OUT_DIR/masterOfTheWorld-sf.html\"
2026-07-12 13:39:33 +02:00
fi
2026-07-11 01:10:09 +02:00
"
2026-07-12 13:39:33 +02:00
echo -e "${GREEN}=== Build erfolgreich! ===${NC}"
2026-07-12 21:14:58 +02:00
echo "Alle Dokumente wurden sauber erzeugt und im Ordner './$OUT_DIR' abgelegt."