Merge branch 'vojta001/talks-cal' into 'master'

Support talks iCal output

See merge request patek-devs/patek.cz!51
This commit was merged in pull request #72.
This commit is contained in:
Vojtěch Káně
2020-11-13 15:00:15 +00:00
9 changed files with 71 additions and 2 deletions
+6
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 {
@@ -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 -}}
@@ -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
@@ -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>
+6 -1
View File
@@ -5,7 +5,12 @@
</div>
<h3 class="title">{{ T "talks-paginator-heading" }}:</h3>
{{ $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">
+9
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
+7
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