Merge branch 'staging' into production

This commit is contained in:
Marek Krug 2025-03-12 17:41:59 +01:00
commit 79baa813f9
7 changed files with 98 additions and 56 deletions

View file

@ -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]

23
layouts/_default/list.ics Normal file
View file

@ -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

View file

@ -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

View file

@ -1,31 +1,35 @@
{{ $style := resources.Get "css/calendar.css" | resources.ToCSS | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{ $js := resources.Get "js/calendar.js" | resources.Fingerprint }}
<script src="{{ $js.RelPermalink }}" defer></script>
{{ $js := resources.Get "js/calendar.js" }}
{{ $css := resources.Get "css/calendar.css" }}
<div class="calendar-container">
<div id="calendar">
<div id="calendar-controls">
<button id="prev-month">&larr;</button>
<span id="current-month"></span>
<button id="next-month">&rarr;</button>
</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>
{{ with $css }}
<link rel="stylesheet" href="{{ .RelPermalink }}">
{{ end }}
{{ with $js }}
<script src="{{ .RelPermalink }}"></script>
{{ end }}
<div id="calendar">
<div id="calendar-controls">
<button id="prev-month">&larr;</button>
<span id="current-month"></span>
<button id="next-month">&rarr;</button>
</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-date"></div>
<div id="event-details"></div>

View file

@ -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

View file

@ -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]

View file

@ -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"