less_retarded_wiki/make_html.sh

33 lines
914 B
Bash
Raw Normal View History

2021-11-03 21:47:50 +01:00
#!/bin/sh
# Creates HTML version of the wiki.
echo "making HTML"
rm -rf html
mkdir html
2022-03-25 17:18:00 +01:00
DATE=`date +"%D"`
FILELIST="filelist.html"
HEADER="<html><head><title>LRS Wiki</title></head><body><h1>less_retarded_wiki</h1><a href=\"main.html\">main page</a>, <a href=\"$FILELIST\">file list</a>, last updated on $DATE<hr />"
FOOTER="<hr/><p>All content available under <a href=\"https://creativecommons.org/publicdomain/zero/1.0/\">CC0 1.0</a> (public domain).</p></body></html>"
echo "$HEADER <ul>" > html/$FILELIST
2021-11-03 21:47:50 +01:00
for f in *.md; do
2022-03-25 17:18:00 +01:00
fname=$(echo "$f" | sed "s/\.md//g")
echo "<li><a href="${fname}.html"> $fname </a></li>" >> html/$FILELIST
2021-11-03 21:47:50 +01:00
2022-03-25 17:18:00 +01:00
f2="html/${fname}.html"
echo $HEADER > $f2
2022-03-27 00:35:50 +01:00
cmark-gfm -e table $f | sed "s/\.md\"/.html\"/g" >> $f2
2022-03-25 17:18:00 +01:00
echo $FOOTER >> $f2
2021-11-03 21:47:50 +01:00
done
2022-03-25 17:18:00 +01:00
echo "$HEADER<a href="main.html">Go to main page.</a>$FOOTER" >> html/index.html
echo "</ul> $FOOTER" >> html/$FILELIST
2021-11-03 21:47:50 +01:00
echo "done"