Add number, numbered shortcode params
This commit is contained in:
@@ -519,6 +519,8 @@ The `paige/figure` shortcode provides a figure with content.
|
|||||||
justify="center"
|
justify="center"
|
||||||
maxheight="10rem"
|
maxheight="10rem"
|
||||||
maxwidth="10rem"
|
maxwidth="10rem"
|
||||||
|
number=0
|
||||||
|
numbered=false
|
||||||
width="10rem"
|
width="10rem"
|
||||||
>}}
|
>}}
|
||||||
My content
|
My content
|
||||||
@@ -544,6 +546,10 @@ Parameters:
|
|||||||
<dd>Optional. String. CSS value. Maximum total height.</dd>
|
<dd>Optional. String. CSS value. Maximum total height.</dd>
|
||||||
<dt><code>maxwidth</code></dt>
|
<dt><code>maxwidth</code></dt>
|
||||||
<dd>Optional. String. CSS value. Maximum total width.</dd>
|
<dd>Optional. String. CSS value. Maximum total width.</dd>
|
||||||
|
<dt><code>number</code></dt>
|
||||||
|
<dd>Optional. Integer or string. Figure number. Displayed with the caption.</dd>
|
||||||
|
<dt><code>numbered</code></dt>
|
||||||
|
<dd>Optional. Boolean. Number the figure automatically. Displayed with the caption.</dd>
|
||||||
<dt><code>width</code></dt>
|
<dt><code>width</code></dt>
|
||||||
<dd>Optional. String. CSS value. Total width.</dd>
|
<dd>Optional. String. CSS value. Total width.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
paige_figure:
|
||||||
|
other: Figure
|
||||||
|
|
||||||
paige_noscript:
|
paige_noscript:
|
||||||
other: JavaScript is required.
|
other: JavaScript is required.
|
||||||
|
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
{{ $justify := .justify | default "center" }}
|
{{ $justify := .justify | default "center" }}
|
||||||
{{ $maxheight := .maxheight }}
|
{{ $maxheight := .maxheight }}
|
||||||
{{ $maxwidth := .maxwidth }}
|
{{ $maxwidth := .maxwidth }}
|
||||||
|
{{ $number := .number }}
|
||||||
|
{{ $numbered := .numbered }}
|
||||||
{{ $width := .width }}
|
{{ $width := .width }}
|
||||||
|
|
||||||
{{ $table := false }}
|
{{ $table := false }}
|
||||||
@@ -70,7 +72,22 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<figure class="align-items-{{ $align }} d-flex flex-column {{ with $float }} float-{{ . }} {{ end }} justify-content-{{ $justify }} {{ if $compact }} mb-0 {{ end }} {{ if $float }} {{ $sidemargin }} {{ end }} paige-figure" {{ if and $float $style }} style="{{ $style | safeCSS }}" {{ end }}>
|
{{ $showcaption := $caption }}
|
||||||
|
|
||||||
|
{{ if $caption }}
|
||||||
|
{{ if $number }}
|
||||||
|
{{ $caption = printf "%v %v: %v" (i18n "paige_figure") $number $caption }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ if $number }}
|
||||||
|
{{ $caption = printf "%v %v" (i18n "paige_figure") $number }}
|
||||||
|
{{ $showcaption = true }}
|
||||||
|
{{ else if $numbered }}
|
||||||
|
{{ $showcaption = true }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<figure class="align-items-{{ $align }} d-flex flex-column {{ with $float }} float-{{ . }} {{ end }} justify-content-{{ $justify }} {{ if $compact }} mb-0 {{ end }} {{ if $float }} {{ $sidemargin }} {{ end }} paige-figure {{ if $numbered }} paige-figure-numbered {{ end }}" {{ if and $float $style }} style="{{ $style | safeCSS }}" {{ end }}>
|
||||||
{{ if and (not $float) $style }}
|
{{ if and (not $float) $style }}
|
||||||
<div class="align-items-{{ $align }} d-flex flex-column {{ if $height }} h-100 {{ end }} justify-content-{{ $justify }}" style="{{ $style | safeCSS }}">
|
<div class="align-items-{{ $align }} d-flex flex-column {{ if $height }} h-100 {{ end }} justify-content-{{ $justify }}" style="{{ $style | safeCSS }}">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@@ -78,8 +95,8 @@
|
|||||||
<div class="d-table">
|
<div class="d-table">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="text-{{ $align }}">{{ $content }}</div>
|
<div class="text-{{ $align }}">{{ $content }}</div>
|
||||||
{{ with $caption }}
|
{{ if $showcaption }}
|
||||||
<figcaption class="figure-caption {{ with $gap }} mt-{{ . }} {{ end }} text-{{ $align }}" {{ if $table }} style="caption-side: bottom; display: table-caption" {{ end }}>{{ . }}</figcaption>
|
<figcaption class="figure-caption {{ with $gap }} mt-{{ . }} {{ end }} text-{{ $align }}" {{ if $table }} style="caption-side: bottom; display: table-caption" {{ end }}>{{ $caption }}</figcaption>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if $table }}
|
{{ if $table }}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
{{ $maxheight := .maxheight }}
|
{{ $maxheight := .maxheight }}
|
||||||
{{ $maxwidth := .maxwidth }}
|
{{ $maxwidth := .maxwidth }}
|
||||||
{{ $method := .method }}
|
{{ $method := .method }}
|
||||||
|
{{ $number := .number }}
|
||||||
|
{{ $numbered := .numbered }}
|
||||||
{{ $options := .options }}
|
{{ $options := .options }}
|
||||||
{{ $page := .page }}
|
{{ $page := .page }}
|
||||||
{{ $raw := .raw }}
|
{{ $raw := .raw }}
|
||||||
@@ -43,5 +45,7 @@
|
|||||||
"height" $height
|
"height" $height
|
||||||
"maxheight" $maxheight
|
"maxheight" $maxheight
|
||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
|
"number" $number
|
||||||
|
"numbered" $numbered
|
||||||
"width" $width
|
"width" $width
|
||||||
) }}
|
) }}
|
||||||
|
@@ -4,9 +4,22 @@ body, html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
section[class="paige-content"] {
|
section[class="paige-content"] {
|
||||||
|
counter-reset: paige-figure;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
section[class="paige-content"] figure.paige-figure.paige-figure-numbered {
|
||||||
|
counter-increment: paige-figure;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[class="paige-content"] figure.paige-figure.paige-figure-numbered figcaption:empty::before {
|
||||||
|
content: "{{ i18n `paige_figure` }} " counter(paige-figure);
|
||||||
|
}
|
||||||
|
|
||||||
|
section[class="paige-content"] figure.paige-figure.paige-figure-numbered figcaption::before {
|
||||||
|
content: "{{ i18n `paige_figure` }} " counter(paige-figure) ": ";
|
||||||
|
}
|
||||||
|
|
||||||
section[class="paige-content"] > blockquote {
|
section[class="paige-content"] > blockquote {
|
||||||
padding: 0.5rem 1rem;
|
padding: 0.5rem 1rem;
|
||||||
border-left: 0.25rem solid var(--bs-border-color);
|
border-left: 0.25rem solid var(--bs-border-color);
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
{{ $lang := .Get 0 | default (.Get "lang") | default "plaintext" }}
|
{{ $lang := .Get 0 | default (.Get "lang") | default "plaintext" }}
|
||||||
{{ $maxheight := .Get "maxheight" }}
|
{{ $maxheight := .Get "maxheight" }}
|
||||||
{{ $maxwidth := .Get "maxwidth" }}
|
{{ $maxwidth := .Get "maxwidth" }}
|
||||||
|
{{ $number := .Get "number" }}
|
||||||
|
{{ $numbered := .Get "numbered" }}
|
||||||
{{ $options := .Get "options" }}
|
{{ $options := .Get "options" }}
|
||||||
{{ $width := .Get "width" }}
|
{{ $width := .Get "width" }}
|
||||||
|
|
||||||
@@ -21,5 +23,7 @@
|
|||||||
"justify" $justify
|
"justify" $justify
|
||||||
"maxheight" $maxheight
|
"maxheight" $maxheight
|
||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
|
"number" $number
|
||||||
|
"numbered" $numbered
|
||||||
"width" $width
|
"width" $width
|
||||||
) }}
|
) }}
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
{{ $justify := .Get "justify" }}
|
{{ $justify := .Get "justify" }}
|
||||||
{{ $maxheight := .Get "maxheight" }}
|
{{ $maxheight := .Get "maxheight" }}
|
||||||
{{ $maxwidth := .Get "maxwidth" }}
|
{{ $maxwidth := .Get "maxwidth" }}
|
||||||
|
{{ $number := .Get "number" }}
|
||||||
|
{{ $numbered := .Get "numbered" }}
|
||||||
{{ $width := .Get "width" }}
|
{{ $width := .Get "width" }}
|
||||||
|
|
||||||
{{ partial "paige/figure.html" (dict
|
{{ partial "paige/figure.html" (dict
|
||||||
@@ -18,5 +20,7 @@
|
|||||||
"justify" $justify
|
"justify" $justify
|
||||||
"maxheight" $maxheight
|
"maxheight" $maxheight
|
||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
|
"number" $number
|
||||||
|
"numbered" $numbered
|
||||||
"width" $width
|
"width" $width
|
||||||
) }}
|
) }}
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
{{ $maxheight := .Get "maxheight" }}
|
{{ $maxheight := .Get "maxheight" }}
|
||||||
{{ $maxwidth := .Get "maxwidth" }}
|
{{ $maxwidth := .Get "maxwidth" }}
|
||||||
{{ $method := .Get "method" | default "resize" }}
|
{{ $method := .Get "method" | default "resize" }}
|
||||||
|
{{ $number := .Get "number" }}
|
||||||
|
{{ $numbered := .Get "numbered" }}
|
||||||
{{ $options := .Get "options" | default "550x webp picture Lanczos" }}
|
{{ $options := .Get "options" | default "550x webp picture Lanczos" }}
|
||||||
{{ $raw := .Get "raw" }}
|
{{ $raw := .Get "raw" }}
|
||||||
{{ $type := .Get "type" | default "rows" }}
|
{{ $type := .Get "type" | default "rows" }}
|
||||||
@@ -61,6 +63,7 @@
|
|||||||
{{ else }}
|
{{ else }}
|
||||||
{{ $inner := chomp .Inner }}
|
{{ $inner := chomp .Inner }}
|
||||||
{{ $resources := slice }}
|
{{ $resources := slice }}
|
||||||
|
{{ $showcaption := $caption }}
|
||||||
|
|
||||||
{{ with $images }}
|
{{ with $images }}
|
||||||
{{ with $.Page.Resources.Match . }}
|
{{ with $.Page.Resources.Match . }}
|
||||||
@@ -76,6 +79,19 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if $caption }}
|
||||||
|
{{ if $number }}
|
||||||
|
{{ $caption = printf "%v %v: %v" (i18n "paige_figure") $number $caption }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ if $number }}
|
||||||
|
{{ $caption = printf "%v %v" (i18n "paige_figure") $number }}
|
||||||
|
{{ $showcaption = true }}
|
||||||
|
{{ else if $numbered }}
|
||||||
|
{{ $showcaption = true }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<figure>
|
<figure>
|
||||||
{{ if eq $type "grid" }}
|
{{ if eq $type "grid" }}
|
||||||
<div class="container-fluid px-0">
|
<div class="container-fluid px-0">
|
||||||
@@ -128,8 +144,8 @@
|
|||||||
{{ else }}
|
{{ else }}
|
||||||
{{ errorf "invalid type: %q" $type }}
|
{{ errorf "invalid type: %q" $type }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ with $caption }}
|
{{ if $showcaption }}
|
||||||
<figcaption class="figure-caption mt-2 text-center">{{ . }}</figcaption>
|
<figcaption class="figure-caption mt-2 text-center">{{ $caption }}</figcaption>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</figure>
|
</figure>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
{{ $maxheight := .Get "maxheight" }}
|
{{ $maxheight := .Get "maxheight" }}
|
||||||
{{ $maxwidth := .Get "maxwidth" }}
|
{{ $maxwidth := .Get "maxwidth" }}
|
||||||
{{ $method := .Get "method" }}
|
{{ $method := .Get "method" }}
|
||||||
|
{{ $number := .Get "number" }}
|
||||||
|
{{ $numbered := .Get "numbered" }}
|
||||||
{{ $options := .Get "options" }}
|
{{ $options := .Get "options" }}
|
||||||
{{ $raw := .Get "raw" }}
|
{{ $raw := .Get "raw" }}
|
||||||
{{ $src := .Get 0 | default (.Get "src") }}
|
{{ $src := .Get 0 | default (.Get "src") }}
|
||||||
@@ -26,6 +28,8 @@
|
|||||||
"maxheight" $maxheight
|
"maxheight" $maxheight
|
||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
"method" $method
|
"method" $method
|
||||||
|
"number" $number
|
||||||
|
"numbered" $numbered
|
||||||
"options" $options
|
"options" $options
|
||||||
"raw" $raw
|
"raw" $raw
|
||||||
"src" $src
|
"src" $src
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
{{ $justify := .Get "justify" }}
|
{{ $justify := .Get "justify" }}
|
||||||
{{ $maxheight := .Get "maxheight" }}
|
{{ $maxheight := .Get "maxheight" }}
|
||||||
{{ $maxwidth := .Get "maxwidth" }}
|
{{ $maxwidth := .Get "maxwidth" }}
|
||||||
|
{{ $number := .Get "number" }}
|
||||||
|
{{ $numbered := .Get "numbered" }}
|
||||||
{{ $width := .Get "width" }}
|
{{ $width := .Get "width" }}
|
||||||
|
|
||||||
{{ $content = printf `<blockquote class="blockquote mb-0">%v</blockquote>` $content }}
|
{{ $content = printf `<blockquote class="blockquote mb-0">%v</blockquote>` $content }}
|
||||||
@@ -19,5 +21,7 @@
|
|||||||
"justify" $justify
|
"justify" $justify
|
||||||
"maxheight" $maxheight
|
"maxheight" $maxheight
|
||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
|
"number" $number
|
||||||
|
"numbered" $numbered
|
||||||
"width" $width
|
"width" $width
|
||||||
) }}
|
) }}
|
||||||
|
Reference in New Issue
Block a user