Summary Files Commits Branches @commit @diff @stats
path: root / generate-hooks / create-presentation.awk
blob: 04fb6d0b5105032ce9d26f1e896890a0cc021c13 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
BEGIN {
	names[ 1] = "slide"
	ended[ 1] = 1
	names[ 2] = "centered"
	ended[ 2] = 1
	names[ 3] = "flexer"
	ended[ 3] = 0
	names[ 4] = "fow"
	ended[ 4] = 1
	names[ 5] = "fol"
	ended[ 5] = 1
	names[ 6] = "font18"
	ended[ 6] = 1
	names[ 7] = "font20"
	ended[ 7] = 1
	names[ 8] = "font27"
	ended[ 8] = 1
	names[ 9] = "font30"
	ended[ 9] = 1
	names[10] = "font35"
	ended[10] = 1
	names[11] = "fright"
	ended[11] = 1

	pres = ORS \
"<nav id=\"presentCont\">" ORS \
"	<img id=\"prevSlideBtn\" class=\"unzoomable btn setting-btn icon nodisplay\" src=\"/img/arrow-left-tabler.svg\" alt=\"Previous\">" ORS \
"	<img id=\"nextSlideBtn\" class=\"unzoomable btn setting-btn icon nodisplay\" src=\"/img/arrow-right-tabler.svg\" alt=\"Next\">" ORS \
"	<img id=\"presentBtn\" class=\"unzoomable btn setting-btn icon\" src=\"/img/presentation-tabler.svg\" alt=\"Present\">" ORS \
"	<img id=\"printBtn\" class=\"unzoomable btn setting-btn icon\" src=\"/img/printer-tabler.svg\" alt=\"Print\">" ORS \
"		</nav>" ORS \
"		<script type=\"text/javascript\" src=\"/scripts/presentation.js\" integrity=\"sha512-79MwfB0EQJMdVjVnd3PA0Cn9fo4JaMUmNuyZNEGSbaMEGcqdE8sWWAbMLheaoptDyb/KuYgNw0pKwvR5Dw+lJw==\" crossorigin=\"anonymous\"></script>"

	for (i = 1; i <= length(names); i++) {
		pat[i] = "<p>&#38;&#38;" names[i] "</p>"
		rep[i] = "<div class=\"" names[i] "\">"

		if (ended[i] == 1) {
			cpat[i] = "<p>&#38;&#38;&#47;" names[i] "</p>"
			crep[i] = "</div>"
		}
		else {
			rep[i] = rep[i] "</div>"
		}
	}
}

function substitute(ind) {
	gsub(pat[ind], rep[ind])
	if (ended[ind] == 1)
		gsub(cpat[ind], crep[ind])
}

{
	gsub("<p>&#38;&#38;presentation</p>", pres)
	gsub("<p>&#38;&#38;&#47;font</p>", "</div>")

	for (i = 1; i <= length(names); i++) {
		if (index($0, names[i]) != 0)
			substitute(i)
	}

	print
}