Attending on timings

This commit is contained in:
JP Hastings-Spital 2023-12-26 22:44:07 +00:00
parent fdcc905239
commit 60c18e9910
4 changed files with 17 additions and 17 deletions

View file

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

View file

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

View file

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

View file

@ -76,15 +76,15 @@
From {{ $starts.Format "15:04" }} until {{ $starts.Add $duration | dateFormat "15:04 (MST)" }} (<span class="dt-duration">{{ replace $durationStr "t" "" }}</span>)
</p>
{{ if .Params.attending }}
{{ if $timing.attending }}
<p class="attending">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user-check"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="8.5" cy="7" r="4"></circle><polyline points="17 11 19 13 23 9"></polyline></svg>
{{ 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