From 2b9af7561bed6d2ad882af6dd04aa9f987d6cba6 Mon Sep 17 00:00:00 2001 From: paspo Date: Sat, 27 Jul 2024 22:59:43 +0000 Subject: [PATCH] didascalie immagini (con supporto markdown) (#156) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ho messo le didascalie solo in [questa pagina](http://localhost:1313/it/linuxday/2023/linux-day-2023-agenda/) per ora. Viene circa così: ![immagine](/attachments/acfa310e-eb01-4abd-9cf3-c85ee6a40ad4) ![immagine](/attachments/902ef1ea-2bd3-48c5-9186-30a02997a066) Reviewed-on: https://git.libreschool.org/BgLUG/bglug.it/pulls/156 Co-authored-by: paspo Co-committed-by: paspo --- assets/sass/custom.scss | 11 +++++++++++ content/linuxday/2023/agenda/index.it.md | 6 ++++-- layouts/_default/_markup/render-image.html | 12 +++++++++++- layouts/_default/single.html | 9 ++++++--- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/assets/sass/custom.scss b/assets/sass/custom.scss index a5e9f69..5afa16d 100644 --- a/assets/sass/custom.scss +++ b/assets/sass/custom.scss @@ -47,3 +47,14 @@ max-width: 100% } } + +figure { + display: inline-block; +} + +figcaption { + width: 100%; + text-align: center; + font-size: smaller; + font-style: italic; +} diff --git a/content/linuxday/2023/agenda/index.it.md b/content/linuxday/2023/agenda/index.it.md index 89258dc..fc7d947 100644 --- a/content/linuxday/2023/agenda/index.it.md +++ b/content/linuxday/2023/agenda/index.it.md @@ -5,6 +5,8 @@ type: post date: 2023-10-24T16:37:38+00:00 slug: linux-day-2023-agenda image: LDbergamo-2023-banner.png +image_alt: Linuxday il 28 ottobre 2023 presso Bergamo Science Center +image_caption: "Image credits: [BgLUG](https://bglug.it 'Bergamo Linux Users Group website')" categories: - News --- @@ -13,10 +15,10 @@ Ecco l'agenda del LinuxDay '23. [Iscriviti su EVENTBRITE](https://www.eventbrite.it/e/biglietti-bglug-linuxday-23-744247924577?aff=oddtdtcreator). -![Locandina Linux Day Bergamo 2023](LDbergamo-2023-3.png) +![Locandina Linux Day Bergamo 2023](LDbergamo-2023-3.png "Image credits: [BgLUG](https://bglug.it 'Bergamo Linux Users Group website')") La lettura di **Ada&Zangemann** si svolgerà al [FabLab Bergamo APS in via M.Gavazzeni 3](https://www.openstreetmap.org/node/4712453185), poco lontano dall'evento principale. -![2Ada & Zangemann](ADA-E-ZAG-3.gif) +![2Ada & Zangemann](ADA-E-ZAG-3.gif "Image credits: [BgLUG](https://bglug.it 'Bergamo Linux Users Group website')") [Link canva](https://tiny.cc/ada-zangemann). diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 89380d5..8f81634 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,5 +1,8 @@ +
{{- $u := urls.Parse .Destination -}} {{- $src := $u.String -}} +{{- $figcaption := .Title | markdownify -}} +{{- $captionWidth := 0 -}} {{- if not $u.IsAbs -}} {{- $path := strings.TrimPrefix "./" $u.Path }} {{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}} @@ -14,13 +17,20 @@ {{- with $u.Fragment -}} {{- $src = printf "%s#%s" $src . -}} {{- end -}} + {{- $captionWidth = .Width -}} {{- end -}} {{- end -}} {{- $attributes := merge .Attributes (dict "alt" .Text "src" $src "title" (.Title | transform.HTMLEscape)) -}} - + {{- with $figcaption -}} +
{{- . -}}
+ {{- end -}} +
{{- /**/ -}} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 66176bd..0a62559 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -25,7 +25,7 @@ {{- $img = .Page.Resources.GetMatch .Params.featured -}} {{- end -}} - +
{{- if in $rasters $img.MediaType.SubType -}} {{- if gt $img.Height $maxHeight -}} {{- $img = $img.Resize (printf "x%d webp q50" $maxHeight) -}} @@ -33,8 +33,11 @@ {{ .Params.image_alt }} {{ else }} {{ .Params.image_alt }} - {{ end }} - + {{- end -}} + {{- with .Params.image_caption -}} +
{{- . | markdownify -}}
+ {{- end -}} +
{{ end }} {{- .Content }}