summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xbuild20
-rw-r--r--scripts/bilingual_sort.awk12
2 files changed, 30 insertions, 2 deletions
diff --git a/build b/build
index a9d0044..66cf511 100755
--- a/build
+++ b/build
@@ -203,6 +203,7 @@ compile_for_lang() {
" $nod/index.html
gawk -v denom=$denom -v lang=$1 '
+ @include "scripts/bilingual_sort.awk"
@include "scripts/getcls.awk"
BEGIN { FS = "\t" }
@@ -220,6 +221,11 @@ compile_for_lang() {
}
END {
+ if (lang == "en")
+ asort(col)
+ else
+ asort(col, col, "bilingual_sort")
+
for (i = 1; i <= 3; i++) {
if (i == 3 && denom == 5) {
print "</tr>"
@@ -234,6 +240,7 @@ compile_for_lang() {
print "<tr class=new-design><th colspan=12>"sig"</th></tr>"
c = 0
+
for (j = 1; j <= length(col); j++) {
split(col[j][1], s, " ")
if (s[i] == "/")
@@ -248,7 +255,8 @@ compile_for_lang() {
if (c % 4 == 3 && j < length(col))
print "</tr>"
- c++
+ if (c % 4 != 3 || j != length(col))
+ c++
}
if ((c - 1) % 4 != 3)
print "</tr>"
@@ -263,6 +271,7 @@ compile_for_lang() {
[ $denom -eq 500 ] && continue
gawk -v denom=$denom -v lang=$1 '
+ @include "scripts/bilingual_sort.awk"
@include "scripts/getcls.awk"
BEGIN { FS = "\t" }
@@ -280,6 +289,11 @@ compile_for_lang() {
}
END {
+ if (lang == "en")
+ asort(col)
+ else
+ asort(col, col, "bilingual_sort")
+
for (i = 1; i <= 2; i++) {
if (i == 1)
sig = "Mario Draghi"
@@ -288,6 +302,7 @@ compile_for_lang() {
print "<tr class=new-design><th colspan=12>"sig"</th></tr>"
c = 0
+
for (j = 1; j <= length(col); j++) {
split(col[j][1], s, " ")
if (s[i] == "/")
@@ -302,7 +317,8 @@ compile_for_lang() {
if (c % 4 == 3 && j < length(col))
print "</tr>"
- c++
+ if (c % 4 != 3 || j != length(col))
+ c++
}
if ((c - 1) % 4 != 3)
print "</tr>"
diff --git a/scripts/bilingual_sort.awk b/scripts/bilingual_sort.awk
new file mode 100644
index 0000000..6f6f53a
--- /dev/null
+++ b/scripts/bilingual_sort.awk
@@ -0,0 +1,12 @@
+function bilingual_sort(i1, v1, i2, v2, l, r, f)
+{
+ l = cc2name[v1[0]]
+ r = cc2name[v2[0]]
+
+ printf "%s\n%s\n", l, r |& "sort"
+ close("sort", "to")
+ "sort" |& getline f
+ close("sort", "from")
+
+ return f == l ? -1 : +1
+}