Fix shortcodes to enable complex nesting

This commit is contained in:
Will Faught
2023-04-25 19:16:55 -07:00
parent b06903d6c0
commit a9d822a156
10 changed files with 50 additions and 31 deletions

View File

@@ -11,6 +11,7 @@
{{ $loading := $params.loading }}
{{ $maxheight := $params.maxheight }}
{{ $maxwidth := $params.maxwidth }}
{{ $page := $params.page }}
{{ $process := $params.process }}
{{ $resource := $params.resource }}
{{ $sizes := $params.sizes }}
@@ -68,7 +69,7 @@
{{ $style = delimit ($style | uniq | sort) "; " }}
{{ if and (not $resource) $src }}
{{ $resource = partial "paige/resource.html" $src }}
{{ $resource = partial "paige/resource.html" (dict "page" $page "url" $src) }}
{{ end }}
{{ if $resource }}

View File

@@ -4,6 +4,7 @@
{{ $href := $params.href }}
{{ $includepaths := $params.includepaths }}
{{ $integrity := $params.integrity }}
{{ $page := $params.page }}
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
{{ $sass := $params.sass }}
{{ $template := $params.template }}
@@ -15,7 +16,7 @@
{{ errorf "layouts/partials/paige/link.html: no href" }}
{{ end }}
{{ with partial "paige/resource.html" $href }}
{{ with partial "paige/resource.html" (dict "page" $page "url" $href) }}
{{ $resource := . }}
{{ if $template }}

View File

@@ -33,7 +33,7 @@
{{ 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-icons/bootstrap-icons.css") }}
{{ partial "paige/link.html" (dict "href" "css/paige/bootstrap-icons/bootstrap-icons.css" "page" $page) }}
{{ if $page.Param "paige.math" }}
{{ partial "paige/link.html" (dict "href" "css/paige/katex/katex.min.css") }}

View File

@@ -1,4 +1,7 @@
{{ $url := . }}
{{ $params := . }}
{{ $page := $params.page }}
{{ $url := $params.url }}
{{ $result := "" }}
@@ -12,11 +15,11 @@
{{ end }}
{{ end }}
{{ if and (not $result) page }}
{{ with page.Resources.GetMatch $url }}
{{ if and (not $result) $page }}
{{ with $page.Resources.GetMatch $url }}
{{ $result = . }}
{{ else }}
{{ with page.Resources.Get $url }}
{{ with $page.Resources.Get $url }}
{{ $result = . }}
{{ end }}
{{ end }}

View File

@@ -4,6 +4,7 @@
{{ $defer := $params.defer | default "defer" }}
{{ $integrity := $params.integrity }}
{{ $onload := $params.onload | safeJS }}
{{ $page := $params.page }}
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
{{ $src := $params.src }}
{{ $type := $params.type }}
@@ -12,7 +13,7 @@
{{ errorf "layouts/partials/paige/script.html: no src" }}
{{ end }}
{{ with partial "paige/resource.html" $src }}
{{ with partial "paige/resource.html" (dict "page" $page "url" $src) }}
{{ $resource := . | minify | fingerprint }}
{{ $integrity = $resource.Data.Integrity }}
{{ $src = $resource.RelPermalink }}

View File

@@ -28,11 +28,11 @@ function paigeResize() {
paigeResize();
addEventListener("resize", paigeResize);
</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" }}
{{ partial "paige/script.html" (dict "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 "page" $page "src" "js/paige/katex/katex.min.js") }}
{{ partial "paige/script.html" (dict "onload" "renderMathInElement(document.body);" "page" $page "src" "js/paige/katex/auto-render.min.js") }}
{{ end }}
{{ partial "paige/analytics.html" $page }}