diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml index 9090cd4..de88bdd 100644 --- a/config/_default/hugo.toml +++ b/config/_default/hugo.toml @@ -42,8 +42,8 @@ enableEmoji = true [outputs] home = ["HTML", "RSS", "JSON"] - section = ["HTML", "Calendar", "RSS", "XML"] - page = ["HTML", "Calendar"] + section = ["HTML", "Calendar", "RSS", "XML", "ICS"] + page = ["HTML", "Calendar", "ICS"] # Output Formats Configuration [outputFormats.Calendar] diff --git a/layouts/_default/list.ics b/layouts/_default/list.ics new file mode 100644 index 0000000..beb3274 --- /dev/null +++ b/layouts/_default/list.ics @@ -0,0 +1,23 @@ +{{- $time_zone := "Europe/Berlin" -}} +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//CCCB//Calendar//DE +CALSCALE:GREGORIAN +METHOD:PUBLISH +X-WR-CALNAME:CCCB Calendar +X-WR-TIMEZONE:{{ $time_zone }} +{{ range .Pages }} +{{ if and .Params.dtstart .Params.dtend }} +BEGIN:VEVENT +UID:{{ .File.BaseFileName }}@berlin.ccc.de +SUMMARY:{{ .Title }} +{{ with .Params.subtitle }}DESCRIPTION:{{ . }}{{ end }} +URL:https://berlin.ccc.de{{ .RelPermalink }} +{{ with .Params.dtstart }}DTSTART:{{ . }}{{ end }} +{{ with .Params.dtend }}DTEND:{{ . }}{{ end }} +{{ with .Params.rrule }}RRULE:{{ . }}{{ end }} +DTSTAMP:{{ now.Format "20060102T150405Z" }} +END:VEVENT +{{ end }} +{{ end }} +END:VCALENDAR \ No newline at end of file diff --git a/layouts/datengarten/section.ics b/layouts/datengarten/section.ics index 80768b5..d6a9227 100644 --- a/layouts/datengarten/section.ics +++ b/layouts/datengarten/section.ics @@ -19,36 +19,20 @@ TZNAME:CET DTSTART:19701025T030000 END:STANDARD END:VTIMEZONE + +{{ range .Pages }} BEGIN:VEVENT ORGANIZER;CN="CCCB":mailto:datengarten@berlin.ccc.de -SUMMARY:Datengarten -UID: 0@datengarten.berlin.ccc.de +SUMMARY:{{ .Title }}{{ with .Params.subtitle }}: {{ . }}{{ end }} +UID:{{ .Params.no }}@datengarten.berlin.ccc.de SEQUENCE:0 STATUS:CONFIRMED -DTSTAMP:20180508T200000Z -DTSTART;TZID=Europe/Berlin:20180508T200000 -DTEND;TZID=Europe/Berlin:20180508T220000 -RRULE:FREQ=MONTHLY;BYSETPOS=2;BYDAY=TU;INTERVAL=1;UNTIL=20190409T220000 -{{range .Pages -}} -EXDATE;TZID=Europe/Berlin:{{dateFormat "20060102T150405" .Params.event.start}} -{{end -}} -LOCATION:{{with .Params.location}}{{.}}{{else}}CCCB{{end}} -URL:{{.Permalink}} -DESCRIPTION:{{.Permalink}} +DTSTAMP:{{ dateFormat "20060102T150405Z" .Params.event.start }} +DTSTART;TZID=Europe/Berlin:{{ dateFormat "20060102T150405" .Params.event.start }} +DTEND;TZID=Europe/Berlin:{{ dateFormat "20060102T150405" .Params.event.end }} +LOCATION:{{ with .Params.location }}{{ . }}{{ else }}CCCB{{ end }} +URL:{{ .Permalink }} +DESCRIPTION:{{ .Permalink }} END:VEVENT -{{range .Pages -}} -BEGIN:VEVENT -ORGANIZER;CN="CCCB":mailto:datengarten@berlin.ccc.de -SUMMARY:{{.Title}}{{with .Params.subtitle}}: {{.}}{{end}} -UID:{{.Params.no}}@datengarten.berlin.ccc.de -SEQUENCE:0 -STATUS:CONFIRMED -DTSTAMP:{{dateFormat "20060102T150405Z" .Params.event.start}} -DTSTART;TZID=Europe/Berlin:{{dateFormat "20060102T150405" .Params.event.start}} -DTEND;TZID=Europe/Berlin:{{dateFormat "20060102T150405" .Params.event.end}} -LOCATION:{{with .Params.location}}{{.}}{{else}}CCCB{{end}} -URL:{{.Permalink}} -DESCRIPTION:{{.Permalink}} -END:VEVENT -{{end -}} +{{ end }} END:VCALENDAR diff --git a/layouts/shortcodes/calendar.html b/layouts/shortcodes/calendar.html index b7e2271..52812c7 100644 --- a/layouts/shortcodes/calendar.html +++ b/layouts/shortcodes/calendar.html @@ -1,31 +1,35 @@ -{{ $style := resources.Get "css/calendar.css" | resources.ToCSS | resources.Fingerprint }} - - -{{ $js := resources.Get "js/calendar.js" | resources.Fingerprint }} - +{{ $js := resources.Get "js/calendar.js" }} +{{ $css := resources.Get "css/calendar.css" }}
-
-
- - - -
- - - - - - - - - - - - - -
MoDiMiDoFrSaSo
+ {{ with $css }} + + {{ end }} + {{ with $js }} + + {{ end }} + +
+
+ + +
+ + + + + + + + + + + + + +
MoDiMiDoFrSaSo
+
diff --git a/layouts/veranstaltungen/list.ics b/layouts/veranstaltungen/list.ics new file mode 100644 index 0000000..7830884 --- /dev/null +++ b/layouts/veranstaltungen/list.ics @@ -0,0 +1,25 @@ +{{- $time_zone := "Europe/Berlin" -}} +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//CCCB//Calendar//DE +CALSCALE:GREGORIAN +METHOD:PUBLISH +X-WR-CALNAME:CCCB Veranstaltungen +X-WR-TIMEZONE:{{ $time_zone }} +{{ range .Pages }} +BEGIN:VEVENT +UID:{{ .File.BaseFileName }}@berlin.ccc.de +SUMMARY:{{ .Title }} +{{ with .Params.subtitle }} +DESCRIPTION:{{ . }} + +Link: https://berlin.ccc.de{{ $.RelPermalink }} +{{ end }} +URL:https://berlin.ccc.de{{ .RelPermalink }} +{{ with .Params.dtstart }}DTSTART:{{ . }}{{ end }} +{{ with .Params.dtend }}DTEND:{{ . }}{{ end }} +{{ with .Params.rrule }}RRULE:{{ . }}{{ end }} +DTSTAMP:{{ now.Format "20060102T150405Z" }} +END:VEVENT +{{ end }} +END:VCALENDAR \ No newline at end of file diff --git a/tools/gen_upcoming.py b/tools/gen_upcoming.py index 03494a3..0f69f6a 100755 --- a/tools/gen_upcoming.py +++ b/tools/gen_upcoming.py @@ -56,8 +56,10 @@ def find_events(icsfilestr, start, end, num): if event.name == "VEVENT": if "RRULE" in event.keys(): events.extend(parse_recurring_event(event, start, end)) - elif ev := parse_single_event(event, start, end) != None: - events.append(ev) + else: + ev = parse_single_event(event, start, end) + if ev is not None: + events.append(ev) events = sorted(events, key=lambda k: k["begin"]) events = events[0:num] diff --git a/tools/merge_cals.py b/tools/merge_cals.py index c406c93..136904e 100755 --- a/tools/merge_cals.py +++ b/tools/merge_cals.py @@ -18,6 +18,10 @@ for icsfilestr in glob("public/*/**/*.ics", recursive=True): for calendar in calendars: for event in calendar.subcomponents: + if event.name != "VEVENT": + continue + if "DTSTART" not in event: + continue merged.add_component(event) outfile = "static/all.ics"