diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 55001f32..3e5fdce8 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,29 +1,29 @@ -{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} -{{ $url := urls.Parse .Destination }} -{{ $altText := .Text }} -{{ $caption := .Title }} -{{ if findRE "^https?" $url.Scheme }} +{{- $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} +{{- $url := urls.Parse .Destination }} +{{- $altText := .Text }} +{{- $caption := .Title }} +{{- if findRE "^https?" $url.Scheme }}
{{ $altText }} {{ with $caption }}
{{ . | markdownify }}
{{ end }}
-{{ else }} - {{ $resource := "" }} - {{ if $.Page.Resources.GetMatch ($url.String) }} - {{ $resource = $.Page.Resources.GetMatch ($url.String) }} - {{ else if resources.GetMatch ($url.String) }} - {{ $resource = resources.Get ($url.String) }} - {{ end }} - {{ with $resource }} +{{- else }} + {{- $resource := "" }} + {{- if $.Page.Resources.GetMatch ($url.String) }} + {{- $resource = $.Page.Resources.GetMatch ($url.String) }} + {{- else if resources.GetMatch ($url.String) }} + {{- $resource = resources.Get ($url.String) }} + {{- end }} + {{- with $resource }}
- {{ if or $disableImageOptimization (eq .MediaType.SubType "svg") }} + {{- if or $disableImageOptimization (eq .MediaType.SubType "svg")}} {{ $altText }} - {{ else }} + {{- else }} {{ $altText }} - {{ end }} + {{- end }} {{ with $caption }}
{{ . | markdownify }}
{{ end }}
- {{ else }} + {{- else }}
{{ $altText }} {{ with $caption }}
{{ . | markdownify }}
{{ end }}
- {{ end }} -{{ end }} + {{- end }} +{{- end }} diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index cd881a31..2d951d63 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -2,49 +2,49 @@ {{ if .Get "default" }} {{ template "_internal/shortcodes/figure.html" . }} {{ else }} - {{ $url := urls.Parse (.Get "src") }} - {{ $altText := .Get "alt" }} - {{ $caption := .Get "caption" }} - {{ $href := .Get "href" }} - {{ $class := .Get "class" }} - {{ $target := .Get "target" | default "_blank" }} - {{ $nozoom := .Get "nozoom" | default false }} + {{- $url := urls.Parse (.Get "src") }} + {{- $altText := .Get "alt" }} + {{- $caption := .Get "caption" }} + {{- $href := .Get "href" }} + {{- $class := .Get "class" }} + {{- $target := .Get "target" | default "_blank" }} + {{- $nozoom := .Get "nozoom" | default false -}}
- {{ with $href }}{{ end }} - {{ if findRE "^https?" $url.Scheme }} - {{ $altText }} - {{ else }} - {{ $resource := "" }} - {{ if $.Page.Resources.GetMatch ($url.String) }} - {{ $resource = $.Page.Resources.GetMatch ($url.String) }} - {{ else if resources.GetMatch ($url.String) }} - {{ $resource = resources.Get ($url.String) }} - {{ end }} - {{ with $resource }} - {{ if $disableImageOptimization }} - {{ $altText }} - {{ else }} - {{ $altText }} - {{ end }} - {{ else }} - {{ $altText }} - {{ end }} - {{ end }} - {{ with $caption }}
{{ . | markdownify }}
{{ end }} - {{ if $href }}
{{ end }} + {{- with $href }}{{ end -}} + {{- if findRE "^https?" $url.Scheme }} + {{ $altText }} + {{- else }} + {{- $resource := "" }} + {{- if $.Page.Resources.GetMatch ($url.String) }} + {{- $resource = $.Page.Resources.GetMatch ($url.String) }} + {{- else if resources.GetMatch ($url.String) }} + {{- $resource = resources.Get ($url.String) }} + {{- end }} + {{- with $resource }} + {{- if or $disableImageOptimization (eq .MediaType.SubType "svg")}} + {{ $altText }} + {{- else }} + {{ $altText }} + {{- end }} + {{- else }} + {{ $altText }} + {{- end }} + {{- end }} + {{- with $caption }}
{{ . | markdownify }}
{{ end }} + {{- if $href }}
{{ end }}
-{{ end }} +{{- end -}}