40C3: tours, schedule data, tour map and calendar entries
- tour-map shortcode: Leaflet map of the tour locations with routes from the Congress, from the map/tours sections of data/schedule/<event>.yaml; Leaflet and the OSMIC, Maki and Temaki icon sets vendored; 39C3 uMap data converted. - calendar shortcode: per tour date, a pill with an .ics download (iCalendar) and a Google Calendar link; Font Awesome Free vendored, fa-icon partial. - README sections for the calendar and tour map shortcodes and the map data.
This commit is contained in:
parent
89a0e7e353
commit
821290616a
3864 changed files with 15276 additions and 18 deletions
10
layouts/_partials/fa-icon.html
Normal file
10
layouts/_partials/fa-icon.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{{- /*
|
||||
A Font Awesome icon as inline SVG, decorative (hidden from screen readers) and drawn in the
|
||||
current text colour. Param: the icon as "style/name", e.g. "regular/calendar-plus"; the files
|
||||
are in assets/vendor/fontawesome/. The SVG keeps its attribution comment (CC BY 4.0).
|
||||
*/ -}}
|
||||
{{- with resources.Get (printf "vendor/fontawesome/%s.svg" .) -}}
|
||||
{{- replace .Content "<svg " `<svg class="fa-icon" aria-hidden="true" focusable="false" ` 1 | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- errorf "fa-icon: no icon %q in assets/vendor/fontawesome/" . -}}
|
||||
{{- end -}}
|
||||
22
layouts/_partials/ics-line.html
Normal file
22
layouts/_partials/ics-line.html
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{{- /*
|
||||
One iCalendar (RFC 5545) content line: "NAME:value" plus CRLF, folded so that no line is
|
||||
longer than 75 bytes (continuation lines start with a space). Params: name, value, text
|
||||
(true to escape the value as TEXT: backslash, semicolon, comma and newlines).
|
||||
*/ -}}
|
||||
{{- $value := .value | default "" -}}
|
||||
{{- if .text -}}
|
||||
{{- $value = $value | replaceRE `\\` `\\` | replaceRE `;` `\;` | replaceRE `,` `\,` | replaceRE `\r?\n` `\n` -}}
|
||||
{{- end -}}
|
||||
{{- $out := "" -}}
|
||||
{{- $line := "" -}}
|
||||
{{- $bytes := 0 -}}
|
||||
{{- range split (printf "%s:%s" .name $value) "" -}}
|
||||
{{- if gt (add $bytes (len .)) 75 -}}
|
||||
{{- $out = printf "%s%s\r\n " $out $line -}}
|
||||
{{- $line = "" -}}
|
||||
{{- $bytes = 1 -}}
|
||||
{{- end -}}
|
||||
{{- $line = printf "%s%s" $line . -}}
|
||||
{{- $bytes = add $bytes (len .) -}}
|
||||
{{- end -}}
|
||||
{{- return printf "%s%s\r\n" $out $line -}}
|
||||
20
layouts/_partials/tour-map-icon.html
Normal file
20
layouts/_partials/tour-map-icon.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{{- /*
|
||||
Returns a map icon as a data: URI, or "" if there is none by that name.
|
||||
The name is looked up in the vendored icon sets in assets/vendor/icons/, in the order
|
||||
osmic, maki, temaki; a prefix like "maki:garden" picks the set.
|
||||
*/ -}}
|
||||
{{- $name := . -}}
|
||||
{{- $sets := slice "osmic" "maki" "temaki" -}}
|
||||
{{- with findRESubmatch `^(osmic|maki|temaki):(.+)$` . 1 -}}
|
||||
{{- $sets = slice (index . 0 1) -}}
|
||||
{{- $name = index . 0 2 -}}
|
||||
{{- end -}}
|
||||
{{- $uri := "" -}}
|
||||
{{- range $sets -}}
|
||||
{{- if not $uri -}}
|
||||
{{- with resources.Get (printf "vendor/icons/%s/%s.svg" . $name) -}}
|
||||
{{- $uri = printf "data:image/svg+xml;base64,%s" ((. | minify).Content | base64Encode) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $uri -}}
|
||||
10
layouts/_partials/tour-map-script.html
Normal file
10
layouts/_partials/tour-map-script.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{{- /* Leaflet and the script for the tour-map shortcode, included by the base templates on pages that use it. */ -}}
|
||||
{{- with resources.Get "vendor/leaflet/leaflet.css" | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{- end }}
|
||||
{{- with resources.Get "vendor/leaflet/leaflet.js" | fingerprint }}
|
||||
<script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" defer></script>
|
||||
{{- end }}
|
||||
{{- with resources.Get "js/tour-map.js" | minify | fingerprint }}
|
||||
<script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" defer></script>
|
||||
{{- end }}
|
||||
Loading…
Reference in a new issue