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.

66 lines
2.0 KiB
Bash

#!/bin/sh
# Creates HTML version of the wiki.
echo "making HTML"
./make_stats.sh
rm -rf html
mkdir html
cp report.html html
cp pimp_my_lrs.html html
cp ./*.css ./html/
DATE=`date +"%D"`
FILECOUNT=`ls *.md | wc -l`
FILELIST="wiki_pages"
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.html\">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 abuse</a>, <a class=\"notdead\" href=\"wiki_stats.html\">stats</a>, <a class=\"notdead\" id=\"fancylink\" href=\"pimp_my_lrs.html?p=main.html&s=style_fancy.css\">consoomer version</a>, wiki last updated on $DATE<hr />"
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>"
printf "# Wiki Files\n\nThis is an autogenerated page listing all pages.\n\n" > $FILELIST.md
firstFile=true
for f in *.md; do
fname=$(echo "$f" | sed "s/\.md//g")
if [ "$firstFile" = true ] ; then
firstFile=false
else
printf " -- " >> $FILELIST.md
fi
printf "**[$fname]($f)** ($(cat $f | wc -l))" >> $FILELIST.md
f2="html/${fname}.html"
echo $HEADER > $f2
cmark-gfm -e table $f | sed "s/\.md\"/.html\"/g" >> $f2
echo $FOOTER >> $f2
done
# 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
echo "$HEADER<a href="main.html">Go to main page.</a>$FOOTER" >> html/index.html
echo "</ul> $FOOTER" >> html/$FILELIST
./make_html_single.sh
cp ./lrs_wiki.html html/lrs_wiki_full.html
echo "done"