summaryrefslogtreecommitdiff
path: root/build.sh
blob: 90f05e9f72a36b936a0dc8261ec3debd3181ce3a (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
#!/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 {
    border: 1px solid;
	padding: 1ch;
	border-radius: 5px;
	overflow: auto;
	background-color: #eee;
  }
</style>
'

genhtml() (
	cd "$1"

    . ./meta.sh

	exec 1>index.html

	# Header
	echo "<title>$title</title>"
	echo "<!-- generated by build.sh. DO NOT EDIT. -->"
	echo "$header"
	[ "$1" != . ] && echo "<a href=\"..\">$blog_title</a><hr>"

	# Body
	pandoc *.md

	# Footer
	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