revises shortcode <fig>
This commit is contained in:
parent
78d69f7bb5
commit
f6b486f24d
1 changed files with 31 additions and 7 deletions
|
@ -4,16 +4,40 @@
|
||||||
{{ else if .Get "alt" }}
|
{{ else if .Get "alt" }}
|
||||||
{{ $fig.Set "caption" (.Get "alt") }}
|
{{ $fig.Set "caption" (.Get "alt") }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
<!-- resolve absolute image path -->
|
||||||
|
{{ $permalink := $.Page.Permalink }}
|
||||||
|
{{ $image := .Get "src" }}
|
||||||
|
{{ $image_link_absolute := (findRE "^/" $image) }}
|
||||||
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
|
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
|
||||||
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
|
{{ if .Get "link"}}
|
||||||
<img src="{{ .Get "src" }}"
|
<a href="{{ .Get "link" }}"
|
||||||
{{ with $.Scratch.Get "caption" }}alt="{{ . }}"{{ end }}
|
{{ with .Get "target" }} target="{{ . }}"{{ end }}
|
||||||
|
{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||||
|
{{ end }}
|
||||||
|
<img
|
||||||
|
{{ if $image_link_absolute }}
|
||||||
|
src="{{ $image | absURL }}"
|
||||||
|
{{ else }}
|
||||||
|
src="{{ (printf "%s%s" $permalink $image) }}"
|
||||||
|
{{ end }}
|
||||||
|
{{ if .Get "alt" }}alt="{{ .Get "alt" | markdownify | plainify }}"
|
||||||
|
{{- else if .Get "caption" }}alt="{{ .Get "caption" | markdownify | plainify }}"
|
||||||
|
{{- end }}
|
||||||
{{ with .Get "align" }}align="{{ . }}"{{ end }}
|
{{ with .Get "align" }}align="{{ . }}"{{ end }}
|
||||||
{{ with .Get "width" }}width="{{ . }}"{{ end }} />
|
width="{{ .Get "width" | default "100%"}}"
|
||||||
{{ with .Get "link"}}</a>{{ end }}
|
{{ with .Get "height" }}width="{{ . }}"{{ end }} />
|
||||||
{{ with ($fig.Get "caption") }}
|
{{ if .Get "link"}}</a>{{ end }}
|
||||||
|
<!-- caption and attr-->
|
||||||
|
{{ if ($fig.Get "caption") }}
|
||||||
<figcaption>
|
<figcaption>
|
||||||
<span class="img--caption">Figure {{ $.Page.Scratch.Get "fig" }}. {{ . }}</span>
|
<span class="img--caption">
|
||||||
|
Figure {{ $.Page.Scratch.Get "fig" }}. {{ $fig.Get "caption" | markdownify | plainify }}
|
||||||
|
{{ if .Get "attr" }}
|
||||||
|
[{{- with .Get "attrlink"}}<a href="{{ . | markdownify }}">{{ end -}}
|
||||||
|
{{ .Get "attr" | markdownify }}
|
||||||
|
{{- if .Get "attrlink"}}</a>{{- end }}]
|
||||||
|
{{ end }}
|
||||||
|
</span>
|
||||||
</figcaption>
|
</figcaption>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</figure>
|
</figure>
|
||||||
|
|
Loading…
Reference in a new issue