From 9cad508b5c98ca1029460807249cafb712f28f1e Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 29 Oct 2023 22:39:48 +0100 Subject: Migrate the site to GSP and a Makefile --- scripts/gen-dcoins | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 scripts/gen-dcoins (limited to 'scripts/gen-dcoins') diff --git a/scripts/gen-dcoins b/scripts/gen-dcoins new file mode 100755 index 0000000..1c2ca48 --- /dev/null +++ b/scripts/gen-dcoins @@ -0,0 +1,92 @@ +#!/bin/sh + +readonly tmp=`mktemp` +trap "rm -f $tmp" HUP INT KILL TERM EXIT + +grep -Eo '^[A-Z]{2}' data/coins \ +| sort \ +| uniq \ +| join -t ' ' - data/country-info \ +| cut -f1,3 \ +| sort -k2 >$tmp + + +for cc in `cut -f1 $tmp` +do + gawk -v CC="$cc" -v denom=$1 ' + @include "scripts/getcls.awk" + + FILENAME ~ /\/tmp\/.*/ && $1 == CC { + gsub(/^.../, "") + print "section .cl-section .slant-down {" + print "div {" + print "table .coin-table cellspacing=\"0\" {" + printf "thead {tr {th {-%s}}}\n", $0 + print "tbody {" + } + + $1 == CC && /.. start/ { + sub(/.. start/, "") + printf "tr .new-design {th {-%s}}\n", $0 + next + } + + $1 == CC { + y = $10 + if ($11 != "") + y_ = $11 + printf "trX {" + + switch (denom) { + case 0.01: + i = 2 + break + case 0.02: + i = 3 + break + case 0.05: + i = 4 + break + case 0.10: + i = 5 + break + case 0.20: + i = 6 + break + case 0.50: + i = 7 + break + case 1.00: + i = 8 + break + case 2.00: + i = 9 + break + } + + # Greece 2002 needs special handling + if (CC == "GR" && $10 == 2002 && $11 == "MM") { + if (i <= 5) + y_ = "F" + else if (i <= 7) + y_ = "E" + else + y_ = "S" + } + + if ($i != "/") { + if ($11 != "") + printf "td .%s {-%s @sup{-%s}}", getcls($i), y, y_ + else + printf "td .%s {-%s}", getcls($i), y + } + print "}" + } + + END { + print "__MARKER__" + print "}}}}" + } + ' $tmp data/coins \ + | scripts/last-of-design.sed +done -- cgit v1.2.3