mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-25 20:11:37 +01:00
Use image partial to render figure shortcut
This commit is contained in:
parent
38a7aa3dee
commit
b2ae28feff
@ -5,27 +5,6 @@
|
|||||||
{{- if .Get "link" -}}
|
{{- if .Get "link" -}}
|
||||||
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<img loading="lazy" src="{{ .Get "src" }}{{- if eq (.Get "align") "center" }}#center{{- end }}"
|
{{ partial "image.html" (merge .Params (dict "page" .Page "lazy" true)) }}
|
||||||
{{- if or (.Get "alt") (.Get "caption") }}
|
|
||||||
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
|
|
||||||
{{- end -}}
|
|
||||||
{{- with .Get "width" }} width="{{ . }}"{{ end -}}
|
|
||||||
{{- with .Get "height" }} height="{{ . }}"{{ end -}}
|
|
||||||
/> <!-- Closing img tag -->
|
|
||||||
{{- if .Get "link" }}</a>{{ end -}}
|
{{- if .Get "link" }}</a>{{ end -}}
|
||||||
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
|
|
||||||
<figcaption>
|
|
||||||
{{ with (.Get "title") -}}
|
|
||||||
{{ . }}
|
|
||||||
{{- end -}}
|
|
||||||
{{- if or (.Get "caption") (.Get "attr") -}}<p>
|
|
||||||
{{- .Get "caption" | markdownify -}}
|
|
||||||
{{- with .Get "attrlink" }}
|
|
||||||
<a href="{{ . }}">
|
|
||||||
{{- end -}}
|
|
||||||
{{- .Get "attr" | markdownify -}}
|
|
||||||
{{- if .Get "attrlink" }}</a>{{ end }}</p>
|
|
||||||
{{- end }}
|
|
||||||
</figcaption>
|
|
||||||
{{- end }}
|
|
||||||
</figure>
|
</figure>
|
||||||
|
Loading…
Reference in New Issue
Block a user