hackertours/layouts/_partials/ics-line.html
Stefan Bethke 821290616a
Some checks failed
/ build (pull_request) Successful in 1m16s
/ accessibility (pull_request) Failing after 2m25s
40C3: tours, schedule data, tour map and calendar entries
- tour-map shortcode: Leaflet map of the tour locations with routes from the
  Congress, from the map/tours sections of data/schedule/<event>.yaml; Leaflet
  and the OSMIC, Maki and Temaki icon sets vendored; 39C3 uMap data converted.
- calendar shortcode: per tour date, a pill with an .ics download (iCalendar)
  and a Google Calendar link; Font Awesome Free vendored, fa-icon partial.
- README sections for the calendar and tour map shortcodes and the map data.
2026-10-17 10:30:03 +02:00

22 lines
846 B
HTML

{{- /*
One iCalendar (RFC 5545) content line: "NAME:value" plus CRLF, folded so that no line is
longer than 75 bytes (continuation lines start with a space). Params: name, value, text
(true to escape the value as TEXT: backslash, semicolon, comma and newlines).
*/ -}}
{{- $value := .value | default "" -}}
{{- if .text -}}
{{- $value = $value | replaceRE `\\` `\\` | replaceRE `;` `\;` | replaceRE `,` `\,` | replaceRE `\r?\n` `\n` -}}
{{- end -}}
{{- $out := "" -}}
{{- $line := "" -}}
{{- $bytes := 0 -}}
{{- range split (printf "%s:%s" .name $value) "" -}}
{{- if gt (add $bytes (len .)) 75 -}}
{{- $out = printf "%s%s\r\n " $out $line -}}
{{- $line = "" -}}
{{- $bytes = 1 -}}
{{- end -}}
{{- $line = printf "%s%s" $line . -}}
{{- $bytes = add $bytes (len .) -}}
{{- end -}}
{{- return printf "%s%s\r\n" $out $line -}}