]> git.plutz.net Git - cgilite/blobdiff - cgilite.sh
avoid confusion regarding carriage return when escaping HTML (especially in textarea)
[cgilite] / cgilite.sh
index f03f74732165e4d672418d3718ecc228db4ac53d..32aa28bfb5c8cf165a7082e840634fb2e313ac42 100755 (executable)
@@ -27,6 +27,8 @@ BR='
 '
 cgilite_timeout=2
 
+debug(){ [ $# -gt 0 ] && printf '%s\n' "$@" >&2 || tee -a /dev/stderr; }
+
 PATH(){ 
   local str seg out
   [ $# -eq 0 ] && str="$(cat)" || str="$*"
@@ -200,6 +202,7 @@ HTML(){
       \'*) out="${out}'";;
       \[*) out="${out}[";;
       \]*) out="${out}]";;
+      "${CR}"*) out="${out}
";;
       "${BR}"*) out="${out}
";;
       *) out="${out}${str%"${str#?}"}";;
     esac