summaryrefslogtreecommitdiff
path: root/scripts/latexify-source.sh
blob: 006f828fda804efcd38151b38c8cf6ce7be31e20 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash

set -eu

targetfile="$(realpath -- build/iadocs/source.gen)"

printf '\n' > "$targetfile"

printf '\\section{Backend source code}\n' >> "$targetfile"
for i in *.go
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=8]{go}{%s}\n' "$i" >> "$targetfile"
done
for i in go.*
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=8]{text}{%s}\n' "$i" >> "$targetfile"
done

printf '\\section{Frontend source code}\n' >> "$targetfile"
cd frontend
for i in *.js
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=4]{javascript}{frontend/%s}\n' "$i" >> "$targetfile"
done
for i in *.css
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=8]{css}{frontend/%s}\n' "$i" >> "$targetfile"
done

printf '\\section{HTML templates}\n' >> "$targetfile"
cd ../tmpl
for i in *.html
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=2]{html}{tmpl/%s}\n' "$i" >> "$targetfile"
done

printf '\\section{Build system and auxiliary scripts}\n' >> "$targetfile"
cd ..
for i in Makefile
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=8]{makefile}{%s}\n' "$i" >> "$targetfile"
done
cd scripts
for i in *
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=8]{bash}{scripts/%s}\n' "$i" >> "$targetfile"
done

printf '\\section{SQL scripts}\n' >> "$targetfile"
cd ../sql
for i in *
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=8]{postgresql}{sql/%s}\n' "$i" >> "$targetfile"
done

printf '\\section{Production documentation}\n' >> "$targetfile"
cd ../docs
for i in *.html
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=2]{html}{docs/%s}\n' "$i" >> "$targetfile"
done
for i in *.css
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=8]{css}{docs/%s}\n' "$i" >> "$targetfile"
done
for i in cca.scfg.example
do
	printf '\\subsection{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
	printf '\\inputminted[breaklines, tabsize=8]{text}{docs/%s}\n' "$i" >> "$targetfile"
done