summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2018-07-06 13:32:06 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2018-09-08 16:12:34 +0200
commitce7ce9908b2a3f32cbfabb6b00ad52e105f0c7f5 (patch)
treeb2f59a816e2d0880d9c1cc0e44cb974cfc170a84
parent78bde1b41e5cb692ea9ffbfff4d35edf3162dcdf (diff)
downloadcaldr-ce7ce9908b2a3f32cbfabb6b00ad52e105f0c7f5.tar.gz
rem: extract summary (subject) from events
-rw-r--r--rem.lua13
-rwxr-xr-xtoreminder.lua3
2 files changed, 11 insertions, 5 deletions
diff --git a/rem.lua b/rem.lua
index ed3a355..c8826dc 100644
--- a/rem.lua
+++ b/rem.lua
@@ -247,7 +247,7 @@ local rem_of_vcalendars do
return nil
end
- local msg_of_description = function (val)
+ local string_of_textdata = function (val)
local sane = unescape_string (val.value)
return trim_whitespace (sane)
@@ -259,7 +259,7 @@ local rem_of_vcalendars do
local rem_of_vevent = function (ev)
local dtstart, dtend
- local date, msg
+ local date, msg, msg_desc
local vals = ev.value
local nvals = #vals
@@ -269,11 +269,12 @@ local rem_of_vcalendars do
if val.kind == "other" then
local valname = val.name
- if valname == "description" then msg = msg_of_description (val)
+ if valname == "summary" then msg = string_of_textdata (val)
+ elseif valname == "description" then msg_desc = string_of_textdata (val)
elseif valname == "dtstart" then dtstart = val
elseif valname == "dtend" then dtend = val
else
- noiseln ("rem_of_vevent: ignoring value [%s]", valname)
+ debugln ("rem_of_vevent: ignoring value [%s]", valname)
end
else
end
@@ -289,6 +290,10 @@ local rem_of_vcalendars do
error ("could not derive message text from event values")
end
+ if msg_desc ~= nil then
+ msg = stringformat ("%s (%s)", msg, msg_desc)
+ end
+
return stringformat ("REM %s MSG %s", date, msg_of_string (msg))
end
diff --git a/toreminder.lua b/toreminder.lua
index e0216f4..5fe9e4b 100755
--- a/toreminder.lua
+++ b/toreminder.lua
@@ -3,7 +3,7 @@ local cal = require "cal"
local rem = require "rem"
local common = require "common"
-common.set_verbosity (2)
+common.set_verbosity (1)
local main = function (argv)
local ok, parsed = cal.parse_stdin ()
@@ -12,6 +12,7 @@ local main = function (argv)
end
local ok = rem.output_calendar (parsed)
+ print ""
return ok and 0 or -1
end