Adds calendar pages & attendance

ICS and single calendar pages now show expected attendance. Probably ready to ship this quietly!
This commit is contained in:
JP Hastings-Spital 2023-12-24 11:01:39 +00:00
parent ef21f9f216
commit 6c5126bff0
11 changed files with 90 additions and 142 deletions

View file

@ -13,8 +13,8 @@ location:
summary: A rag & swing band play jazz into the early hours.
---
The Cable Street Rag Bands Thursday night residency at Jamboree. 1920s and 30s jazz and swing all night long with a jam session from 11:30 - 12:30.
[Get your tickets here](https://www.wegottickets.com/event/598828/)
[More Info](https://www.jamboreevenue.co.uk/events/limehouse-de-reverie-with-the-cable-street-rag-band-27/)
> The Cable Street Rag Bands Thursday night residency at Jamboree. 1920s and 30s jazz and swing all night long with a jam session from 11:30 - 12:30.
>
> [Get your tickets here](https://www.wegottickets.com/event/598828/)
>
> [More Info](https://www.jamboreevenue.co.uk/events/limehouse-de-reverie-with-the-cable-street-rag-band-27/)

View file

@ -13,6 +13,6 @@ location:
summary: A delightful folk music band play in a cocktail bar at the national portrait gallery.
---
Hidden behind a secret entrance on Charing Cross Road, Larrys is our brand-new underground cocktail bar located in the historic vaults of the National Portrait Gallery. Originally built as coal storage in 1896, the spectacular exposed brick space has been transformed offering a slice of elegance deep into the evening (seven days a week), just a short stroll from Covent Garden and Trafalgar Square. Sip on classic cocktails and dine on lavish bar snacks, amidst over 100 portraits of the famous faces of Londons West End.
[More Info](https://www.daisygreenfood.com/location-larrys)
> Hidden behind a secret entrance on Charing Cross Road, Larrys is our brand-new underground cocktail bar located in the historic vaults of the National Portrait Gallery. Originally built as coal storage in 1896, the spectacular exposed brick space has been transformed offering a slice of elegance deep into the evening (seven days a week), just a short stroll from Covent Garden and Trafalgar Square. Sip on classic cocktails and dine on lavish bar snacks, amidst over 100 portraits of the famous faces of Londons West End.
>
> [More Info](https://www.daisygreenfood.com/location-larrys)

View file

@ -14,4 +14,4 @@ summary: Short talks about interesting things.
attending: true
---
Short talks about interesting things. Same old same old.
> Short talks about interesting things. Same old same old.

View file

@ -11,12 +11,13 @@ location:
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]
---
Join us for an early evening sneak peek at the archives related to the radical left.
Drop in to see some of our flagship collections on the theme of the early development of the British Left. On display will be items from anti-fascist activism, the Independent Labour Party, the Social Democratic Federation, anarchism, strikes, protests, and much more!
You can also learn more from our friendly team of curators and archivists who will be on hand to answer any questions and talk more about using archives and special collections in your teaching, research or for personal interest.
Book a place to register your interest and receive reminders about the day or just drop in and stay as long as you like!
> Join us for an early evening sneak peek at the archives related to the radical left.
>
> Drop in to see some of our flagship collections on the theme of the early development of the British Left. On display will be items from anti-fascist activism, the Independent Labour Party, the Social Democratic Federation, anarchism, strikes, protests, and much more!
>
> You can also learn more from our friendly team of curators and archivists who will be on hand to answer any questions and talk more about using archives and special collections in your teaching, research or for personal interest.
>
> Book a place to register your interest and receive reminders about the day or just drop in and stay as long as you like!

3
data/friends/jp.yaml Normal file
View file

@ -0,0 +1,3 @@
name: JP
site: https://www.byjp.me
xfn: me

View file

@ -15,6 +15,7 @@
{{ range $page := .Data.Pages }}
{{ range $page.Params.timings }}
{{ $event := dict "Title" $page.Title "Page" $page.Page "Date" (time.AsTime .starts) }}
{{ if $event.Date.Before time.Now }}{{ continue }}{{ end }}
{{ $bundle := $event.Date.Format "Jan 2006" }}
{{ $events = merge $events (dict $bundle (sort ((index $events $bundle) | append $event) "Date" "asc")) }}
{{ end }}
@ -27,7 +28,7 @@
<ul class="posts-list">
{{ range $bundledEvents }}
<li class="post-item">
<a href="{{.Page.Permalink}}">
<a href="{{.Page.RelPermalink}}">
{{ if .Page.Params.emoji }}<span class="post-emoji">{{ .Page.Params.emoji }}</span>{{ end }}
<span class="post-title">{{.Page.Title}}</span>
<span class="post-day">

View file

@ -15,8 +15,19 @@ 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" }}
ATTENDEE;CUTYPE=INDIVIDUAL;CN={{site.Author.name}};
PARTSTAT={{ if .Page.Params.attending }}ACCEPTED{{else}}NEEDS-ACTION{{end}}:MAILTO:{{ site.Author.email}}
{{- $attendees := .Page.Params.attending -}}
{{- $jpDone := false -}}
{{- if eq .Page.Params.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:VEVENT
{{- end }}
END:VCALENDAR

View file

@ -1,39 +1,11 @@
{{ define "main" }}
<main class="post h-entry">
<div class="post-info">
{{ $dateType := "published" }}
{{ $date := .Date}}
{{ if not .Date }}
{{ $date = .Lastmod }}
{{ $dateType := "updated" }}
{{ end }}
{{ if .Lastmod }}
<p>
<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-calendar">
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
<line x1="16" y1="2" x2="16" y2="6"></line>
<line x1="8" y1="2" x2="8" y2="6"></line>
<line x1="3" y1="10" x2="21" y2="10"></line>
</svg>
{{ if eq $dateType "updated" }}Last updated {{ end }}
{{ if eq $dateType "published" }}Published on {{ end }}
{{ partial "year-relative-date.html" $date }}
</p>
{{ end }}
<p class="reading-time">
<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-clock">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
{{ i18n "readingTime" .Page.ReadingTime }}
</p>
<p class="author h-card hidden" aria-hidden="true">
<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"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>
<a href="{{ .Site.BaseURL | absURL }}" rel="author" class="p-author u-url">{{ .Site.Author.name }}</a>
</p>
</div>
{{ $timing := index .Params.timings 0 -}}
{{ range .Params.timings -}}
{{ if (time.AsTime .starts).Before time.Now -}}
{{ $timing = . -}}
{{ end -}}
{{ end -}}
<article>
<hgroup class="post-title">
@ -41,9 +13,6 @@
{{ with .Params.emoji }}<span data-emoji="{{.}}"></span>{{end}}
<a href="{{ .Permalink }}" class="noaccent u-url">{{ .Title | markdownify }}</a>
</h1>
{{ with .Params.Subtitle }}
<h2 class="post-subtitle">{{ . | markdownify }}</h2>
{{ end }}
</hgroup>
{{ with .Summary }}
@ -60,29 +29,6 @@
</figure>
{{ end }}
{{- if .Params.toc }}
<hr />
<aside id="toc">
<div class="toc-title">{{ i18n "tableOfContents" }}</div>
{{ .TableOfContents }}
</aside>
<hr />
{{- end }}
{{ if .Params.Audio }}
<div class="post-audio">
<audio controls>
<source src="{{ .Params.Audio }}">
</audio>
</div>
{{ end }}
{{ if .Page.Store.Get "hasSpoilers" }}
<blockquote class="spoiler-explainer">
{{ partial "svg.html" (dict "name" "hidden") }} This post contains spoilers, but they're hidden by default.
</blockquote>
{{ end }}
<div class="post-content e-content" data-pagefind-body data-pagefind-filter="type:{{.Type | title}}">
{{ .Content }}
</div>
@ -90,29 +36,9 @@
<hr />
{{ if ne .Type "site-infra" }}
<div class="post-info">
{{ partial "tags.html" .Params.tags }}
{{ partial "series-tags.html" . }}
<p>
<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-file-text">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
<polyline points="14 2 14 8 20 8"></polyline>
<line x1="16" y1="13" x2="8" y2="13"></line>
<line x1="16" y1="17" x2="8" y2="17"></line>
<polyline points="10 9 9 9 8 9"></polyline>
</svg>
{{ i18n "wordCount" .Page.WordCount }}
</p>
{{ if in .Params.tags "from-tumblr" }}
<p>
<svg class="feather" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="-11 -11 282 282"><path fill="none" stroke="currentColor" stroke-width="22" d="M210.86 197.54a5 5 0 0 0-5.12.23c-11.62 7.64-23.4 11.5-35.02 11.5-6.24 0-11.6-1.39-16.41-4.27-3.27-1.93-6.31-5.32-7.4-8.26-1.06-2.8-1.05-10.33-1.03-20.75v-63.54h52.8a5 5 0 0 0 5-5V62.8a5 5 0 0 0-5-5h-52.8V5a5 5 0 0 0-5-5h-35.56a5 5 0 0 0-4.97 4.4c-1.48 12.23-4.25 22.38-8.24 30.2a63.66 63.66 0 0 1-15.65 19.92c-5.2 4.44-14.12 8.73-26.5 12.77a5 5 0 0 0-3.44 4.75v35.41a5 5 0 0 0 5 5h28.95v82.67c0 12.18 1.3 21.34 3.95 28.02 2.71 6.79 7.52 13.18 14.3 19 6.68 5.71 14.8 10.18 24.16 13.3 9.09 2.96 16.32 4.56 28.51 4.56 10.31 0 20.14-1.07 29.22-3.18 8.92-2.08 19.01-5.76 30-10.93a5 5 0 0 0 2.88-4.53v-39.41a5 5 0 0 0-2.63-4.4z"/></svg>
From <a href="/tags/from-tumblr">tumblr archive</a>
</p>
{{ end }}
{{ if .Lastmod }}
<p>
<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-calendar">
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
@ -120,15 +46,34 @@
<line x1="8" y1="2" x2="8" y2="6"></line>
<line x1="3" y1="10" x2="21" y2="10"></line>
</svg>
<date datetime="{{ dateFormat "2006-01-02T15:04:05-0700" $date }}" class="dt-{{ $dateType }}" title="{{ $dateType | title }} on {{ dateFormat "Monday Jan 2 2006 at 03:04 MST" $date }}" data-pagefind-sort="date">
{{ if .Site.Params.dateformNumTime }}
{{ dateFormat .Site.Params.dateformNumTime $date }}
On {{ partial "year-relative-date.html" (time.AsTime $timing.starts) }}
</p>
<p>
<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-clock">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
{{ $starts := time.AsTime $timing.starts }}
{{ $duration := time.ParseDuration ((strings.Substr $timing.duration 2) | strings.ToLower) }}
From {{ $starts.Format "15:04" }} until {{ $starts.Add $duration | dateFormat "15:04 (MST)" }}
</p>
{{ if .Params.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
{{ else }}
{{ dateFormat "2006-01-02 15:04" $date }}
{{ $count := len .Params.attending}}
{{ range $i, $attendee := .Params.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
{{ end }}
</date>
</p>
{{ end }}
</div>
<hr />
@ -137,20 +82,5 @@
</div>
{{ partial "pagination-single.html" . }}
{{ end }}
{{ if .Page.Store.Get "hasMermaid" }}
<script src="/js/mermaid.js"></script>
<script>
// TODO: Render mermaid server side
function initMermaid() {
const dark = (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
mermaid.initialize({ startOnLoad: true, theme: dark ? 'dark' : 'neutral' });
}
// https://github.com/mermaid-js/mermaid/issues/1945
// window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', initMermaid);
initMermaid();
</script>
{{ end }}
</main>
{{ end }}

View file

@ -0,0 +1,6 @@
{{ $parts := strings.Split . "." }}
{{ with index site.Data.friends (index $parts 0) }}
<span class="h-card{{ range collections.Last (sub (len $parts) 1) $parts }} {{.}}{{ end }}"><a href="{{.site}}" rel="{{.xfn}}" class="u-url p-name" target="_blank">{{.name}}</a></span>
{{ else }}
{{ errorf "Could not display friend %s" . }}
{{ end }}

View file

@ -1,5 +1 @@
{{ with index .Site.Data.friends (.Get 0) }}
<span class="h-card"><a href="{{.site}}" rel="{{.xfn}}" class="u-url p-name" target="_blank">{{.name}}</a></span>
{{ else }}
{{ errorf "Could not display friend %s" (.Get 0) }}
{{ end }}
{{ partial "friend.html" (.Get 0) }}

View file

@ -1,4 +1,4 @@
Add single.html for Calendar
Add single.html for Calendar {cm:2023-12-24}
Support repeating calendar events
Handle long lines {cm:2023-12-24}
Ensure ICS files have CRLF endings {cm:2023-12-22}