summaryrefslogtreecommitdiffhomepage
path: root/scripts/gen-europa
blob: 48d05f9ff2d5171e43fc69fdf787e789080dc42a (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
#!/bin/sh

gawk -v denom=$1 '
@include "scripts/getcls.awk"

BEGIN {
	FS = "\t"
}

FILENAME == "data/country-info" {
	cc2name[$1] = $3
}

FILENAME == "data/note-info" && length == 0 {
	section++
	next
}

FILENAME == "data/note-info" && section == 0 {
	cc2c[$1] = $2
}

FILENAME == "data/note-info" && section == 1 {
	ab2l[$1] = $2
}

FILENAME == "data/notes" && $1 == denom && $2 == "Europa" {
	i++
	col[i][0] = $3
	col[i][1] = $4
}

END {
	asort(col)
	for (i = 1; i <= 2; i++) {
		switch (i) {
		case 1:
			sig = "Mario Draghi"
			break
		case 2:
			sig = "Christine Lagarde"
			break
		}

		printf "tr .new-design {th colspan=\"12\" {-%s}}\n", sig
		c = 0

		for (j = 1; j <= length(col); j++) {
			split(col[j][1], s, " ")
			if (s[i] == "/")
				continue

			if (c % 4 == 0)
				printf "trX {"

			printf "td colspan=\"X\" .%s {-%s (%s)}", getcls(s[i]),
				cc2name[col[j][0]], cc2c[col[j][0]]

			if (c % 4 == 3 && j < length(col))
				print "}"
			if (c % 4 != 3 || j != length(col))
				c++
		}
		if ((c - 1) % 4 != 3)
			print "}"
	}
	print "__MARKER__"
}
' data/country-info data/note-info data/notes \
| scripts/colspan.sed                         \
| scripts/last-of-design.sed