From 60c18e991009a1df582489902a842e44f5717e0c Mon Sep 17 00:00:00 2001 From: JP Hastings-Spital Date: Tue, 26 Dec 2023 22:44:07 +0000 Subject: [PATCH] Attending on timings --- content/calendar/interesting-conference.md | 2 +- .../lse-library-archives/the-radical-left.md | 2 +- layouts/calendar/list.ics | 18 +++++++++--------- layouts/calendar/single.html | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/content/calendar/interesting-conference.md b/content/calendar/interesting-conference.md index ce8b83c4..3e395774 100644 --- a/content/calendar/interesting-conference.md +++ b/content/calendar/interesting-conference.md @@ -5,13 +5,13 @@ date: 2023-12-22T13:31:40Z timings: - starts: 2024-05-15T19:00:00+0100 duration: PT5H + attending: true link: https://www.eventbrite.com/e/interesting-2024-tickets-780721006547 location: name: Conway Hall latitude: 51.51972123177939 longitude: -0.11838331781213689 summary: Short talks about interesting things. -attending: true --- > Short talks about interesting things. Same old same old. diff --git a/content/calendar/lse-library-archives/the-radical-left.md b/content/calendar/lse-library-archives/the-radical-left.md index 1638e1c1..a3fef692 100644 --- a/content/calendar/lse-library-archives/the-radical-left.md +++ b/content/calendar/lse-library-archives/the-radical-left.md @@ -5,13 +5,13 @@ date: 2023-12-22T12:27:13Z timings: - starts: 2024-01-24T16:00:00Z duration: PT3H + attending: [jp, yvette] link: https://www.lse.ac.uk/library/events/general/lse-library-archives-drop-in-session location: name: LSE Library Gallery latitude: 51.514664134157435 longitude: -0.11572255524925255 summary: A tour of the development of Britain's radical left, told through the LSE Library's collection. -attending: [jp, yvette] --- It's a drop-in event, so we'll probably end up going after work at ~17:30. diff --git a/layouts/calendar/list.ics b/layouts/calendar/list.ics index c9841109..7d6f3f22 100644 --- a/layouts/calendar/list.ics +++ b/layouts/calendar/list.ics @@ -11,15 +11,9 @@ DTSTAMP:{{ .Page.Date.UTC.Format "20060102T150405Z" }} {{ with (index .Params.timings 0) -}} DTSTART:{{ (time.AsTime .starts).UTC.Format "20060102T150405Z" }} DURATION:{{ .duration }} -{{ end -}} -LOCATION:{{.Page.Params.location.name}} -GEO:{{.Page.Params.location.latitude}};{{.Page.Params.location.longitude}} -SUMMARY:{{.Page.Title}} -DESCRIPTION:{{ .Page.Summary | replaceRE "(.{62})(.*)" "$1\r\n $2" | replaceRE "( [^\r\n]{72})([^\r\n]*)" "$1\r\n $2" }} -URL:{{.Page.Params.link | replaceRE "(.{70})(.*)" "$1\r\n $2" | replaceRE "( [^\r\n]{72})([^\r\n]*)" "$1\r\n $2" }} -{{- $attendees := .Page.Params.attending -}} +{{- $attendees := .attending -}} {{- $jpDone := false -}} -{{- if eq .Page.Params.attending true}}{{ $attendees = slice "jp" }}{{ $jpDone = true }}{{ end -}} +{{- if eq .attending true}}{{ $attendees = slice "jp" }}{{ $jpDone = true }}{{ end -}} {{ range $attendees -}} {{- if eq . "jp" }}{{ $jpDone = true }}{{ end -}} {{- with (index site.Data.friends .) }} @@ -27,9 +21,15 @@ 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}}; +ATTENDEE;CUTYPE=INDIVIDUAL;CN={{ site.Data.friends.jp.name }} ({{site.Title}}); PARTSTAT=NEEDS-ACTION:MAILTO:{{ site.Data.friends.jp.site }} {{- end }} +{{ end -}} +LOCATION:{{.Page.Params.location.name}} +GEO:{{.Page.Params.location.latitude}};{{.Page.Params.location.longitude}} +SUMMARY:{{.Page.Title}} +DESCRIPTION:{{ .Page.Summary | replaceRE "(.{62})(.*)" "$1\r\n $2" | replaceRE "( [^\r\n]{72})([^\r\n]*)" "$1\r\n $2" }} +URL:{{.Page.Params.link | replaceRE "(.{70})(.*)" "$1\r\n $2" | replaceRE "( [^\r\n]{72})([^\r\n]*)" "$1\r\n $2" }} END:VEVENT {{- end }} END:VCALENDAR \ No newline at end of file diff --git a/layouts/calendar/single.html b/layouts/calendar/single.html index 6f703d79..20d3a99e 100644 --- a/layouts/calendar/single.html +++ b/layouts/calendar/single.html @@ -76,15 +76,15 @@ From {{ $starts.Format "15:04" }} until {{ $starts.Add $duration | dateFormat "15:04 (MST)" }} ({{ replace $durationStr "t" "" }})

- {{ if .Params.attending }} + {{ if $timing.attending }}

- {{ if eq .Params.attending true }}{{ partial "friend.html" "jp.no-emoji" }} is going - {{ else if eq (len .Params.attending) 1 }} - {{ partial "friend.html" (printf "%s.no-emoji" (index .Params.attending 0)) }} is going + {{ if eq $timing.attending true }}{{ partial "friend.html" "jp.no-emoji" }} is going + {{ else if eq (len $timing.attending) 1 }} + {{ partial "friend.html" (printf "%s.no-emoji" (index $timing.attending 0)) }} is going {{ else }} - {{ $count := len .Params.attending}} - {{ range $i, $attendee := .Params.attending }} + {{ $count := len $timing.attending}} + {{ range $i, $attendee := $timing.attending }} {{ partial "friend.html" (printf "%s.no-emoji" $attendee) -}} {{- if eq $i (sub $count 2) }}{{ if gt $count 2 }},{{ end }} and {{ else if lt $i (sub $count 1) }}, {{ end }} {{ end }} are going