summaryrefslogtreecommitdiff
path: root/scripts/latexify-source.sh
blob: 37ec3a2e4c6a46f7e75e7fe5bff7e9d1fdf0efbb (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
#!/bin/bash

set -eu

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

printf '\n' > "$targetfile"

printfile() {
	lang="$1"
	tabsize="$2"
	base="$3"
	shift 3
	for i in "$@"
	do
		printf '\\section{%s}\n' "$(sed 's/_/\\_/g' <<< "$i")" >> "$targetfile"
		printf '\\inputminted[breaklines, tabsize=%s]{%s}{%s/%s}\n' "$tabsize" "$lang" "$base" "$i" >> "$targetfile"
	done
}

printf '\\chapter{Backend source code}\n' >> "$targetfile"
printfile go 8 ./ *.go
printfile text 8 ./ go.*

printf '\\chapter{Frontend source code}\n' >> "$targetfile"
cd frontend
printfile javascript 4 ./frontend *.js
printfile css 8 ./frontend *.css

printf '\\chapter{HTML templates}\n' >> "$targetfile"
cd ../templates
printfile html 2 ./templates *.html

printf '\\chapter{Build system and auxiliary scripts}\n' >> "$targetfile"
cd ..
printfile makefile 8 ./ Makefile
cd scripts
printfile bash 8 ./scripts *.sh

printf '\\chapter{SQL scripts}\n' >> "$targetfile"
cd ../sql
printfile postgresql 8 ./sql *.sql

printf '\\chapter{Production documentation}\n' >> "$targetfile"
cd ../docs
printfile html 2 ./docs *.html
printfile css 8 ./docs *.css
printfile text 8 ./docs *.csv cca.scfg.example

printf '\\chapter{IA documentation}\n' >> "$targetfile"
cd ../iadocs
printfile latex 8 ./iadocs *.tex *.inc