]> git.plutz.net Git - confetti/blobdiff - pages/cards.sh
enable support for phone number types
[confetti] / pages / cards.sh
index d1170b0ada1f5cb767e4f04af476b2fcc6b6029d..50fee63b76c70040b1a776172e19d3385337b5f4 100755 (executable)
@@ -19,6 +19,9 @@
 
 [ -z "${_GET[order]}" ] && _GET[order]="firstname"
 
+BR='
+'
+
 listcourses() {
   ls -1 ${_DATA}/ical/*ics |while read file; do
     icstime="$(sed -rn 's:^DTSTART\:(TZID=.*\:)?([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z?\r$:\2-\3-\4 \5\:\6\:\7:p' "$file")"
@@ -115,7 +118,7 @@ vcf_parse() {
     case "$line" in
       key=*) printf %s\\n "$line"
        ;;
-      value=*) printf %s\\n "$line"
+      value=*) printf %s\\n "${line}"
        ;;
       tag=*) ot=''
             printf %s "$line" \
@@ -154,7 +157,7 @@ view_card() {  #Parameter: Cardfile
           if [ -z "$key" ]; then
             eval "$line"
           else
-            values[$key]="$value"
+            values[$key]="${value//\\r\\n/$BR}"
             for t in ${(k)tag}; do
               tags[${key}_$t]="$tag[$t]"
             done
@@ -192,7 +195,7 @@ edit_card() {  #Parameter: Cardfile
         if [ -z "$key" ]; then
           eval "$line"
         else
-          [ -n "$value" ] && values[$key]="$value" || values[$key]='\r'
+          [ -n "$value" ] && values[$key]="${value//\\r\\n/$BR}" || values[$key]='\r'
           for t in ${(k)tag}; do
             tags[${key}_$t]="$tag[$t]"
           done