1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-27 14:12:09 +00:00

Templates: drop unused class, support img scaling

- The .footnote-ref  class was unused, drop it.
- Support supplying a scale-factor property to the picture shortcode, to
  upscale small images.
This commit is contained in:
Rohan Kumar 2022-04-09 08:54:58 -07:00
parent 41b66d8ceb
commit 8be0fae481
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 10 additions and 3 deletions

View file

@ -7,8 +7,8 @@
{{ $referencesWithHeading := printf `<section role="doc-endnotes" aria-labelledby="note-hd"> {{ $referencesWithHeading := printf `<section role="doc-endnotes" aria-labelledby="note-hd">
<h2 id="note-hd">%s</h2>` ($heading) -}} <h2 id="note-hd">%s</h2>` ($heading) -}}
<!--Remove deprecated DPUB-ARIA role--> <!--Remove deprecated DPUB-ARIA role and unused classes-->
{{ $endnote := `(role="doc-endnote")` }} {{ $endnote := `(role="doc-endnote"|class="footnote-ref")` }}
{{ $noEndnote := printf "" }} {{ $noEndnote := printf "" }}
<!--Add tabindex to all <pre> elements, inc. those that aren't generated by Goldmark--> <!--Add tabindex to all <pre> elements, inc. those that aren't generated by Goldmark-->

View file

@ -8,6 +8,13 @@
{{ $dark_webp := resources.GetMatch (printf "/p/%s_dark.webp" (.Get "name")) -}} {{ $dark_webp := resources.GetMatch (printf "/p/%s_dark.webp" (.Get "name")) -}}
{{ $dark_avif := resources.GetMatch (printf "/p/%s_dark.avif" (.Get "name")) -}} {{ $dark_avif := resources.GetMatch (printf "/p/%s_dark.avif" (.Get "name")) -}}
{{ $dark_jxl := resources.GetMatch (printf "/p/%s_dark.jxl" (.Get "name")) -}} {{ $dark_jxl := resources.GetMatch (printf "/p/%s_dark.jxl" (.Get "name")) -}}
{{- $img_width := $light_png.Width -}}
{{- $img_height := $light_png.Height -}}
{{- with (.Get "sf") -}}
{{- $img_width = (mul $img_width . ) -}}
{{- $img_height = (mul $img_height . ) -}}
{{- end -}}
<picture> <picture>
{{ with $dark_svg -}} {{ with $dark_svg -}}
{{ $dark_svg_src := . | resources.Fingerprint "md5" -}} {{ $dark_svg_src := . | resources.Fingerprint "md5" -}}
@ -73,7 +80,7 @@
srcset="{{ $light_png_src.RelPermalink }}" srcset="{{ $light_png_src.RelPermalink }}"
type="image/png"> type="image/png">
<img <img
width="{{ $light_png.Width }}" height="{{ $light_png.Height }}" width="{{ $img_width }}" height="{{ $img_height }}"
src="{{ $light_png.RelPermalink }}" alt='{{ .Get "alt" }}' src="{{ $light_png.RelPermalink }}" alt='{{ .Get "alt" }}'
decoding="async"> decoding="async">
</picture>{{- /* Strip trailing newline: https://github.com/gohugoio/hugo/issues/1753 */ -}} </picture>{{- /* Strip trailing newline: https://github.com/gohugoio/hugo/issues/1753 */ -}}