diff options
author | Kaushal Modi <kaushal.modi@gmail.com> | 2018-10-02 13:56:31 -0400 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-10-03 09:55:53 +0300 |
commit | c5279064df9664d6b2ad277e2fba1e4bb3b0f4be (patch) | |
tree | 46daaa284dbea12f9b2c3c5303c181fde107d6a0 /tpl/tplimpl/embedded/templates | |
parent | 152cffb13a237651c2277dc6c2c9e4172d58b3df (diff) |
Re-organize the figure shortcode for better readability
Diffstat (limited to 'tpl/tplimpl/embedded/templates')
-rw-r--r-- | tpl/tplimpl/embedded/templates/shortcodes/figure.html | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/figure.html b/tpl/tplimpl/embedded/templates/shortcodes/figure.html index 258d25bfe..9fa847eaa 100644 --- a/tpl/tplimpl/embedded/templates/shortcodes/figure.html +++ b/tpl/tplimpl/embedded/templates/shortcodes/figure.html @@ -1,18 +1,28 @@ -<!-- image --> -<figure{{ with .Get "class" }} class="{{.}}"{{ end }}> - {{ if .Get "link"}}<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>{{ end }} - <img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}{{ with .Get "height" }}height="{{.}}" {{ end }}/> - {{ if .Get "link"}}</a>{{ end }} - {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} - <figcaption>{{ if isset .Params "title" }} - <h4>{{ .Get "title" }}</h4>{{ end }} - {{ if or (.Get "caption") (.Get "attr")}}<p> - {{ .Get "caption" }} - {{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }} - {{ .Get "attr" }} - {{ if .Get "attrlink"}}</a> {{ end }} - </p> {{ end }} - </figcaption> - {{ end }} +<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}> + {{- if .Get "link" -}} + <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}> + {{- end }} + <img src="{{ .Get "src" }}" + {{- if or (.Get "alt") (.Get "caption") }} + alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" }}{{ end }}" + {{- end -}} + {{- with .Get "width" }} width="{{ . }}"{{ end -}} + {{- with .Get "height" }} height="{{ . }}"{{ end -}} + /> <!-- Closing img tag --> + {{- if .Get "link" }}</a>{{ end -}} + {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} + <figcaption> + {{ with (.Get "title") -}} + <h4>{{ . }}</h4> + {{- end -}} + {{- if or (.Get "caption") (.Get "attr") -}}<p> + {{- .Get "caption" -}} + {{- with .Get "attrlink" -}} + <a href="{{ . }}"> + {{- end -}} + {{- .Get "attr" -}} + {{- if .Get "attrlink" }}</a>{{ end }}</p> + {{- end }} + </figcaption> + {{- end }} </figure> -<!-- image -->
\ No newline at end of file |