2021-11-03 21:47:50 +01:00
#!/bin/sh
# Creates HTML version of the wiki.
echo "making HTML"
2023-12-14 23:38:44 +01:00
./make_stats.sh
2021-11-03 21:47:50 +01:00
rm -rf html
mkdir html
2022-09-03 16:42:40 +02:00
cp report.html html
2022-03-25 17:18:00 +01:00
DATE = ` date +"%D" `
2023-08-14 20:16:37 +02:00
FILECOUNT = ` ls *.md | wc -l`
2022-03-25 17:18:00 +01:00
FILELIST = "filelist.html"
2023-12-14 23:38:44 +01:00
HEADER = " <html><head><link rel=\"stylesheet\" href=\"style.css\"><title>LRS Wiki</title></head><body><h1>less_retarded_wiki</h1><a href=\"main.html\">main page</a>, <a class=\"notdead\" href=\" $FILELIST \">file list ( $FILECOUNT )</a>, <a class=\"notdead\" href=\"https://repo.or.cz/less_retarded_wiki.git/snapshot/HEAD.tar.gz\">source</a>, <a class=\"notdead\" href= " report.html" >report</a>, <a class=\"notdead\" href=\"wiki_stats.html\">stats</a>, wiki last updated on $DATE <hr /> "
2023-08-14 20:16:37 +02:00
FOOTER = "<hr/><p>All content available under <a class=\"notdead\" href=\"https://creativecommons.org/publicdomain/zero/1.0/\">CC0 1.0</a> (public domain). Send comments and corrections to drummyfish at disroot dot org. </p></body></html>"
2022-03-25 17:18:00 +01:00
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
2023-08-14 20:16:37 +02:00
# this uses a C program to mark dead links, you can optionally remove this
gcc -O3 mark_dead_links.c -o mark_dead_links
cd html
cp ../mark_dead_links .
for f in *.html; do
cat $f | ./mark_dead_links > tmp
mv tmp $f
done
rm mark_dead_links
cd ..
# mark dead links end
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
2022-04-24 21:48:52 +02:00
cp style.css html/
2021-11-03 21:47:50 +01:00
2022-06-29 21:10:15 +02:00
./make_html_single.sh
cp ./lrs_wiki.html html/lrs_wiki_full.html
2021-11-03 21:47:50 +01:00
echo "done"