aboutsummaryrefslogtreecommitdiff
path: root/genhtml.sh
diff options
context:
space:
mode:
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