Summary Files Commits Branches @commit @diff @stats
path: root / ext / pagenav.awk
blob: 0cd08fc88f29f1ef35e96647cf4bb49525022bbb (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
FNR == 0 {
	# Stats element
	stats = \
"	<div id=\"pagenav-stats\">" ORS \
"		<strong>Reading: [$expected-reading]</strong> || <strong>Created: [$created]</strong> || <strong>Edited: [$edited]</strong>" ORS \
"		|| <a href=\"https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/src/" STD_FILENAME "\"><strong>GitLab source</strong></a>" ORS \
"	</div>"

	# Breadcrumbs element
	match(FILEDIR, /(blog|slides|teaching|tutorials|misc)/)
	foldersLen = split(substr(FILEDIR, RSTART), folders, "/")

	href = ".."
	breadcrumb = " &raquo; <em>" folders[foldersLen] "</em>"
	for (i = foldersLen-1; i > 0; i--) {
		breadcrumb = " &raquo; " "<a href=\"" href "\">" folders[i] "</a>" breadcrumb
		href = "../" href
	}
	breadcrumb = \
"	<div id=\"pagenav-breadcrumb\">" ORS \
"		" breadcrumb ORS \
"	</div>"

	substitutions["pagenav"] = \
".text <div id=\"pagenav\">" ORS \
	stats ORS \
	breadcrumb ORS \
"</div>"
}