# HG changeset patch # User Matthew Wild # Date 1364569307 0 # Node ID c16d25785df100a07d6141657ae171ab9d385c41 # Parent 19d109c1625f9a7ebb172530e6a6f81dfca7d1b6 Perform line unfolding diff -r 19d109c1625f -r c16d25785df1 ical.lua --- a/ical.lua Wed Mar 14 12:22:21 2012 +0000 +++ b/ical.lua Fri Mar 29 15:01:47 2013 +0000 @@ -6,7 +6,11 @@ local k,v = line:match("^(%w+):(.*)$"); local curr_event = ical[#ical]; if k and v then + curr_event._last_key = k; curr_event[k] = v; + elseif line:sub(1,1) == " " then + curr_event[curr_event._last_key] = curr_event[curr_event._last_key]..line:sub(2); + return; end if k == "DTSTAMP" then @@ -23,6 +27,7 @@ local line_num = 0; -- Parse + local hold_buffer; for line in data:gmatch("(.-)[\r\n]+") do line_num = line_num + 1; if line:match("^BEGIN:") then @@ -35,7 +40,7 @@ end table.remove(stack); elseif handler[stack[#stack]] then - handler[stack[#stack]](ical, line); + handler[stack[#stack]](ical, (hold_buffer or "")..line); end end