Summary Files Commits Branches @commit @diff @stats
path: root / generate.sh
blob: 25943054909a769c3b0b0638616753a3a8b54ea0 (plain) (blame)
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
#!/bin/bash

: ${SRC_DIR:=$PWD/src}
: ${GEN_DIR:=./website}
: ${META_FILE:=meta.tsv} # Relative to SRC_DIR

# 0 Fix hardlinks {{{
	while read -r folder
	do
		if [ -f "$folder.du" ] && [ ! "$folder.du" -ef "$folder/index.du" ]
		then
			rm "$folder/index.du" >/dev/null 2>&1
			ln "$folder.du" "$folder/index.du"
		fi
	done << EOF
$(find "$SRC_DIR" -maxdepth 1 -type d)
EOF
	if [ ! "src/favicon.ico" -ef "src/img/favicon.ico" ]
	then
		rm "src/favicon.ico" >/dev/null 2>&1
		ln "src/img/favicon.ico" "src/favicon.ico"
	fi
	echo "[Stage 0] Fixed folder/index.md hardlinks"
# }}}
# 1. Dunbar source to HTML {{{
	mkdir -p "$GEN_DIR"
	cp -a "$SRC_DIR/." "$GEN_DIR"
	rm "$GEN_DIR/$META_FILE" "$GEN_DIR/."*

	META="$SRC_DIR/$META_FILE"
	export META GEN_DIR

	/usr/bin/env dash ./dunbar/dunbar_awk/dunbar.sh html  \
		-o .                                              \
		-e ./ext/meta.awk -e ./ext/attention.awk          \
		-e ./ext/heading-anchors.awk -e ./ext/pagenav.awk \
		-e ./ext/icons.awk -e ./ext/presentation.awk      \
		-wo                                               \
		-he ./ext/header.du.html -fo ./ext/footer.du.html \
		$(find "$GEN_DIR" -type f -name "*.du")
# }}}
# 2. Tiny version, strip away styles and other stuff {{{
	# TODO
# }}}