diff options
-rw-r--r-- | common.lua | 14 | ||||
-rw-r--r-- | rem.lua | 3 |
2 files changed, 16 insertions, 1 deletions
@@ -24,6 +24,7 @@ local set_verbosity = function (n) verboselvl = n end local trim_whitespace local unescape_string +local internalize_value do local P = lpeg.P local S = lpeg.S @@ -41,10 +42,22 @@ do + (P"\\v" / "\v") local p_unescape = Cs ((p_escape_char + 1)^0) + --[[-- + + rfc2445, sec. 4.1.2: Properties can have multiple values, separated by a + literal comma, thus text commas are escaped. + + --]]-- + local p_value_char = ( p_escape_char + + P"\\," / "," + + P"," / "\n") + local p_value = Cs ((p_value_char + 1)^0) + local lpegmatch = lpeg.match trim_whitespace = function (s) return lpegmatch (p_ws_drop , s) end unescape_string = function (s) return lpegmatch (p_unescape, s) end + internalize_value = function (s) return lpegmatch (p_value, s) end end return @@ -55,5 +68,6 @@ return , set_verbosity = set_verbosity , trim_whitespace = trim_whitespace , unescape_string = unescape_string + , internalize_value = internalize_value } @@ -35,6 +35,7 @@ local noiseln = common.noiseln local debugln = common.debugln local trim_whitespace = common.trim_whitespace local unescape_string = common.unescape_string +local internalize_value = common.internalize_value local seconds_of_time = function (t) return t % 60 @@ -261,7 +262,7 @@ local rem_of_vcalendars do end local string_of_textdata = function (val) - local sane = unescape_string (val.value) + local sane = internalize_value (val.value) return trim_whitespace (sane) end |