diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 859ff5cf34..530f466320 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -7,7 +7,7 @@ -{{- $wantsMathJax := .Scratch.Get (printf "%sHasMathJax" ((partial "output-format.html" .) | lower)) }} +{{- $wantsMathJax := or (.Page.Store.Get "hasMathJax") (and (.Page.Store.Get (printf "%sIsNested" ((partial "output-format.html" .Page) | lower))) (.Page.Store.Get "nestedHasMathJax")) }} {{- if $wantsMathJax }} {{- if isset .Params "mathjaxinitialize" }} {{- $.Scratch.Set "mathJaxInitialize" .Params.mathJaxInitialize }} @@ -48,7 +48,7 @@ {{- end }} {{- end }} -{{- $wantsMermaid := .Scratch.Get (printf "%sHasMermaid" ((partial "output-format.html" .) | lower)) }} +{{- $wantsMermaid := or (.Page.Store.Get "hasMermaid") (and (.Page.Store.Get (printf "%sIsNested" ((partial "output-format.html" .Page) | lower))) (.Page.Store.Get "nestedHasMermaid")) }} {{- if $wantsMermaid }} {{- if isset .Params "custommermaidurl" }} @@ -78,7 +78,7 @@ useMermaid( JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}) ); {{- end }} -{{- $wantsSwagger := .Scratch.Get (printf "%sHasSwagger" ((partial "output-format.html" .) | lower)) }} +{{- $wantsSwagger := or (.Page.Store.Get "hasSwagger") (and (.Page.Store.Get (printf "%sIsNested" ((partial "output-format.html" .Page) | lower))) (.Page.Store.Get "nestedHasSwagger")) }} {{- if $wantsSwagger }} {{- if isset .Params "customswaggerurl" }} diff --git a/layouts/partials/nested-article.html b/layouts/partials/nested-article.html index e1f9730ca7..131d94d4c9 100644 --- a/layouts/partials/nested-article.html +++ b/layouts/partials/nested-article.html @@ -94,10 +94,8 @@ {{- $page := . }} {{- $content := partial "content.html" $page }} {{- partial "output-partial.html" (dict "base" "output-article" "page" $page "parameter" (dict "page" $page "content" $content)) }} - {{- range $page.OutputFormats }} - {{- $currentNode.Scratch.Set (printf "%sHasMathJax" (.Name | lower)) (or ($currentNode.Scratch.Get (printf "%sHasMathJax" (.Name | lower))) ($page.Scratch.Get (printf "%sHasMathJax" (.Name | lower)))) }} - {{- $currentNode.Scratch.Set (printf "%sHasMermaid" (.Name | lower)) (or ($currentNode.Scratch.Get (printf "%sHasMermaid" (.Name | lower))) ($page.Scratch.Get (printf "%sHasMermaid" (.Name | lower)))) }} - {{- $currentNode.Scratch.Set (printf "%sHasSwagger" (.Name | lower)) (or ($currentNode.Scratch.Get (printf "%sHasSwagger" (.Name | lower))) ($page.Scratch.Get (printf "%sHasSwagger" (.Name | lower)))) }} - {{- end }} + {{- $currentNode.Page.Store.Set "nestedHasMathJax" (or ($currentNode.Page.Store.Get "nestedHasMathJax") (.Page.Store.Get "hasMathJax")) }} + {{- $currentNode.Page.Store.Set "nestedHasMermaid" (or ($currentNode.Page.Store.Get "nestedHasMermaid") (.Page.Store.Get "hasMermaid")) }} + {{- $currentNode.Page.Store.Set "nestedHasSwagger" (or ($currentNode.Page.Store.Get "nestedHasSwagger") (.Page.Store.Get "hasSwagger")) }} {{- end }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/page-meta.hugo b/layouts/partials/page-meta.hugo index c85ee6ebc6..8007c48326 100644 --- a/layouts/partials/page-meta.hugo +++ b/layouts/partials/page-meta.hugo @@ -5,10 +5,18 @@ {{- $currentNode.Scratch.Delete "relearnIsHiddenNode" }}{{/* the node itself is flagged as hidden */}} {{- $currentNode.Scratch.Delete "relearnIsHiddenStem" }}{{/* the node or one of its parents is flagged as hidden */}} {{- $currentNode.Scratch.Delete "relearnIsHiddenFrom" }}{{/* the node is hidden from the current page */}} -{{- range $currentNode.OutputFormats }} - {{- $currentNode.Scratch.Delete (printf "%sHasMathJax" (.Name | lower)) }} - {{- $currentNode.Scratch.Delete (printf "%sHasMermaid" (.Name | lower)) }} - {{- $currentNode.Scratch.Delete (printf "%sHasSwagger" (.Name | lower)) }} +{{- $currentNode.Scratch.Delete (printf "%sWantsMathJax" ((partial "output-format.html" $currentNode) | lower)) }} +{{- $wantsMathjax := or (and (ne $currentNode.Params.disableMathjax nil) (not $currentNode.Params.disableMathjax)) (and (ne .Site.Params.disableMathjax nil) (not .Site.Params.disableMathjax)) }} +{{- if $wantsMathjax }} + {{- $currentNode.Store.Set "hasMathJax" true }} +{{- end }} +{{- $wantsMermaid := or (and (ne $currentNode.Params.disableMermaid nil) (not $currentNode.Params.disableMermaid)) (and (ne .Site.Params.disableMermaid nil) (not .Site.Params.disableMermaid)) }} +{{- if $wantsMermaid }} + {{- $currentNode.Store.Set "hasMermaid" true }} +{{- end }} +{{- $wantsSwagger := or (and (ne $currentNode.Params.disableSwagger nil) (not $currentNode.Params.disableSwagger)) (and (ne .Site.Params.disableSwagger nil) (not .Site.Params.disableSwagger)) }} +{{- if $wantsSwagger }} + {{- $currentNode.Store.Set "hasSwagger" true }} {{- end }} {{- template "relearn-structure" dict "node" .Site.Home "currentnode" $currentNode "hiddenstem" false "hiddencurrent" false "defaultOrdersectionsby" .Site.Params.ordersectionsby }} {{- define "relearn-structure" }} diff --git a/layouts/partials/shortcodes/math.html b/layouts/partials/shortcodes/math.html index 531f58f90b..abe172285d 100644 --- a/layouts/partials/shortcodes/math.html +++ b/layouts/partials/shortcodes/math.html @@ -5,8 +5,5 @@ {{- $content | safeHTML -}} -{{- $page := .Page }} -{{- range $page.OutputFormats }} - {{- $page.Scratch.Set (printf "%sHasMathJax" (.Name | lower)) true }} -{{- end }} +{{- .Page.Store.Set "hasMathJax" true }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/shortcodes/mermaid.html b/layouts/partials/shortcodes/mermaid.html index e515bec0bc..561527a55b 100644 --- a/layouts/partials/shortcodes/mermaid.html +++ b/layouts/partials/shortcodes/mermaid.html @@ -5,8 +5,5 @@