diff --git a/source/sources/ical_feed.ts b/source/sources/ical_feed.ts index 4238e99..273b81d 100644 --- a/source/sources/ical_feed.ts +++ b/source/sources/ical_feed.ts @@ -111,6 +111,7 @@ namespace _munin.sources.ical_feed "begin": begin, "end": end, "location": (vevent.location ?? null), + "tags": vevent.categories, }; return event; } diff --git a/source/targets/email.ts b/source/targets/email.ts index 1b96ee3..5decc69 100644 --- a/source/targets/email.ts +++ b/source/targets/email.ts @@ -55,18 +55,31 @@ namespace _munin.targets.email parameters.sender, parameters.receivers, lib_plankton.string.coin( - "[{{head}}] {{date}} : {{title}}", + "[{{head}}] {{date}} : {{macro_tags}}{{title}}", { "head": labels.head, "date": lib_plankton.pit.date_format(event.begin.date), + "macro_tags": ( + (event.tags === null) + ? + "" + : + (event.tags.map(tag => ("{" + tag + "}")).join(" ") + " ") + ), "title": event.title, } ), lib_plankton.string.coin( - "*{{head}}*\n\n\{{title_label}} | {{title_value}}\n{{time_label}} | {{time_value}}{{macro_location}}", + "{{title_label}} | {{macro_tags}}{{title_value}}\n{{time_label}} | {{time_value}}{{macro_location}}", { - "head": labels.head, "title_label": labels.title.toUpperCase(), + "macro_tags": ( + (event.tags === null) + ? + "" + : + (event.tags.map(tag => ("{" + tag + "}")).join(" ") + " ") + ), "title_value": event.title, "time_label": labels.time.toUpperCase(), "time_value": lib_plankton.pit.timespan_format(event.begin, event.end), diff --git a/source/targets/telegram_bot.ts b/source/targets/telegram_bot.ts index 15d03b8..2a68ee5 100644 --- a/source/targets/telegram_bot.ts +++ b/source/targets/telegram_bot.ts @@ -42,9 +42,16 @@ namespace _munin.targets.telegram_bot parameters.bot_token, parameters.chat_id, lib_plankton.string.coin( - "*{{head}}*\n\n\{{title_label}} | {{title_value}}\n{{time_label}} | {{time_value}}{{macro_location}}", + "*{{head}}*\n\n\{{title_label}} | {{macro_tags}}{{title_value}}\n{{time_label}} | {{time_value}}{{macro_location}}", { "head": labels.head, + "macro_tags": ( + (event.tags === null) + ? + "" + : + (event.tags.map(tag => ("{" + tag + "}")).join(" ") + " ") + ), "title_label": labels.title.toUpperCase(), "title_value": event.title, "time_label": labels.time.toUpperCase(), @@ -65,7 +72,7 @@ namespace _munin.targets.telegram_bot } ), { - "parse_mode": "markdown", + "parse_mode": "Markdown", } ); } diff --git a/source/types.ts b/source/types.ts index 51ec907..8bb5ec8 100644 --- a/source/types.ts +++ b/source/types.ts @@ -38,6 +38,7 @@ namespace _munin begin : lib_plankton.pit.type_datetime, end : (null | lib_plankton.pit.type_datetime), location : (null | string); + tags : (null | Array); };