Support talks iCal output

This commit is contained in:
Vojtěch Káně 2020-11-10 20:28:28 +01:00
parent bd4ddefff3
commit 0fcc265bb9
9 changed files with 69 additions and 2 deletions

View File

@ -11,6 +11,10 @@ menu:
landing:
weight: 4
title: "<patek-logo title='Talks' subtitle='Pátek'>Talks</patek-logo>"
cascade:
outputs:
- HTML
- Calendar
---
Dle známého českého přísloví *„Kdo umí, umí, kdo neumí, učí.“* si členové, kteří vědí něco, co ostatní neví, připravují jednou za čas přednášky o tématech, která jim připadají zajímavá. Vzhledem k tomu, že většina starších členů Pátku jsou skalní informatici, se většina přednášek ubírá tímto směrem, avšak kdo má odvahu, může se jim postavit se svým tématem.

View File

@ -11,6 +11,10 @@ menu:
landing:
weight: 4
title: "<patek-logo title='Talks' subtitle='Pátek'>Talks</patek-logo>"
cascade:
outputs:
- HTML
- Calendar
---
In the spirit of a known Czech saying, that can be roughly translated to *"Who is good at something does it, who is bad at something teaches it."* students, who know something the others don't, prepare talks about topics they consider interesting. Because most members are conservative computer scientists, most these talks follow this direction, but if there is anyone brave enough, they can stand up to them with their topics.

View File

@ -316,6 +316,12 @@ patek-logo {
// To make the color constrast enought with white to pass the WCAG AA requirements
color: #737373 !important;
}
.rel-alternate-buttons {
display: flex;
flex-direction: row-reverse;
}
// /Custom styles
.patek-logo-top {

View File

@ -0,0 +1,18 @@
{{- /* Note this file has CRLF line endings as required by the specs */ -}}
{{- /* replace does not support piping */ -}}
{{- $escaped := replace (replace (replace (replace . "\\" "\\\\") "\n" "\\n") "," "\\,") ";" "\\;" -}}
{{- $escapedLen := strings.RuneCount $escaped -}}
{{- $lineLen := 60 -}}
{{- $parts := (div $escapedLen $lineLen) -}}
{{- if (not (modBool $escapedLen $lineLen)) -}}
{{- $parts = (add $parts 1) -}}
{{- end -}}
{{- /* print the string by parts of at most 75 chars as required by the specs */ -}}
{{- range (seq (sub $parts 0)) -}}
{{- if (eq . 1) -}}
{{- substr $escaped (mul (sub . 1) $lineLen) $lineLen -}}
{{- else }}{{- /* the leading whitespace is important here */}}
{{ substr $escaped (mul (sub . 1) $lineLen) $lineLen -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,14 @@
{{- /* Note this file has CRLF line endings as required by the specs */ -}}
BEGIN:VEVENT
UID:{{ partial "icalEscape.ics" .Permalink }}
CREATED:{{ dateFormat "20060102T150405Z" .Date.UTC }}
DTSTAMP:{{ dateFormat "20060102T150405Z" (now).UTC }}
SUMMARY:{{ .Title | plainify | partial "icalEscape.ics" }}
DESCRIPTION:{{ printf "%s %s" (.Content | plainify | truncate 200) .Permalink | partial "icalEscape.ics" }}
DTSTART:{{ dateFormat "20060102T150405Z" (time .Params.When).UTC }}
DTEND:{{ $length := 30 -}}
{{- with .Params.Length -}}
{{ $length = (int .) }}
{{- end -}}
{{- dateFormat "20060102T150405Z" (time (add (time .Params.When).Unix (mul $length 60))).UTC }}
END:VEVENT

View File

@ -1,7 +1,7 @@
<div class="pageHeader">
<h2 class="title pageTitle"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<p class="has-text-grey">{{- T "published" -}}:&nbsp;<time datetime="{{ .PublishDate.Format "2006-01-02T15:04:05.000-0700" }}">{{ .PublishDate.Format "02.01.2006 15:04" }}</time></p>
<p class="">{{- T "talks-when" -}}:&nbsp;<time datetime="{{ dateFormat "2006-01-02T15:04:05.000-0700" .Params.when }}">{{ dateFormat "02.01.2006 15:04" .Params.when }}</time></p>
<p class="">{{- T "talks-when" -}}:&nbsp;<time datetime="{{ dateFormat "2006-01-02T15:04:05.000-0700" .Params.when }}">{{ dateFormat "02.01.2006 15:04" .Params.when }}</time> <a rel="alternate" href="{{ (.OutputFormats.Get "Calendar").Permalink | safeURL }}"><span class="icon"><i class="fas fa-calendar-alt"></i></span></a></p>
<p class="">
{{- T "presenter" -}}: {{ range .Params.authors }}{{ with $.Site.GetPage (printf "authors/%s" .) }}<a class="separateWithCommas" href="{{ .Permalink }}">{{ .Title }}</a>{{ end }}{{ end }}
</p>

View File

@ -6,7 +6,12 @@
<h3 class="title">{{ T "talks-paginator-heading" }}:</h3>
{{ $baseUrl := .Site.BaseURL }}
{{ $paginator := .Paginate ((.Pages.ByParam "when").Reverse) }}
{{ partial "paginator-buttons.html" $paginator }}
<div class="is-flex" style="justify-content: space-between;">
{{ partial "paginator-buttons.html" $paginator }}
<div class="rel-alternate-buttons">
<a rel="alternate" href="{{ (.OutputFormats.Get "Calendar").Permalink | safeURL }}"><span class="icon is-medium"><i class="fas fa-2x fa-calendar-alt"></i></span></a>
</div>
</div>
{{ range $paginator.Pages }}
<div class="box">
<div class="pageHeaderContainer">

View File

@ -0,0 +1,9 @@
{{- /* Note this file has CRLF line endings as required by the specs */ -}}
BEGIN:VCALENDAR
VERSION:2.0
PRODID:gohugo
CALSCALE:GREGORIAN
{{ range .RegularPages -}}
{{ partial "talkIcal.ics" . -}}
{{- end -}}
END:VCALENDAR

View File

@ -0,0 +1,7 @@
{{- /* Note this file has CRLF line endings as required by the specs */ -}}
BEGIN:VCALENDAR
VERSION:2.0
PRODID:gohugo
CALSCALE:GREGORIAN
{{ partial "talkIcal.ics" . -}}
END:VCALENDAR