BEGIN:VCALENDAR CALSCALE:GREGORIAN VERSION:2.0 PRODID:-//www.byjp.me X-WR-CALNAME:{{ .Title }} byJP X-WR-CALDESC:{{ .Summary | replaceRE "(.{61})(.*)" "$1\r\n $2" | replaceRE "( [^\r\n]{72})([^\r\n]*)" "$1\r\n $2" }} {{- range $page := .Data.Pages}} BEGIN:VEVENT UID:byjp{{ replace $page.Page.RelPermalink "/" "-" | replaceRE "(.{61})(.*)" "$1\r\n $2" | replaceRE "( [^\r\n]{72})([^\r\n]*)" "$1\r\n $2" }} DTSTAMP:{{ .Page.Date.UTC.Format "20060102T150405Z" }} {{ with (index .Params.timings 0) -}} DTSTART:{{ (time.AsTime .starts).UTC.Format "20060102T150405Z" }} DURATION:{{ .duration }} {{- $attendees := .attending -}} {{- $jpDone := false -}} {{- if eq .attending true}}{{ $attendees = slice "jp" }}{{ $jpDone = true }}{{ end -}} {{ range $attendees -}} {{- if eq . "jp" }}{{ $jpDone = true }}{{ end -}} {{- with (index site.Data.friends .) }} ATTENDEE;CUTYPE=INDIVIDUAL;CN={{ .name }} ({{ site.Title }}); PARTSTAT=ACCEPTED:MAILTO:{{ .site }} {{- end }}{{ end -}} {{- if not $jpDone }} ATTENDEE;CUTYPE=INDIVIDUAL;CN={{ site.Data.friends.jp.name }} ({{ site.Title }}); PARTSTAT=NEEDS-ACTION:MAILTO:{{ site.Data.friends.jp.site }} {{- end }} {{ end -}} LOCATION:{{ $page.Page.Params.location.name }} GEO:{{ $page.Page.Params.location.latitude }};{{ $page.Page.Params.location.longitude }} SUMMARY:{{ $page.Page.Title }} DESCRIPTION:{{ $page.Page.Summary | replaceRE "(.{62})(.*)" "$1\r\n $2" | replaceRE "( [^\r\n]{72})([^\r\n]*)" "$1\r\n $2" }} URL:{{ $page.Page.Params.link | replaceRE "(.{70})(.*)" "$1\r\n $2" | replaceRE "( [^\r\n]{72})([^\r\n]*)" "$1\r\n $2" }} END:VEVENT {{- end }} END:VCALENDAR