Compare commits

..

No commits in common. "79baa813f91234ce45d333faa7070d5b362ca5f5" and "238fdab51ca709e44c6193fa38ff05446030299e" have entirely different histories.

7 changed files with 56 additions and 98 deletions

View file

@ -42,8 +42,8 @@ enableEmoji = true
[outputs] [outputs]
home = ["HTML", "RSS", "JSON"] home = ["HTML", "RSS", "JSON"]
section = ["HTML", "Calendar", "RSS", "XML", "ICS"] section = ["HTML", "Calendar", "RSS", "XML"]
page = ["HTML", "Calendar", "ICS"] page = ["HTML", "Calendar"]
# Output Formats Configuration # Output Formats Configuration
[outputFormats.Calendar] [outputFormats.Calendar]

View file

@ -1,23 +0,0 @@
{{- $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

View file

@ -19,20 +19,36 @@ TZNAME:CET
DTSTART:19701025T030000 DTSTART:19701025T030000
END:STANDARD END:STANDARD
END:VTIMEZONE END:VTIMEZONE
{{ range .Pages }}
BEGIN:VEVENT BEGIN:VEVENT
ORGANIZER;CN="CCCB":mailto:datengarten@berlin.ccc.de ORGANIZER;CN="CCCB":mailto:datengarten@berlin.ccc.de
SUMMARY:{{ .Title }}{{ with .Params.subtitle }}: {{ . }}{{ end }} SUMMARY:Datengarten
UID:{{ .Params.no }}@datengarten.berlin.ccc.de UID: 0@datengarten.berlin.ccc.de
SEQUENCE:0 SEQUENCE:0
STATUS:CONFIRMED STATUS:CONFIRMED
DTSTAMP:{{ dateFormat "20060102T150405Z" .Params.event.start }} DTSTAMP:20180508T200000Z
DTSTART;TZID=Europe/Berlin:{{ dateFormat "20060102T150405" .Params.event.start }} DTSTART;TZID=Europe/Berlin:20180508T200000
DTEND;TZID=Europe/Berlin:{{ dateFormat "20060102T150405" .Params.event.end }} DTEND;TZID=Europe/Berlin:20180508T220000
LOCATION:{{ with .Params.location }}{{ . }}{{ else }}CCCB{{ end }} RRULE:FREQ=MONTHLY;BYSETPOS=2;BYDAY=TU;INTERVAL=1;UNTIL=20190409T220000
URL:{{ .Permalink }} {{range .Pages -}}
DESCRIPTION:{{ .Permalink }} EXDATE;TZID=Europe/Berlin:{{dateFormat "20060102T150405" .Params.event.start}}
{{end -}}
LOCATION:{{with .Params.location}}{{.}}{{else}}CCCB{{end}}
URL:{{.Permalink}}
DESCRIPTION:{{.Permalink}}
END:VEVENT END:VEVENT
{{ end }} {{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:VCALENDAR END:VCALENDAR

View file

@ -1,35 +1,31 @@
{{ $js := resources.Get "js/calendar.js" }} {{ $style := resources.Get "css/calendar.css" | resources.ToCSS | resources.Fingerprint }}
{{ $css := resources.Get "css/calendar.css" }} <link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{ $js := resources.Get "js/calendar.js" | resources.Fingerprint }}
<script src="{{ $js.RelPermalink }}" defer></script>
<div class="calendar-container"> <div class="calendar-container">
{{ with $css }} <div id="calendar">
<link rel="stylesheet" href="{{ .RelPermalink }}"> <div id="calendar-controls">
{{ end }} <button id="prev-month">&larr;</button>
{{ with $js }} <span id="current-month"></span>
<script src="{{ .RelPermalink }}"></script> <button id="next-month">&rarr;</button>
{{ end }} </div>
<table id="calendar-table">
<div id="calendar"> <thead>
<div id="calendar-controls"> <tr>
<button id="prev-month">&larr;</button> <th>Mo</th>
<span id="current-month"></span> <th>Di</th>
<button id="next-month">&rarr;</button> <th>Mi</th>
<th>Do</th>
<th>Fr</th>
<th>Sa</th>
<th>So</th>
</tr>
</thead>
<tbody id="calendar-body"></tbody>
</table>
</div> </div>
<table id="calendar-table">
<thead>
<tr>
<th>Mo</th>
<th>Di</th>
<th>Mi</th>
<th>Do</th>
<th>Fr</th>
<th>Sa</th>
<th>So</th>
</tr>
</thead>
<tbody id="calendar-body"></tbody>
</table>
</div>
<div id="event-panel"> <div id="event-panel">
<div id="event-date"></div> <div id="event-date"></div>
<div id="event-details"></div> <div id="event-details"></div>

View file

@ -1,25 +0,0 @@
{{- $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

View file

@ -56,10 +56,8 @@ def find_events(icsfilestr, start, end, num):
if event.name == "VEVENT": if event.name == "VEVENT":
if "RRULE" in event.keys(): if "RRULE" in event.keys():
events.extend(parse_recurring_event(event, start, end)) events.extend(parse_recurring_event(event, start, end))
else: elif ev := parse_single_event(event, start, end) != None:
ev = parse_single_event(event, start, end) events.append(ev)
if ev is not None:
events.append(ev)
events = sorted(events, key=lambda k: k["begin"]) events = sorted(events, key=lambda k: k["begin"])
events = events[0:num] events = events[0:num]

View file

@ -18,10 +18,6 @@ for icsfilestr in glob("public/*/**/*.ics", recursive=True):
for calendar in calendars: for calendar in calendars:
for event in calendar.subcomponents: for event in calendar.subcomponents:
if event.name != "VEVENT":
continue
if "DTSTART" not in event:
continue
merged.add_component(event) merged.add_component(event)
outfile = "static/all.ics" outfile = "static/all.ics"