Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s }
- function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s }
- function trim(s) { return rtrim(ltrim(s)); }
- function print_table_row(nr, date, link, descr) {
- if( trim(descr) == "" ) {
- _row = "| colspan=\"3\" style=\"background-color:#DCDCDC;\"|fehlt";
- } else {
- _row = sprintf("| %s", trim(nr))
- _row = sprintf("%s\n| %s", _row, trim(date))
- if( trim(link) == "" ) {
- _row = sprintf("%s\n| %s", _row, trim(descr))
- } else {
- _row = sprintf("%s\n| [%s %s]", _row, trim(link), trim(descr))
- }
- }
- return _row
- }
- BEGIN {
- FS="[;]"
- print "{| class=\"wikitable\" style=\"text-align:center;\""
- print "|+Geburtsregister Standesamt I"
- print "|-"
- print "! scope=\"col\" rowspan=\"2\" style=\"padding-left:20px;padding-right:20px\"| Jahr"
- print "! scope=\"col\" rowspan=\"2\"| Bd."
- print "! scope=\"col\" colspan=\"3\"| Hauptregister"
- print "! scope=\"col\" colspan=\"3\"| Nebenregister"
- print "|-"
- print "! scope=\"col\"| Reg.-Nr."
- print "! scope=\"col\"| Datum"
- print "! scope=\"col\"| URL"
- print "! scope=\"col\"| Reg.-Nr."
- print "! scope=\"col\"| Datum"
- print "! scope=\"col\"| URL"
- print "|-"
- year=1874
- yearrows=0
- rows=""
- }
- {
- if( year == $1 ) {
- yearrows++
- } else {
- printf("! rowspan=\"%d\"|%d\n%s" , yearrows , year , rows)
- year=$1
- yearrows=1
- rows=""
- }
- rows = sprintf("%s| %d\n%s\n", rows, $2, print_table_row($3, $4, $5, $6));
- rows = sprintf("%s%s\n|-\n",rows, print_table_row($7, $8, $9, $10));
- }
- END {
- printf("! rowspan=\"%d\"|%d\n%s" , yearrows , year , rows)
- print "|}"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement