Merge pull request #1492 from nunocoracao/1112-some-figure-shortcode-attributes-have-no-effect

fixed https://github.com/nunocoracao/blowfish/issues/1112
This commit is contained in:
Nuno Coração 2024-05-26 22:03:37 +01:00 committed by GitHub
commit a0dd73975c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,13 +7,13 @@
{{ $caption := .Get "caption" }}
{{ $href := .Get "href" }}
{{ $class := .Get "class" }}
{{ $target := .Get "target" }}
{{ $target := .Get "target" | default "_blank" }}
{{ $nozoom := .Get "nozoom" | default false }}
{{ if findRE "^https?" $url.Scheme }}
<figure>
<img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
</figure>
{{ with $href }}<a href="{{ . }}" {{ with $target }}target="{{ . }}"{{ end }}>{{ end }}
{{ if findRE "^https?" $url.Scheme }}
<img class="my-0 rounded-md {{ with $nozoom }} nozoom {{ end }}{{ with $class }} {{ . }} {{ end }}" src="{{ $url.String }}" alt="{{ $altText }}" />
{{ else }}
{{ $resource := "" }}
{{ if $.Page.Resources.GetMatch ($url.String) }}
@ -22,17 +22,15 @@
{{ $resource = resources.Get ($url.String) }}
{{ end }}
{{ with $resource }}
<figure {{ with $class }}class="{{ . }}"{{ end }}>
{{ with $href }}<a href="{{ . }}" {{ with $target }}target="{{ . }}"{{ end }}>{{ end }}
{{ if $disableImageOptimization }}
<img
class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}"
class="my-0 rounded-md {{ with $nozoom }} nozoom {{ end }}{{ with $class }} {{ . }} {{ end }}"
src="{{ .RelPermalink }}"
alt="{{ $altText }}"
/>
{{ else }}
<img
class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}"
class="my-0 rounded-md {{ with $nozoom }} nozoom {{ end }}{{ with $class }} {{ . }} {{ end }}"
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
@ -42,14 +40,11 @@
alt="{{ $altText }}"
/>
{{ end }}
{{ if $href }}</a>{{ end }}
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
</figure>
{{ else }}
<figure>
<img class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}" src="{{ $url.String }}" alt="{{ $altText }}" />
<img class="my-0 rounded-md {{ with $nozoom }} nozoom {{ end }}{{ with $class }} {{ . }} {{ end }}" src="{{ $url.String }}" alt="{{ $altText }}" />
{{ end }}
{{ end }}
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
{{ if $href }}</a>{{ end }}
</figure>
{{ end }}
{{ end }}
{{ end }}