Summary Files Commits Branches @commit @diff @stats
path: root / awk-edits / Flags.awk
blob: f40a3c9d9a24ed7e7a6a5e629e3893fe3989e25e (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
#
# == About ==
#
# A collection of ftags that generate an image HTML tag, containing the specified
# flag. This is done, because these tags need to have specific classes, which is
# supported in Markdown, but is less flexible and more tedious.

# == ftags ==
#
# &&gb    Great Britain flag
# &&bg    Bulgarian flag
#
# -- Placement/Flow --
#
# They can reside absolutely anywhere in text.

BEGIN {
	flag[1] = "gb"
	flagTitle[1] = "ENG"
	flag[2] = "bg"
	flagTitle[2] = "BG"

	flaglength = 2 # POSIX compatibility: length(flag) is not valid

	for (i = 1; i <= flaglength; i++) {
		flagExp[i] = "&#38;&#38;" flag[i]
		flagTag[i] = "<img src=\"/img/" flag[i] ".svg\" class=\"flag unzoomable svg\" alt=\"" flagTitle[i] "\" flagTitle=\"" flagTitle[i] "\">"
	}
}

/&#38;&#38;/ {
	for (i = 1; i <= flaglength; i++) {
		gsub(flagExp[i], flagTag[i])
	}
}