add index.html generator for slide overview
This commit is contained in:
1
Makefile
1
Makefile
@@ -83,6 +83,7 @@ html: copy-assets
|
||||
echo " $$f.html"; \
|
||||
npx @marp-team/marp-cli $(SLIDES_DIR)/$$f.md -o $(BUILD_DIR)/$$f.html; \
|
||||
done
|
||||
@./scripts/generate-index.sh $(BUILD_DIR)
|
||||
@echo "Done! HTML files in $(BUILD_DIR)/"
|
||||
|
||||
# Clean generated files
|
||||
|
||||
93
scripts/generate-index.sh
Executable file
93
scripts/generate-index.sh
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
# Generate index.html for slide overview
|
||||
|
||||
BUILD_DIR="${1:-build}"
|
||||
|
||||
cat > "$BUILD_DIR/index.html" << 'HEADER'
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>223015b - Dateiformate, Schnittstellen, Speichermedien</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
background: #1a1a2e;
|
||||
color: #eee;
|
||||
}
|
||||
h1 { color: #fff; margin-bottom: 0.5rem; }
|
||||
.subtitle { color: #888; margin-bottom: 2rem; }
|
||||
.termin {
|
||||
background: #16213e;
|
||||
border-radius: 8px;
|
||||
padding: 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
transition: transform 0.2s, background 0.2s;
|
||||
}
|
||||
.termin:hover { background: #1f4068; transform: translateX(5px); }
|
||||
.termin h2 { color: #fff; margin: 0 0 0.5rem 0; font-size: 1.2rem; }
|
||||
.termin .date { color: #4ecca3; font-size: 0.9rem; }
|
||||
.termin .topic { color: #aaa; font-size: 0.95rem; margin-left: 1rem; }
|
||||
footer { margin-top: 2rem; color: #666; font-size: 0.85rem; text-align: center; }
|
||||
footer a { color: #4ecca3; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>223015b</h1>
|
||||
<p class="subtitle">Dateiformate, Schnittstellen, Speichermedien & Distributionswege<br>
|
||||
HdM Stuttgart - WS 2025/26 - Michael Czechowski</p>
|
||||
HEADER
|
||||
|
||||
# Generate links for each termin (sorted)
|
||||
for html in $(ls "$BUILD_DIR"/2*.html 2>/dev/null | sort); do
|
||||
filename=$(basename "$html")
|
||||
|
||||
# Extract components from filename
|
||||
# Format: 2025-12-19-termin-1-grundlagen-text-audio.html
|
||||
date=$(echo "$filename" | grep -oE '^[0-9]{4}-[0-9]{2}-[0-9]{2}')
|
||||
termin_num=$(echo "$filename" | grep -oE 'termin-[0-9]+' | grep -oE '[0-9]+')
|
||||
topic_raw=$(echo "$filename" | sed -E 's/^[0-9]{4}-[0-9]{2}-[0-9]{2}-termin-[0-9]+-//' | sed 's/\.html$//')
|
||||
|
||||
# Format topic: replace - with space, capitalize
|
||||
topic=$(echo "$topic_raw" | sed 's/-/ /g' | sed 's/.*/\u&/')
|
||||
|
||||
# Format date
|
||||
if [[ "$date" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
|
||||
formatted_date=$(date -d "$date" "+%d.%m.%Y" 2>/dev/null || echo "$date")
|
||||
else
|
||||
formatted_date="TBA"
|
||||
fi
|
||||
|
||||
# Handle termin number
|
||||
if [[ "$termin_num" == "0" ]]; then
|
||||
termin_label="Einfuhrung"
|
||||
else
|
||||
termin_label="Termin $termin_num"
|
||||
fi
|
||||
|
||||
cat >> "$BUILD_DIR/index.html" << LINK
|
||||
<a href="$filename" class="termin">
|
||||
<h2>$termin_label</h2>
|
||||
<span class="date">$formatted_date</span>
|
||||
<span class="topic">$topic</span>
|
||||
</a>
|
||||
LINK
|
||||
done
|
||||
|
||||
cat >> "$BUILD_DIR/index.html" << 'FOOTER'
|
||||
<footer>
|
||||
<a href="https://git.librete.ch/hdm/223015b">Git Repository</a> -
|
||||
<a href="mailto:mail@librete.ch">Kontakt</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
FOOTER
|
||||
|
||||
echo "Generated $BUILD_DIR/index.html"
|
||||
Reference in New Issue
Block a user