You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.7 KiB
Bash

3 years ago
#!/bin/sh
# Creates HTML version of the wiki.
echo "making HTML"
6 months ago
./make_stats.sh
3 years ago
rm -rf html
mkdir html
2 years ago
cp report.html html
2 years ago
DATE=`date +"%D"`
10 months ago
FILECOUNT=`ls *.md | wc -l`
2 years ago
FILELIST="filelist.html"
5 months ago
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://git.coom.tech/drummyfish/less_retarded_wiki/archive/master.zip\">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 />"
10 months ago
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>"
2 years ago
echo "$HEADER <ul>" > html/$FILELIST
3 years ago
for f in *.md; do
2 years ago
fname=$(echo "$f" | sed "s/\.md//g")
echo "<li><a href="${fname}.html"> $fname </a></li>" >> html/$FILELIST
3 years ago
2 years ago
f2="html/${fname}.html"
echo $HEADER > $f2
2 years ago
cmark-gfm -e table $f | sed "s/\.md\"/.html\"/g" >> $f2
2 years ago
echo $FOOTER >> $f2
3 years ago
done
10 months ago
# 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
2 years ago
echo "$HEADER<a href="main.html">Go to main page.</a>$FOOTER" >> html/index.html
echo "</ul> $FOOTER" >> html/$FILELIST
2 years ago
cp style.css html/
3 years ago
2 years ago
./make_html_single.sh
cp ./lrs_wiki.html html/lrs_wiki_full.html
3 years ago
echo "done"