From c552e0b51dd1d27ef7ce042c074b9928cfc5685d Mon Sep 17 00:00:00 2001
From: paul <paul@plutz.net>
Date: Thu, 12 Oct 2017 16:26:03 +0000
Subject: [PATCH] apply tex escaping

svn path=/trunk/; revision=154
---
 actions/generate_courselist.sh | 6 ++++--
 templates/course_print.sh      | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/actions/generate_courselist.sh b/actions/generate_courselist.sh
index 07fb0bb..5b3a32b 100755
--- a/actions/generate_courselist.sh
+++ b/actions/generate_courselist.sh
@@ -27,7 +27,7 @@ fromdate="$(date -d "$fromdate" +%s)" 2>/dev/null
 . ${_EXEC}/pages/cards.sh
 
 tex_clean() { #in dire need for improvement
-  echo "$*" |tr -d '{&}\\'
+  printf %s "$*" |tr -d '{&}\\'
 }
 
 
@@ -55,7 +55,9 @@ list_attendee() {  #Parameter: Cardfile
     for n in NOTE NOTE{0..10}; do if [ -n "$values[$n]" ]; then
       [ -n "$note" ] && note="$note\\newline $values[$n]" || note="$values[$n]"
     fi; done
-    printf '%s & %s & %s & %s\n' "$fullname" "$values[BDAY]" "$tel" "$note" \
+    printf '%s & %s & %s & %s\n' \
+           "$(tex_clean $fullname)" "$(tex_clean $values[BDAY])" "$(tex_clean $tel)" "$(tex_clean $note)" \
+
     | sed -r ':X;N;$!bX; s;\n;\\newline ;g'
   fi
 }
diff --git a/templates/course_print.sh b/templates/course_print.sh
index cea90e3..72ab8b8 100755
--- a/templates/course_print.sh
+++ b/templates/course_print.sh
@@ -55,7 +55,7 @@ done
 \hline
 \endhead
 '"$(
-list_attendance "$course" |sort -k 2 | debug |sed -r 's:^[0-9a-z\.]+ (.+) \(\*[0-9]{4}\)$:\1:;s:$: \& \& \& \& \& \& \& \& \& \& \\\\[3ex] \\hline:'
+tex_clean "$(list_attendance "$course")" |sort -k 2 | debug |sed -r 's:^[0-9a-z\.]+ (.+) \(\*[0-9]{4}\)$:\1:;s:$: \& \& \& \& \& \& \& \& \& \& \\\\[3ex] \\hline:'
 )"'
 \end{longtable}
 
-- 
2.39.5