summaryrefslogtreecommitdiffhomepage
path: root/scripts/gen-america
blob: 59eebf0b0d649f15febe0c14d22e1769998c9438 (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
#!/bin/sh

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

function getsup(i,    s)
{
	switch (i) {
	case 1:
		s = "D"
		break
	case 2:
		s = "P"
		break
	case 3:
		s = "S"
		break
	case 4:
		s = "W"
		break
	}

	return "@sup{-" s "}"
}

BEGIN {
	FS = "\t"
}

{
	if (file == "sds")
		printf "trX {"
	else
		printf "trX { td .missing colspan=\"2\" {-%s}", $3
	split($2, a, / /)
	for (i = 1; i <= length(a); i++)
		printf "td .%s colspan=\"1\" {-%s %s}", getcls(a[i]), $1, getsup(i)
	print "}"
}

END {
	print "__MARKER__"
}
' data/world/$1.us \
| scripts/last-of-design.sed