dd vendored icons for the tour-map
All checks were successful
/ build (pull_request) Successful in 25s

This commit is contained in:
Stefan Bethke 2026-10-16 20:35:02 +02:00
commit 2c28c050a5
933 changed files with 9891 additions and 22 deletions

View 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 -}}

View file

@ -31,13 +31,18 @@ or {{< tour-map 39c3 >}}.
{{- $directions = $.Page.RenderString (dict "display" "block") . -}}
{{- end -}}
{{- end -}}
{{- $icon := "" -}}
{{- with $tour.icon -}}
{{- $icon = partial "tour-map-icon.html" . -}}
{{- if not $icon }}{{ warnf "tour-map: %s: unknown icon %q for tour %q" $event . $slug }}{{ end -}}
{{- end -}}
{{- $tours = $tours | append (dict
"title" $title
"url" $url
"lat" .lat
"lon" .lon
"color" ($tour.color | default "")
"icon" ($tour.icon | default "")
"icon" $icon
"directions" $directions
"route" ($tour.route | default slice)
) -}}
@ -48,7 +53,12 @@ or {{< tour-map 39c3 >}}.
{{- with $data.map }}{{ with .origin }}{{ with .geo -}}
{{- $name := "" -}}
{{- with $data.map.origin.name }}{{ $name = index . $lang | default (index . $other) }}{{ end -}}
{{- $origin = dict "name" $name "lat" .lat "lon" .lon "icon" ($data.map.origin.icon | default "") -}}
{{- $icon := "" -}}
{{- with $data.map.origin.icon -}}
{{- $icon = partial "tour-map-icon.html" . -}}
{{- if not $icon }}{{ warnf "tour-map: %s: unknown icon %q for the origin" $event . }}{{ end -}}
{{- end -}}
{{- $origin = dict "name" $name "lat" .lat "lon" .lon "icon" $icon -}}
{{- end }}{{ end }}{{ end -}}
{{- if not $tours -}}