fix some minor ics issues #275

Merged
paspo merged 2 commits from paspo/bglug.it:fixics into main 2024-10-05 09:57:33 +00:00
Showing only changes of commit c3a18c610f - Show all commits

View File

@ -1,83 +1,83 @@
{{- $numcaratteri := 66 }} {{- $numcaratteri := 66 -}}
BEGIN:VCALENDAR BEGIN:VCALENDAR
VERSION:2.0 VERSION:2.0
PRODID:-//BgLUG//BgLUG Events Calendar//EN PRODID:-//BgLUG//BgLUG Events Calendar//EN
X-WR-CALNAME:BgLUG Events Calendar X-WR-CALNAME:BgLUG Events Calendar
X-WR-TIMEZONE:Europe/Rome X-WR-TIMEZONE:Europe/Rome
CALSCALE:GREGORIAN CALSCALE:GREGORIAN
METHOD:PUBLISH METHOD:PUBLISH
BEGIN:VTIMEZONE BEGIN:VTIMEZONE
TZID:Europe/Rome TZID:Europe/Rome
LAST-MODIFIED:20240422T053451Z LAST-MODIFIED:20240422T053451Z
TZURL:https://www.tzurl.org/zoneinfo-outlook/Europe/Rome TZURL:https://www.tzurl.org/zoneinfo-outlook/Europe/Rome
X-LIC-LOCATION:Europe/Rome X-LIC-LOCATION:Europe/Rome
BEGIN:DAYLIGHT BEGIN:DAYLIGHT
TZNAME:CEST TZNAME:CEST
TZOFFSETFROM:+0100 TZOFFSETFROM:+0100
TZOFFSETTO:+0200 TZOFFSETTO:+0200
DTSTART:19700329T020000 DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT END:DAYLIGHT
BEGIN:STANDARD BEGIN:STANDARD
TZNAME:CET TZNAME:CET
TZOFFSETFROM:+0200 TZOFFSETFROM:+0200
TZOFFSETTO:+0100 TZOFFSETTO:+0100
DTSTART:19701025T030000 DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD END:STANDARD
END:VTIMEZONE END:VTIMEZONE
{{- range where .Site.Pages ".Page.Params.add_to_ics" true -}} {{- range where .Site.Pages ".Page.Params.add_to_ics" true -}}
{{- $location := "" -}} {{- $location := "" -}}
{{- $locations := .Params.locations -}} {{- $locations := .Params.locations -}}
{{- with (eq (printf "%T" $locations ) "string" ) -}} {{- with (eq (printf "%T" $locations ) "string" ) -}}
{{- $location = $locations -}} {{- $location = $locations -}}
{{- end -}} {{- end -}}
{{- with (eq (printf "%T" $locations ) "[]string" ) -}} {{- with (eq (printf "%T" $locations ) "[]string" ) -}}
{{- $location = (index $locations 0) -}} {{- $location = (index $locations 0) -}}
{{- end -}} {{- end -}}
{{- if .Params.location_ics }} {{- if .Params.location_ics }}
{{- $location = .Params.location_ics }} {{- $location = .Params.location_ics }}
{{- end }} {{- end }}
{{- $description := "" }} {{- $description := "" }}
{{- with .Description }} {{- with .Description }}
{{- $description = . }} {{- $description = . }}
{{- end }} {{- end }}
{{- with .Summary }} {{- with .Summary }}
{{- $description = . }} {{- $description = . }}
{{- end }} {{- end }}
BEGIN:VEVENT BEGIN:VEVENT
SUMMARY:{{.Title}} SUMMARY:{{.Title}}
ORGANIZER;{{ .Site.Param "ics.organizer" }} ORGANIZER;{{ .Site.Param "ics.organizer" }}
UID:{{ md5 .Permalink }}@bglug.it UID:{{ md5 .Permalink }}@bglug.it
SEQUENCE:0 SEQUENCE:0
STATUS:CONFIRMED STATUS:CONFIRMED
TRANSP:TRANSPARENT TRANSP:TRANSPARENT
{{- if ne $description "" }} {{- if ne $description "" }}
{{- $description = replace $description "\n" " " }} {{- $description = replace $description "\n" " " }}
{{- $description = (print "DESCRIPTION:" $description ) | truncate 400 }} {{- $description = (print "DESCRIPTION:" $description ) | truncate 400 }}
{{- $i := 0 }} {{- $i := 0 }}
{{- range seq 0 $numcaratteri ($description | len) }} {{- range seq 0 $numcaratteri ($description | len) }}
{{ strings.Repeat $i " " }}{{- substr $description . $numcaratteri }} {{ strings.Repeat $i " " }}{{- substr $description . $numcaratteri }}
{{- $i = add $i 1 }} {{- $i = add $i 1 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
LOCATION:{{ $location }} LOCATION:{{ $location }}
URL:{{ .Permalink }} URL:{{ .Permalink }}
{{- with (.Page.Resources.GetMatch .Params.image ) -}} {{- with (.Page.Resources.GetMatch .Params.image ) -}}
{{- $image := print "IMAGE;VALUE=URI;DISPLAY=BADGE;FMTTYPE=" .MediaType.String ":" .Permalink }} {{- $image := print "IMAGE;VALUE=URI;DISPLAY=BADGE;FMTTYPE=" .MediaType.String ":" .Permalink }}
{{- $i := 0 }} {{- $i := 0 }}
{{- range seq 0 $numcaratteri ($image | len) }} {{- range seq 0 $numcaratteri ($image | len) }}
{{ strings.Repeat $i " " }}{{- substr $image . $numcaratteri }} {{ strings.Repeat $i " " }}{{- substr $image . $numcaratteri }}
{{- $i = add $i 1 }} {{- $i = add $i 1 }}
{{- end }} {{- end }}
{{ end -}} {{ end -}}
{{ with .Lastmod }}DTSTAMP:{{dateFormat "20060102T150405Z" . }} {{ with .Lastmod }}DTSTAMP:{{dateFormat "20060102T150405Z" . }}
{{ end -}} {{ end -}}
{{ if .Date }}DTSTART;TZID=Europe/Rome:{{dateFormat "20060102T150405" .Date }} {{ if .Date }}DTSTART;TZID=Europe/Rome:{{dateFormat "20060102T150405" .Date }}
{{- $d := time.AsTime .Date }} {{- $d := time.AsTime .Date }}
{{- $duration := .Params.duration | default "1h" }} {{- $duration := .Params.duration | default "1h" }}
DTEND;TZID=Europe/Rome:{{dateFormat "20060102T150405" ($d.Add (time.ParseDuration $duration) ) }} DTEND;TZID=Europe/Rome:{{dateFormat "20060102T150405" ($d.Add (time.ParseDuration $duration) ) }}
{{- end }} {{- end }}
END:VEVENT END:VEVENT
{{- end }} {{- end }}
END:VCALENDAR END:VCALENDAR