mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
theme: fix dependencies for nested output formats #308
This commit is contained in:
parent
8d19b3b484
commit
d60c2988f2
11 changed files with 38 additions and 25 deletions
|
@ -1,5 +1,6 @@
|
|||
{{- $page := .page }}
|
||||
{{- $content := .content }}
|
||||
{{- with .page }}
|
||||
{{- with $page }}
|
||||
<article class="chapter">
|
||||
{{ partial "heading-pre.html" . }}<div class="article-subheading">{{ T "Chapter" .Params.Weight }}</div>
|
||||
<h1>{{ .Title }}</h1>{{ partial "heading-post.html" . }}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{{- $page := .page }}
|
||||
{{- $content := .content }}
|
||||
{{- with .page }}
|
||||
{{- with $page }}
|
||||
<article class="default">
|
||||
{{ partial "heading-pre.html" . }}<h1>{{ .Title }}</h1>{{ partial "heading-post.html" . }}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{{- $page := .page }}
|
||||
{{- $content := .content }}
|
||||
{{- with .page }}
|
||||
{{- with $page }}
|
||||
<article class="chapter deprecated">
|
||||
|
||||
{{ $content | safeHTML }}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{{- $page := .page }}
|
||||
{{- $content := .content }}
|
||||
{{- with .page }}
|
||||
{{- with $page }}
|
||||
<article class="home deprecated">
|
||||
|
||||
{{ $content | safeHTML }}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{{- $page := .page }}
|
||||
{{- $content := .content }}
|
||||
{{- with .page }}
|
||||
{{- with $page }}
|
||||
<article class="home">
|
||||
{{ partial "heading-pre.html" . }}<h1>{{ .Title }}</h1>{{ partial "heading-post.html" . }}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<script src="{{"js/clipboard.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/featherlight.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
{{- $wantsMathJax := or (.Page.Store.Get "selfHasMathJax") (and (.Page.Store.Get (printf "%sIsNested" ((.Scratch.Get "relearnOutputFormat") | lower))) (.Page.Store.Get "nestedHasMathJax")) }}
|
||||
{{- $wantsMathJax := .Scratch.Get (printf "%sHasMathJax" ((.Scratch.Get "relearnOutputFormat") | lower)) }}
|
||||
{{- if $wantsMathJax }}
|
||||
{{- if isset .Params "mathjaxinitialize" }}
|
||||
{{- $.Scratch.Set "mathJaxInitialize" .Params.mathJaxInitialize }}
|
||||
|
@ -48,7 +48,7 @@
|
|||
<script id="MathJax-script" async src="{{"js/mathjax/tex-mml-chtml.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $wantsMermaid := or (.Page.Store.Get "selfHasMermaid") (and (.Page.Store.Get (printf "%sIsNested" ((.Scratch.Get "relearnOutputFormat") | lower))) (.Page.Store.Get "nestedHasMermaid")) }}
|
||||
{{- $wantsMermaid := .Scratch.Get (printf "%sHasMermaid" ((.Scratch.Get "relearnOutputFormat") | lower)) }}
|
||||
{{- if $wantsMermaid }}
|
||||
<script src="{{"js/jquery.svg.pan.zoom.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
{{- if isset .Params "custommermaidurl" }}
|
||||
|
@ -78,7 +78,7 @@
|
|||
useMermaid( JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}) );
|
||||
</script>
|
||||
{{- end }}
|
||||
{{- $wantsSwagger := or (.Page.Store.Get "selfHasSwagger") (and (.Page.Store.Get (printf "%sIsNested" ((.Scratch.Get "relearnOutputFormat") | lower))) (.Page.Store.Get "nestedHasSwagger")) }}
|
||||
{{- $wantsSwagger := .Scratch.Get (printf "%sHasSwagger" ((.Scratch.Get "relearnOutputFormat") | lower)) }}
|
||||
{{- if $wantsSwagger }}
|
||||
{{- if isset .Params "customswaggerurl" }}
|
||||
<script src="{{ .Params.customSwaggerURL }}" defer></script>
|
||||
|
|
|
@ -91,7 +91,13 @@
|
|||
{{- define "section-print" }}
|
||||
{{- $currentNode := .currentnode }}
|
||||
{{- with .sect }}
|
||||
{{- $content := partial "content.html" . }}
|
||||
{{- partial "output-partial.html" (dict "base" "output-article" "page" . "parameter" (dict "page" . "content" $content)) }}
|
||||
{{- $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 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -5,6 +5,11 @@
|
|||
{{- $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)) }}
|
||||
{{- end }}
|
||||
{{- template "relearn-structure" dict "node" .Site.Home "currentnode" $currentNode "hiddenstem" false "hiddencurrent" false "defaultOrdersectionsby" .Site.Params.ordersectionsby }}
|
||||
{{- define "relearn-structure" }}
|
||||
{{- $currentNode := .currentnode }}
|
||||
|
@ -53,16 +58,4 @@
|
|||
{{- range $pages }}
|
||||
{{- template "relearn-structure" dict "node" . "currentnode" $currentNode "hiddenstem" $hidden_stem "hiddencurrent" $hidden_from_current "defaultOrdersectionsby" $defaultOrdersectionsby }}
|
||||
{{- end}}
|
||||
|
||||
{{- if $isSelf }}
|
||||
{{- $currentNode.Page.Store.Set "selfHasMathjax" (or ($currentNode.Page.Store.Get "selfHasMathJax") (and (ne $currentNode.Params.disableMathjax nil) (not $currentNode.Params.disableMathjax)) (and (ne .Site.Params.disableMathjax nil) (not .Site.Params.disableMathjax))) }}
|
||||
{{- $currentNode.Page.Store.Set "selfHasMermaid" (or ($currentNode.Page.Store.Get "selfHasMermaid") (and (ne $currentNode.Params.disableMermaid nil) (not $currentNode.Params.disableMermaid)) (and (ne .Site.Params.disableMermaid nil) (not .Site.Params.disableMermaid))) }}
|
||||
{{- $currentNode.Page.Store.Set "selfHasSwagger" (or ($currentNode.Page.Store.Get "selfHasSwagger") (and (ne $currentNode.Params.disableSwagger nil) (not $currentNode.Params.disableSwagger)) (and (ne .Site.Params.disableSwagger nil) (not .Site.Params.disableSwagger))) }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $isChildren }}
|
||||
{{- $currentNode.Page.Store.Set "nestedHasMathJax" (or ($currentNode.Page.Store.Get "nestedHasMathJax") (.node.Page.Store.Get "selfHasMathJax") (.node.Page.Store.Get "nestedfHasMathJax")) }}
|
||||
{{- $currentNode.Page.Store.Set "nestedHasMermaid" (or ($currentNode.Page.Store.Get "nestedHasMermaid") (.node.Page.Store.Get "selfHasMermaid") (.node.Page.Store.Get "nestedfHasMermaid")) }}
|
||||
{{- $currentNode.Page.Store.Set "nestedHasSwagger" (or ($currentNode.Page.Store.Get "nestedHasSwagger") (.node.Page.Store.Get "selfHasSwagger") (.node.Page.Store.Get "nestedHasSwagger")) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -5,5 +5,8 @@
|
|||
<span class="math align-{{ $align }}">
|
||||
{{- $content | safeHTML -}}
|
||||
</span>
|
||||
{{- .Page.Store.Set "selfHasMathJax" true }}
|
||||
{{- $page := .Page }}
|
||||
{{- range $page.OutputFormats }}
|
||||
{{- $page.Scratch.Set (printf "%sHasMathJax" (.Name | lower)) true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -5,5 +5,8 @@
|
|||
<div class="mermaid" align="{{ $align }}">
|
||||
{{- $content | safeHTML -}}
|
||||
</div>
|
||||
{{- .Page.Store.Set "selfHasMermaid" true }}
|
||||
{{- $page := .Page }}
|
||||
{{- range $page.OutputFormats }}
|
||||
{{- $page.Scratch.Set (printf "%sHasMermaid" (.Name | lower)) true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -24,5 +24,8 @@
|
|||
spec-url="{{ $src }}"
|
||||
sort-tags="true"
|
||||
></rapi-doc>
|
||||
{{- .Page.Store.Set "selfHasSwagger" true }}
|
||||
{{- $page := .Page }}
|
||||
{{- range $page.OutputFormats }}
|
||||
{{- $page.Scratch.Set (printf "%sHasSwagger" (.Name | lower)) true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
Loading…
Reference in a new issue