summaryrefslogtreecommitdiff
path: root/Makefile
blob: ba705cedcd662382a94e3d3058d523ccfc73c6e8 (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
.ONESHELL:
.PHONY: index.html

# Utils:
#   Discount		https://www.pell.portland.or.us/~orc/Code/discount/
#   GNU Coreutils	https://www.gnu.org/software/coreutils/

# FIXME prevent raw html tags wrapped by <p>
index.html: index.md index.js disclaimer header.html style.css
	sed -E 's@ #(\S+)@ <span class="tag \1">\1</span>@g' $< | \
	sed -E '/^<!-- START OF CONTENT -->/,/^<!-- END OF CONTENT -->/ { s@^## (.*)$$@<details><summary><h2>\1</h2></summary>\n@; s@^$$@\n</details>\n@;}' | \
	markdown | \
	cat <<EOF >$@
	$$(cat disclaimer)
	
	<!DOCTYPE html>
	<html lang="zh">
	<head>
	$$(cat header.html)
	<style>
	$$(cat style.css)
	</style>
	</head>
	<body>
	$$(cat)
	<script defer>
	$$(cat qrcode.js)
	</script>
	<script defer>
	$$(cat index.js)
	</script>
	</body>
	</html>
	EOF