dependencies: fix mermaid and mathjax initialization #682

caused the stylesheet generator to ignore clicks
This commit is contained in:
Sören Weber 2023-10-26 11:27:53 +02:00
parent d2583cf498
commit 5a534d02b2
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 8 additions and 10 deletions

View file

@ -1,11 +1,10 @@
{{- $page := .page }} {{- $page := .page }}
{{- with $page }} {{- with $page }}
{{- $init := "{}" }}
{{- if isset .Params "mathjaxinitialize" }} {{- if isset .Params "mathjaxinitialize" }}
{{- $.Scratch.Set "mathJaxInitialize" .Params.mathJaxInitialize }} {{- $init = .Params.mathJaxInitialize }}
{{- else if isset .Site.Params "mathjaxinitialize" }} {{- else if isset .Site.Params "mathjaxinitialize" }}
{{- $.Scratch.Set "mathJaxInitialize" .Site.Params.mathJaxInitialize }} {{- $init = .Site.Params.mathJaxInitialize }}
{{- else }}
{{- $.Scratch.Set "mathJaxInitialize" "{}" }}
{{- end }} {{- end }}
<script> <script>
function useMathJax( config ){ function useMathJax( config ){
@ -33,7 +32,7 @@
} }
}, config ); }, config );
} }
useMathJax( JSON.parse({{ $.Scratch.Get "mathJaxInitialize" }}) ); useMathJax( JSON.parse({{ $init }}) );
</script> </script>
{{- if isset .Params "custommathjaxurl" }} {{- if isset .Params "custommathjaxurl" }}
<script id="MathJax-script" async src="{{ .Params.customMathJaxURL }}"></script> <script id="MathJax-script" async src="{{ .Params.customMathJaxURL }}"></script>

View file

@ -17,14 +17,13 @@
{{- else }} {{- else }}
<script src="{{"js/mermaid.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script> <script src="{{"js/mermaid.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
{{- end }} {{- end }}
{{- $init := "{}" }}
{{- if isset .Params "mermaidinitialize" }} {{- if isset .Params "mermaidinitialize" }}
{{- $.Scratch.Set "mermaidInitialize" .Params.mermaidInitialize }} {{- $init = .Params.mermaidInitialize }}
{{- else if isset .Site.Params "mermaidinitialize" }} {{- else if isset .Site.Params "mermaidinitialize" }}
{{- $.Scratch.Set "mermaidInitialize" .Site.Params.mermaidInitialize }} {{- $init = .Site.Params.mermaidInitialize }}
{{- else }}
{{- $.Scratch.Set "mermaidInitialize" "{}" }}
{{- end }} {{- end }}
<script> <script>
window.themeUseMermaid = JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}); window.themeUseMermaid = JSON.parse({{ $init }});
</script> </script>
{{- end }} {{- end }}