Add float param to shortcodes
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
{{ $caption := .caption | markdownify }}
|
||||
{{ $content := .content | markdownify }}
|
||||
{{ $float := .float }}
|
||||
|
||||
<figure class="align-items-center d-flex flex-column justify-content-center paige-figure">
|
||||
{{ $margins := "" }}
|
||||
{{ if $float }}
|
||||
{{ if eq $float "start" }}
|
||||
{{ $margins = "me-4" }}
|
||||
{{ else if eq $float "end" }}
|
||||
{{ $margins = "ms-4" }}
|
||||
{{ else }}
|
||||
{{ errorf "invalid float: %q" $float }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<figure class="align-items-center d-flex flex-column {{ with $float }} float-{{ . }} {{ end }} justify-content-center {{ with $margins }} {{ . }} {{ end }} paige-figure">
|
||||
<div class="{{ if $caption }} mb-2 {{ end }} mw-100">{{ $content }}</div>
|
||||
{{ with $caption }}
|
||||
<figcaption class="figure-caption">{{ . }}</figcaption>
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{{ $alt := .alt }}
|
||||
{{ $caption := .caption }}
|
||||
{{ $float := .float }}
|
||||
{{ $height := .height }}
|
||||
{{ $link := .link }}
|
||||
{{ $maxheight := .maxheight }}
|
||||
@@ -21,16 +22,12 @@
|
||||
{{ $content := partial "paige/img.html" (dict
|
||||
"alt" $alt
|
||||
"class" $class
|
||||
"height" $height
|
||||
"maxheight" $maxheight
|
||||
"maxwidth" $maxwidth
|
||||
"method" $method
|
||||
"options" $options
|
||||
"page" $page
|
||||
"resource" $resource
|
||||
"src" $src
|
||||
"title" $title
|
||||
"width" $width
|
||||
) }}
|
||||
|
||||
{{ if $link }}
|
||||
@@ -40,9 +37,83 @@
|
||||
) }}
|
||||
{{ end }}
|
||||
|
||||
<figure class="{{ if $table }} d-table mb-0 {{ end }} paige-figure text-center">
|
||||
{{ $style := "" }}
|
||||
|
||||
{{ if $height }}
|
||||
{{ with printf "height: %v" $height }}
|
||||
{{ if $style }}
|
||||
{{ $style = printf "%v; %v" $style . }}
|
||||
{{ else }}
|
||||
{{ $style = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $maxheight }}
|
||||
{{ with printf "max-height: %v" $maxheight }}
|
||||
{{ if $style }}
|
||||
{{ $style = printf "%v; %v" $style . }}
|
||||
{{ else }}
|
||||
{{ $style = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $maxwidth }}
|
||||
{{ with printf "max-width: %v" $maxwidth }}
|
||||
{{ if $style }}
|
||||
{{ $style = printf "%v; %v" $style . }}
|
||||
{{ else }}
|
||||
{{ $style = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $width }}
|
||||
{{ with printf "width: %v" $width }}
|
||||
{{ if $style }}
|
||||
{{ $style = printf "%v; %v" $style . }}
|
||||
{{ else }}
|
||||
{{ $style = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $table }}
|
||||
<figure class="d-table mb-0 paige-figure text-center">
|
||||
{{ $content }}
|
||||
{{ with $caption }}
|
||||
<figcaption class="figure-caption" style="caption-side: bottom; display: table-caption">{{ . }}</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
{{ else if $float }}
|
||||
{{ $margins := "" }}
|
||||
{{ if eq $float "start" }}
|
||||
{{ $margins = "me-4" }}
|
||||
{{ else if eq $float "end" }}
|
||||
{{ $margins = "ms-4" }}
|
||||
{{ else }}
|
||||
{{ errorf "invalid float: %q" $float }}
|
||||
{{ end }}
|
||||
<figure class="d-table float-{{ $float }} {{ $margins }} paige-figure text-center" {{ with $style }} style="{{ . }}" {{ end }}>
|
||||
{{ $content }}
|
||||
{{ with $caption }}
|
||||
<figcaption class="figure-caption" style="caption-side: bottom; display: table-caption">{{ . }}</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
{{ else }}
|
||||
<figure class="paige-figure text-center">
|
||||
{{ with $style }}
|
||||
<div class="align-items-center d-flex flex-column">
|
||||
<div style="{{ . }}">
|
||||
{{ end }}
|
||||
{{ $content }}
|
||||
{{ with $caption }}
|
||||
<figcaption class="figure-caption" {{ if $table }} style="caption-side: bottom; display: table-caption" {{ end }}>{{ . }}</figcaption>
|
||||
<figcaption class="figure-caption">{{ . }}</figcaption>
|
||||
{{ end }}
|
||||
{{ if $style }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</figure>
|
||||
{{ end }}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
{{ $caption := .Get "caption" }}
|
||||
{{ $float := .Get "float" }}
|
||||
{{ $lang := .Get 0 | default (.Get "lang") | default "plaintext" }}
|
||||
{{ $options := .Get "options" }}
|
||||
|
||||
@@ -7,4 +8,5 @@
|
||||
{{ partial "paige/figure.html" (dict
|
||||
"caption" $caption
|
||||
"content" $content
|
||||
"float" $float
|
||||
) }}
|
||||
|
@@ -1,8 +1,10 @@
|
||||
{{ $caption := .Get 0 | default (.Get "caption") }}
|
||||
{{ $float := .Get "float" }}
|
||||
|
||||
{{ $content := .Inner }}
|
||||
|
||||
{{ partial "paige/figure.html" (dict
|
||||
"caption" $caption
|
||||
"content" $content
|
||||
"float" $float
|
||||
) }}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{{ $alt := .Get "alt" }}
|
||||
{{ $caption := .Get "caption" }}
|
||||
{{ $float := .Get "float" }}
|
||||
{{ $height := .Get "height" }}
|
||||
{{ $link := .Get "link" }}
|
||||
{{ $maxheight := .Get "maxheight" }}
|
||||
@@ -13,6 +14,7 @@
|
||||
{{ partial "paige/image-figure.html" (dict
|
||||
"alt" $alt
|
||||
"caption" $caption
|
||||
"float" $float
|
||||
"height" $height
|
||||
"link" $link
|
||||
"maxheight" $maxheight
|
||||
|
@@ -1,12 +1,24 @@
|
||||
{{ $align := .Get "align" | default "center" }}
|
||||
{{ $caption := .Get "caption" }}
|
||||
{{ $cite := .Get 0 | default (.Get "cite") }}
|
||||
{{ $float := .Get "float" }}
|
||||
|
||||
{{ $caption = $caption | markdownify }}
|
||||
{{ $cite = $cite | markdownify }}
|
||||
{{ $content := .Inner | markdownify }}
|
||||
|
||||
<figure class="d-flex align-items-center flex-column paige-figure">
|
||||
{{ $margins := "" }}
|
||||
{{ if $float }}
|
||||
{{ if eq $float "start" }}
|
||||
{{ $margins = "me-4" }}
|
||||
{{ else if eq $float "end" }}
|
||||
{{ $margins = "ms-4" }}
|
||||
{{ else }}
|
||||
{{ errorf "invalid float: %q" $float }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<figure class="d-flex align-items-center flex-column {{ with $float }} float-{{ . }} {{ end }} {{ with $margins }} {{ . }} {{ end }} paige-figure">
|
||||
<div>
|
||||
<blockquote class="blockquote {{ if $caption }} mb-2 {{ end }} text-{{ $align }}">{{ $content }}</blockquote>
|
||||
{{ with $caption }}
|
||||
|
Reference in New Issue
Block a user