aboutsummaryrefslogtreecommitdiff
path: root/genhtml.sh
diff options
context:
space:
mode:
authorxplshn <musicslave66@e.email>2025-01-09 23:00:45 -0300
committerxplshn <musicslave66@e.email>2025-01-09 23:00:45 -0300
commitc2e31da8de71997c9454e4035b2139db8b4a7530 (patch)
tree4f80eb436c882abed2461150dfd9318cd2e82c23 /genhtml.sh
parentcfeea37cc58a16520b74fcbbb538b273a27b2c09 (diff)
downloadalicelinux-c2e31da8de71997c9454e4035b2139db8b4a7530.tar.gz
alicelinux-c2e31da8de71997c9454e4035b2139db8b4a7530.zip
Update genhtml.sh to use pandoc
Signed-off-by: xplshn <musicslave66@e.email>
Diffstat (limited to 'genhtml.sh')
-rw-r--r--genhtml.sh49
1 files changed, 31 insertions, 18 deletions
diff --git a/genhtml.sh b/genhtml.sh
index 2a530e48..a1458696 100644
--- a/genhtml.sh
+++ b/genhtml.sh
@@ -1,32 +1,45 @@
#!/bin/sh
-rm -f *.html docs/*.html
+# Clean existing HTML files
+rm -f ./*.html ./docs/*.html
+# Convert root markdown files
for i in *.md; do
- {
- title=${i%.md}
- case ${i%.md} in index) title=home; esac
- sed "s/@TITLE@/$title/g" header
- smu $i
- cat footer
- } > ${i%.md}.html
+ [ -f "$i" ] || continue
+ title=${i%.md}
+ case ${i%.md} in
+ index) title=home ;;
+ esac
+ {
+ sed "s/@TITLE@/$title/g" header
+ pandoc -f markdown -t html "$i"
+ cat footer
+ } > "${i%.md}.html"
done
+# Generate docs/index.md
echo 'Here lie the documentations for Alice Linux.' > docs/index.md
+
+# Add links to other documentation files
for i in docs/*.md; do
- case $i in docs/index.md) continue; esac
- title=$(head -n1 $i)
- i=${i#*/}
- echo "- [$title](./${i%.md}.html)" >> docs/index.md
+ [ -f "$i" ] || continue
+ case $i in
+ docs/index.md) continue ;;
+ esac
+ title=$(head -n1 "$i")
+ i=${i#*/}
+ echo "- [$title](./${i%.md}.html)" >> docs/index.md
done
+# Convert documentation markdown files
for i in docs/*.md; do
- i=${i#*/}
- {
- sed "s/@TITLE@/docs/g" header
- smu docs/$i
- cat footer
- } > docs/${i%.md}.html
+ [ -f "$i" ] || continue
+ i=${i#*/}
+ {
+ sed "s/@TITLE@/docs/g" header
+ pandoc -f markdown -t html "docs/$i"
+ cat footer
+ } > "docs/${i%.md}.html"
done
exit 0