Fix shortcodes to enable complex nesting
This commit is contained in:
@@ -369,6 +369,7 @@ Result:
|
|||||||
Code:
|
Code:
|
||||||
|
|
||||||
```go-text-template
|
```go-text-template
|
||||||
|
{{</* paige/figure caption="Gallery" /*/>}}
|
||||||
{{</* paige/gallery */>}}
|
{{</* paige/gallery */>}}
|
||||||
{{</* paige/figure caption="Image 1" /*/>}}
|
{{</* paige/figure caption="Image 1" /*/>}}
|
||||||
{{</* paige/image src="1-2.jpg" /*/>}}
|
{{</* paige/image src="1-2.jpg" /*/>}}
|
||||||
@@ -383,10 +384,12 @@ Code:
|
|||||||
{{</* paige/image src="4.jpg" /*/>}}
|
{{</* paige/image src="4.jpg" /*/>}}
|
||||||
{{</* /paige/figure */>}}
|
{{</* /paige/figure */>}}
|
||||||
{{</* /paige/gallery */>}}
|
{{</* /paige/gallery */>}}
|
||||||
|
{{</* /paige/figure */>}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Result:
|
Result:
|
||||||
|
|
||||||
|
{{< paige/figure caption="Gallery" >}}
|
||||||
{{< paige/gallery >}}
|
{{< paige/gallery >}}
|
||||||
{{< paige/figure caption="Image 1" >}}
|
{{< paige/figure caption="Image 1" >}}
|
||||||
{{< paige/image src="1-2.jpg" >}}
|
{{< paige/image src="1-2.jpg" >}}
|
||||||
@@ -401,3 +404,4 @@ Result:
|
|||||||
{{< paige/image src="4.jpg" >}}
|
{{< paige/image src="4.jpg" >}}
|
||||||
{{< /paige/figure >}}
|
{{< /paige/figure >}}
|
||||||
{{< /paige/gallery >}}
|
{{< /paige/gallery >}}
|
||||||
|
{{< /paige/figure >}}
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
{{ $loading := $params.loading }}
|
{{ $loading := $params.loading }}
|
||||||
{{ $maxheight := $params.maxheight }}
|
{{ $maxheight := $params.maxheight }}
|
||||||
{{ $maxwidth := $params.maxwidth }}
|
{{ $maxwidth := $params.maxwidth }}
|
||||||
|
{{ $page := $params.page }}
|
||||||
{{ $process := $params.process }}
|
{{ $process := $params.process }}
|
||||||
{{ $resource := $params.resource }}
|
{{ $resource := $params.resource }}
|
||||||
{{ $sizes := $params.sizes }}
|
{{ $sizes := $params.sizes }}
|
||||||
@@ -68,7 +69,7 @@
|
|||||||
{{ $style = delimit ($style | uniq | sort) "; " }}
|
{{ $style = delimit ($style | uniq | sort) "; " }}
|
||||||
|
|
||||||
{{ if and (not $resource) $src }}
|
{{ if and (not $resource) $src }}
|
||||||
{{ $resource = partial "paige/resource.html" $src }}
|
{{ $resource = partial "paige/resource.html" (dict "page" $page "url" $src) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if $resource }}
|
{{ if $resource }}
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
{{ $href := $params.href }}
|
{{ $href := $params.href }}
|
||||||
{{ $includepaths := $params.includepaths }}
|
{{ $includepaths := $params.includepaths }}
|
||||||
{{ $integrity := $params.integrity }}
|
{{ $integrity := $params.integrity }}
|
||||||
|
{{ $page := $params.page }}
|
||||||
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
|
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
|
||||||
{{ $sass := $params.sass }}
|
{{ $sass := $params.sass }}
|
||||||
{{ $template := $params.template }}
|
{{ $template := $params.template }}
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
{{ errorf "layouts/partials/paige/link.html: no href" }}
|
{{ errorf "layouts/partials/paige/link.html: no href" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with partial "paige/resource.html" $href }}
|
{{ with partial "paige/resource.html" (dict "page" $page "url" $href) }}
|
||||||
{{ $resource := . }}
|
{{ $resource := . }}
|
||||||
|
|
||||||
{{ if $template }}
|
{{ if $template }}
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ partial "paige/link.html" (dict "href" "css/paige/bootstrap/paige.scss" "page" $page "sass" true "template" true) }}
|
{{ partial "paige/link.html" (dict "href" "css/paige/bootstrap/paige.scss" "page" $page "sass" true "template" true) }}
|
||||||
{{ partial "paige/link.html" (dict "href" "css/paige/bootstrap-icons/bootstrap-icons.css") }}
|
{{ partial "paige/link.html" (dict "href" "css/paige/bootstrap-icons/bootstrap-icons.css" "page" $page) }}
|
||||||
|
|
||||||
{{ if $page.Param "paige.math" }}
|
{{ if $page.Param "paige.math" }}
|
||||||
{{ partial "paige/link.html" (dict "href" "css/paige/katex/katex.min.css") }}
|
{{ partial "paige/link.html" (dict "href" "css/paige/katex/katex.min.css") }}
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
{{ $url := . }}
|
{{ $params := . }}
|
||||||
|
|
||||||
|
{{ $page := $params.page }}
|
||||||
|
{{ $url := $params.url }}
|
||||||
|
|
||||||
{{ $result := "" }}
|
{{ $result := "" }}
|
||||||
|
|
||||||
@@ -12,11 +15,11 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if and (not $result) page }}
|
{{ if and (not $result) $page }}
|
||||||
{{ with page.Resources.GetMatch $url }}
|
{{ with $page.Resources.GetMatch $url }}
|
||||||
{{ $result = . }}
|
{{ $result = . }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ with page.Resources.Get $url }}
|
{{ with $page.Resources.Get $url }}
|
||||||
{{ $result = . }}
|
{{ $result = . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
{{ $defer := $params.defer | default "defer" }}
|
{{ $defer := $params.defer | default "defer" }}
|
||||||
{{ $integrity := $params.integrity }}
|
{{ $integrity := $params.integrity }}
|
||||||
{{ $onload := $params.onload | safeJS }}
|
{{ $onload := $params.onload | safeJS }}
|
||||||
|
{{ $page := $params.page }}
|
||||||
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
|
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
|
||||||
{{ $src := $params.src }}
|
{{ $src := $params.src }}
|
||||||
{{ $type := $params.type }}
|
{{ $type := $params.type }}
|
||||||
@@ -12,7 +13,7 @@
|
|||||||
{{ errorf "layouts/partials/paige/script.html: no src" }}
|
{{ errorf "layouts/partials/paige/script.html: no src" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with partial "paige/resource.html" $src }}
|
{{ with partial "paige/resource.html" (dict "page" $page "url" $src) }}
|
||||||
{{ $resource := . | minify | fingerprint }}
|
{{ $resource := . | minify | fingerprint }}
|
||||||
{{ $integrity = $resource.Data.Integrity }}
|
{{ $integrity = $resource.Data.Integrity }}
|
||||||
{{ $src = $resource.RelPermalink }}
|
{{ $src = $resource.RelPermalink }}
|
||||||
|
@@ -28,11 +28,11 @@ function paigeResize() {
|
|||||||
paigeResize();
|
paigeResize();
|
||||||
addEventListener("resize", paigeResize);
|
addEventListener("resize", paigeResize);
|
||||||
</script>
|
</script>
|
||||||
{{ partial "paige/script.html" (dict "src" "js/paige/bootstrap/bootstrap.bundle.js") }}
|
{{ partial "paige/script.html" (dict "page" $page "src" "js/paige/bootstrap/bootstrap.bundle.js") }}
|
||||||
|
|
||||||
{{ if $page.Param "paige.math" }}
|
{{ if $page.Param "paige.math" }}
|
||||||
{{ partial "paige/script.html" (dict "src" "js/paige/katex/katex.min.js") }}
|
{{ partial "paige/script.html" (dict "page" $page "src" "js/paige/katex/katex.min.js") }}
|
||||||
{{ partial "paige/script.html" (dict "onload" "renderMathInElement(document.body);" "src" "js/paige/katex/auto-render.min.js") }}
|
{{ partial "paige/script.html" (dict "onload" "renderMathInElement(document.body);" "page" $page "src" "js/paige/katex/auto-render.min.js") }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ partial "paige/analytics.html" $page }}
|
{{ partial "paige/analytics.html" $page }}
|
||||||
|
@@ -54,6 +54,8 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* The markup below cannot be indented due to Markdown. */}}
|
||||||
|
|
||||||
<div class="align-items-{{ $vertical }} d-flex {{ with $float }} float-{{ . }} {{ end }} h-100 justify-content-{{ $horizontal }} {{ with $sidemargin }} {{ . }} {{ end }} paige-figure {{ if $numbered }} paige-figure-numbered {{ end }}">
|
<div class="align-items-{{ $vertical }} d-flex {{ with $float }} float-{{ . }} {{ end }} h-100 justify-content-{{ $horizontal }} {{ with $sidemargin }} {{ . }} {{ end }} paige-figure {{ if $numbered }} paige-figure-numbered {{ end }}">
|
||||||
<figure class="{{ if $table }} d-table {{ end }} mb-0" {{ with $widths }} style="{{ . | safeCSS }}" {{ end }}>
|
<figure class="{{ if $table }} d-table {{ end }} mb-0" {{ with $widths }} style="{{ . | safeCSS }}" {{ end }}>
|
||||||
<div class="d-flex justify-content-{{ $horizontal }} text-{{ $horizontal }}">{{ $content }}</div>
|
<div class="d-flex justify-content-{{ $horizontal }} text-{{ $horizontal }}">{{ $content }}</div>
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
{{ $loading := .Get "loading" }}
|
{{ $loading := .Get "loading" }}
|
||||||
{{ $maxheight := .Get "maxheight" }}
|
{{ $maxheight := .Get "maxheight" }}
|
||||||
{{ $maxwidth := .Get "maxwidth" }}
|
{{ $maxwidth := .Get "maxwidth" }}
|
||||||
|
{{ $page := .Page }}
|
||||||
{{ $process := .Get "process" }}
|
{{ $process := .Get "process" }}
|
||||||
{{ $style := .Get "style" }}
|
{{ $style := .Get "style" }}
|
||||||
{{ $type := .Get "type" | default "rows" }}
|
{{ $type := .Get "type" | default "rows" }}
|
||||||
@@ -38,6 +39,8 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* The markup below cannot be indented due to Markdown. */}}
|
||||||
|
|
||||||
<div class="paige-gallery">
|
<div class="paige-gallery">
|
||||||
{{ if eq $type "filled-rows" }}
|
{{ if eq $type "filled-rows" }}
|
||||||
<div class="align-items-{{ $align }} column-gap-3 d-flex flex-wrap justify-content-{{ $justify }} row-gap-3">
|
<div class="align-items-{{ $align }} column-gap-3 d-flex flex-wrap justify-content-{{ $justify }} row-gap-3">
|
||||||
@@ -45,7 +48,7 @@
|
|||||||
{{ . }}
|
{{ . }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ range $resources }}
|
{{ range $resources }}
|
||||||
{{ partial "paige/image.html" (dict
|
{{- partial "paige/image.html" (dict
|
||||||
"breakpoints" $breakpoints
|
"breakpoints" $breakpoints
|
||||||
"class" $class
|
"class" $class
|
||||||
"densities" $densities
|
"densities" $densities
|
||||||
@@ -55,11 +58,12 @@
|
|||||||
"loading" $loading
|
"loading" $loading
|
||||||
"maxheight" $maxheight
|
"maxheight" $maxheight
|
||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
|
"page" $page
|
||||||
"process" $process
|
"process" $process
|
||||||
"resource" .
|
"resource" .
|
||||||
"style" (print $style "; flex: 1 1 auto; object-fit: cover")
|
"style" (print $style "; flex: 1 1 auto; object-fit: cover")
|
||||||
"width" $width
|
"width" $width
|
||||||
) }}
|
) -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
@@ -70,7 +74,7 @@
|
|||||||
{{ . }}
|
{{ . }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ range $resources }}
|
{{ range $resources }}
|
||||||
{{ partial "paige/image.html" (dict
|
{{- partial "paige/image.html" (dict
|
||||||
"breakpoints" $breakpoints
|
"breakpoints" $breakpoints
|
||||||
"class" $class
|
"class" $class
|
||||||
"densities" $densities
|
"densities" $densities
|
||||||
@@ -80,11 +84,12 @@
|
|||||||
"loading" $loading
|
"loading" $loading
|
||||||
"maxheight" $maxheight
|
"maxheight" $maxheight
|
||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
|
"page" $page
|
||||||
"process" $process
|
"process" $process
|
||||||
"resource" .
|
"resource" .
|
||||||
"style" (print $style "; height: auto; max-width: 100%")
|
"style" (print $style "; height: auto; max-width: 100%")
|
||||||
"width" $width
|
"width" $width
|
||||||
) }}
|
) -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
@@ -95,7 +100,7 @@
|
|||||||
{{ . }}
|
{{ . }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ range $resources }}
|
{{ range $resources }}
|
||||||
{{ partial "paige/image.html" (dict
|
{{- partial "paige/image.html" (dict
|
||||||
"breakpoints" $breakpoints
|
"breakpoints" $breakpoints
|
||||||
"class" $class
|
"class" $class
|
||||||
"densities" $densities
|
"densities" $densities
|
||||||
@@ -105,11 +110,12 @@
|
|||||||
"loading" $loading
|
"loading" $loading
|
||||||
"maxheight" $maxheight
|
"maxheight" $maxheight
|
||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
|
"page" $page
|
||||||
"process" $process
|
"process" $process
|
||||||
"resource" .
|
"resource" .
|
||||||
"style" (print $style "; height: auto; max-width: 100%")
|
"style" (print $style "; height: auto; max-width: 100%")
|
||||||
"width" $width
|
"width" $width
|
||||||
) }}
|
) -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
"loading" $loading
|
"loading" $loading
|
||||||
"maxheight" $maxheight
|
"maxheight" $maxheight
|
||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
|
"page" .Page
|
||||||
"process" $process
|
"process" $process
|
||||||
"sizes" $sizes
|
"sizes" $sizes
|
||||||
"src" $src
|
"src" $src
|
||||||
|
Reference in New Issue
Block a user