5 header_wiki
() { cat<<EOF
8 <title>Potolandia | Potosi's wiki</title>
9 <link rel="stylesheet" type="text/css" href="../style.css"/>
12 <a href="index.html">main page</a>,
13 <a href="essays.html">essays</a>,
14 <a href="about.html">about</a>,
15 <a href="filelist.html">file list ($(find -- wiki/*.md | wc -l))</a>,
16 <a href="single_page.html">single page html</a>,
17 <a>Last updated on $DATE</a><hr />
21 footer_wiki
() { cat<<EOF
22 This website is licensed under <a class="notdead" href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a> (Public Domain). Contact me at potosi@disroot.org
27 header_media
() { cat<<EOF
30 <title>Potolandia | File Hosting</title>
31 <link rel="stylesheet" type="text/css" href="../style.css"/>
34 <a href="index.html">main page</a>,
35 <a href="filelist.html">file list ($(find -- files/* | wc -l))</a>,
36 <a href="../wiki/index.html">back to wiki</a>,
37 <a>Last updated on $DATE</a><hr />
42 cmark
"$@" |
sed "s/\.md\"/.html\"/g"
46 # Marks dead links on specified dir
47 if ! [ -f "mark_dead_links" ] ; then
48 cc
-O3 mark_dead_links.c
-o mark_dead_links
51 for f
in $
(find . |
grep .html
); do
52 printf "Marking dead links: %s \n" "$f"
53 "$OLDPWD"/mark_dead_links
< "$f" > tmp
60 (echo "$1" |
grep "$2") > /dev
/null
65 (header_media
; echo "<ul>") > html
/media
/filelist.html
66 for f
in $
(cd files
&& find -- * |
sort); do
67 echo "<li><a href=\"../../files/$f\">$f</a></li>" >> html
/media
/filelist.html
68 filetype
="$(file -b files/"$f")"
69 if contains
"$filetype" text
; then
71 elif contains
"$filetype" image
; then
72 echo "<img src=\"../../$f\" alt=\"$f\" /></a>"
73 elif contains
"$filetype" audio
; then
74 echo "<audio controls><source src=\"../../files/$f\""
75 if contains
"$filetype" Ogg
; then
76 echo " type=\"audio/ogg\"></audio>"
77 elif contains
"$filetype" MPEG
; then
78 echo " type=\"audio/mpeg\"></audio>"
80 echo " type=\"audio/wav\"></audio>"
83 echo "<a href=\"../../files/$f\">$f</a><br>"
88 echo "</ul><hr>" >> html
/media
/filelist.html
91 if [ "$(find -- html/*.html)" ] ; then
92 rm $
(find -- html
/*.html
)
95 cp potosi.html html
/index.html
97 header_wiki
> html
/wiki
/single_page.html
98 (header_wiki
&& echo "<ul>") > html
/wiki
/filelist.html
99 for f
in $
(cd wiki
&& find -- *.md |
sort); do
100 printf "Processing %s\n" "$f"
101 fname
="$(echo "$f" | sed "s
/\.md
//g
")"
102 (header_wiki
; md
"wiki/$f" ; echo "<hr>" ; footer_wiki
) > "html/wiki/$fname.html"
103 (echo "<li><a href=\"$fname.html\"> $fname </a></li>") >> html
/wiki
/filelist.html
104 (echo "<span>$fname</span><br />" ; md
"wiki/$f" ; echo "<hr>") >> html
/wiki
/single_page.html
106 mark_dead_links html
/wiki
107 footer_wiki
> html
/wiki
/single_page.html
108 (echo "</ul><hr>" && footer_wiki
) >> html
/wiki
/filelist.html
111 (header_media
; do_media
; echo "<hr>" ; footer_wiki
) > html
/media
/index.html