blob: 67a5686c9f6aa14e47059166e0c385cf8b1f11de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/bin/sh
header='<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
max-width: 45rem;
margin: auto;
padding: 0.5em;
text-align: justify;
}
h1 { text-align: center }
pre {
padding: 1ch;
background-color: #f5f5f5;
overflow: auto;
}
</style>
'
genhtml() (
cd "$1"
. ./meta.sh
exec 1>index.html
# Header
echo "<!DOCTYPE html>"
echo "<!-- generated by build.sh. DO NOT EDIT. -->"
echo "<html lang=\"${lang:-en}\">"
echo "<title>$title</title>"
[ "$description" ] && echo "<meta name=\"description\" content=\"$description\">"
echo "$header"
[ "$1" != . ] && echo "<a href=\"..\">$blog_title</a><hr>"
# Body
pandoc *.md
# Footer
[ "$1" != . ] && echo "<hr>From: $author, $date"
)
for d in *; do
[ -d "$d" ] && genhtml "$d"
done
genhtml .
# Fix for mastodon.
sed '/mstdn/s/href=/rel="me" href=/' index.html >xx && mv xx index.html
# Put a license in index footer.
echo '<hr><small>Unless otherwise noted, posts are licensed under
<a href="http://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.</small>' >>index.html
|