unescape() { [ $# = 0 ] && sed -E 's;\\(.);\1;g' || printf %s "$*" |sed -E 's;\\(.);\1;g'; }
upcase=' y;abcdefghijklmnopqrstuvwxyzäöüé;ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜÉ;; '
-card_fullname(){
- local card="$1" N n1 n2 n3 n4 n5
-
- if pdi_value "$card" FN; then
- return
- elif N="$(pdi_value "$card" N)"; then
- IFS=\; read n1 n2 n3 n4 n5 <<-EOF
- $(pdi_value "$card" N)
- EOF
- printf '%s %s %s %s %s' "$n4" "$n2" "$n3" "$n1" "$n5"
- else
- pdi_value "$card" NICKNAME
- fi
-}
-
-
card_item(){
local card="$1"
local item cnt c
cnt="$(pdi_count "$card" "$item")"
case $item in
- FN) printf '[h2 .item .FN ­%s]' "$(card_fullname "$card" |unescape |HTML)"
+ FN) printf '[h2 .item .FN ­%s]' "$(pdi_value "$card" FN |unescape |HTML)"
;;
GENDER) printf '[span .item .GENDER ­%s]' "$(pdi_value "$card" GENDER |l10n)"
;;
order_cards() {
local cardfile card
- echo ORDER $order >&2
while read cardfile; do
card="$(pdi_load "$cardfile")"
case $order in
firstname)
- printf '%s %s\n' "$(card_fullname "$card")" "$cardfile"
+ printf '%s %s\n' "$(pdi_value "$card" FN)" "$cardfile"
;;
lastname)
- printf '%s %s\n' "$(pdi_value "$card" N || card_fullname "$card")" "$cardfile"
+ printf '%s %s\n' "$(pdi_value "$card" N || pdi_value "$card" FN)" "$cardfile"
;;
bdate)
printf '%s %s\n' "$(pdi_value "$card" BDAY || printf 0000-00-00)" "$cardfile"