From: Paul Hänsch Date: Mon, 13 Oct 2025 11:19:15 +0000 (+0200) Subject: always show 22 lines in export, show line numbers, show years X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=49008fb255fdf25b3ffb31118e879a3432314129;p=confetti always show 22 lines in export, show line numbers, show years --- diff --git a/courses/export_pdf.sh b/courses/export_pdf.sh index 10230b8..d9f423a 100755 --- a/courses/export_pdf.sh +++ b/courses/export_pdf.sh @@ -64,13 +64,14 @@ get_dates() { while [ "$dts_date" -lt "$today" ]; do dts_date="$(date -d "${dts_date} + ${rec}" +%Y%m%d)"; done for n in 1 2 3 4 5 6 7 8 9 10; do - LANG=de_DE.UTF-8 date -d "$dts_date" +"%d. %b." + LANG=de_DE.UTF-8 date -d "$dts_date" +"%Y %d. %b." dts_date="$(date -d "${dts_date} + ${rec}" +%Y%m%d)" done } # some table styles need to be inline, because this is how libreoffice works -style_td='style="border: 1pt solid; padding: 1mm 2mm; vertical-align: top;"' +style_td='style="border: 0.5pt solid; padding: 0mm 1.5mm; vertical-align: top;"' +linecnt="$(grep -F "${coursefile##*/} " "$_DATA/mappings/attendance" |wc -l)" "$_EXEC/cgilite/html-sh.sed" <<-EOF >"$htmlfile" @@ -83,7 +84,7 @@ style_td='style="border: 1pt solid; padding: 1mm 2mm; vertical-align: top;"' [style type="text/css" @page { size: 29.7cm 21cm; margin: 1.5cm; } * { background: inherit; } - body { background: transparent; font-family: Liberation Sans, Sans-Serif; } + body { background: transparent; font-family: Liberation Sans, Sans-Serif; font-size: 12pt; } th { white-space: pre; } th, td { text-align: left; } @@ -111,19 +112,32 @@ style_td='style="border: 1pt solid; padding: 1mm 2mm; vertical-align: top;"' done |sort |while read -r line; do attno=$((${attno-0} + 1)) printf '%s%2i%s\n' "${line%%@@No@@*}" $attno "${line#*@@No@@}" + done + seq $((linecnt + 1)) 22 |while read n; do + printf '[tr [td %s .No %i] [td %s .N] [td %s .BDAY] [td %s .TEL] [td %s .NOTE]]\n' \ + "${style_td%\"} text-align: right;\"" "$n" "$style_td" "$style_td" "$style_td" "$style_td" done)] ] + [h2 style="text-align: center;" . Jahr $(get_dates |cut -f1 |uniq |sed '2,$i/')] [table width="100%" - [col width=30*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] + [col width=5*] [col width=30*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [thead - [tr [th $style_td ] $(get_dates |xargs -d\\n printf "[th $style_td . %s]")] + [tr [th] [th] $(get_dates |cut -f2- |xargs -d\\n printf "[th $style_td . %s]")] ][tbody $(grep -F "${coursefile##*/} " "$_DATA/mappings/attendance" |while read discard each; do vcf="$(pdi_load "$_DATA/vcard/$each")" - printf '[tr [td %s .N . %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s]]\n' \ - "$style_td" "$(pdi_value "$vcf" FN |unescape |HTML)" \ + printf '[tr [td %s .No @@No@@] [td %s .N . %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s]]\n' \ + "${style_td%\"} text-align: right;\"" "$style_td" "$(pdi_value "$vcf" FN |unescape |HTML)" \ "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" - done |sort)] + done |sort |while read -r line; do + attno=$((${attno-0} + 1)) + printf '%s%2i%s\n' "${line%%@@No@@*}" $attno "${line#*@@No@@}" + done + seq $((linecnt + 1)) 22 |while read n; do + printf '[tr [td %s .No %i] [td %s .N ] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s]]\n' \ + "${style_td%\"} text-align: right;\"" "$n" "$style_td" \ + "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" + done)] ] ]] EOF