aboutsummaryrefslogtreecommitdiff
path: root/scripts/latexify-source.sh
blob: 17664653f860c92ccf12c0e1747b857a42cdcf47 (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
#!/bin/bash

set -eu

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

printf '\n' > "$targetfile"

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

chapter() {
	printf '\\chapter{%s}\n' "$*" >> "$targetfile"
}

chapter Backend source code
include_code go 8 *.go
include_code text 8 go.*

chapter Frontend source code
include_code javascript 4 frontend/*.js
include_code css 8 frontend/*.css

chapter HTML templates
include_code html 2 templates/*.html

chapter Build system and auxiliary scripts
include_code makefile 8 Makefile
include_code bash 8 scripts/*.sh

chapter SQL scripts
include_code postgresql 8 sql/*.sql

chapter Production documentation
include_code markdown 2 docs/*.md
include_code css 8 docs/*.css
include_code text 8 docs/*.csv docs/cca.scfg.example

chapter IA documentation
include_code latex 8 iadocs/*.tex iadocs/*.texinc