mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
print: show Mermaid if requested in frontmatter #255
This commit is contained in:
parent
af3bd11bcd
commit
d3fd28a609
3 changed files with 12 additions and 4 deletions
|
@ -4,7 +4,7 @@
|
||||||
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
|
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
|
||||||
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
|
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
|
||||||
{{- if $isActive }}
|
{{- if $isActive }}
|
||||||
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
||||||
{{- if or .IsHome .Params.chapter $pages }}
|
{{- if or .IsHome .Params.chapter $pages }}
|
||||||
<section>
|
<section>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
|
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
|
||||||
{{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }}
|
{{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }}
|
||||||
{{- if $isActive }}
|
{{- if $isActive }}
|
||||||
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
||||||
{{- if or .IsHome .Params.chapter $pages }}
|
{{- if or .IsHome .Params.chapter $pages }}
|
||||||
<section>
|
<section>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||||
<script src="{{"js/featherlight.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
<script src="{{"js/featherlight.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||||
{{- $wantsMermaid := or (and (eq (.Scratch.Get "relearnOutputFormat") "HTML") (.Page.Store.Get "htmlHasMermaid")) (and (eq (.Scratch.Get "relearnOutputFormat") "PRINT") (.Page.Store.Get "printHasMermaid")) }}
|
{{- $wantsMermaid := or (and (eq (.Scratch.Get "relearnOutputFormat") "HTML") (.Page.Store.Get "htmlHasMermaid")) (and (eq (.Scratch.Get "relearnOutputFormat") "PRINT") (.Page.Store.Get "printHasMermaid")) }}
|
||||||
{{- if (or $wantsMermaid (and (ne .Params.disableMermaid nil) (not .Params.disableMermaid)) (and (ne .Site.Params.disableMermaid nil) (not .Site.Params.disableMermaid)) ) }}
|
{{- if $wantsMermaid }}
|
||||||
<script src="{{"js/jquery.svg.pan.zoom.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
<script src="{{"js/jquery.svg.pan.zoom.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||||
{{- if isset .Params "custommermaidurl" }}
|
{{- if isset .Params "custommermaidurl" }}
|
||||||
<script src="{{ .Params.customMermaidURL }}"></script>
|
<script src="{{ .Params.customMermaidURL }}"></script>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
</script>
|
</script>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $wantsSwagger := or (and (eq (.Scratch.Get "relearnOutputFormat") "HTML") (.Page.Store.Get "htmlHasSwagger")) (and (eq (.Scratch.Get "relearnOutputFormat") "PRINT") (.Page.Store.Get "printHasSwagger")) }}
|
{{- $wantsSwagger := or (and (eq (.Scratch.Get "relearnOutputFormat") "HTML") (.Page.Store.Get "htmlHasSwagger")) (and (eq (.Scratch.Get "relearnOutputFormat") "PRINT") (.Page.Store.Get "printHasSwagger")) }}
|
||||||
{{- if (or $wantsSwagger (and (ne .Params.disableSwagger nil) (not .Params.disableSwagger)) (and (ne .Site.Params.disableSwagger nil) (not .Site.Params.disableSwagger)) ) }}
|
{{- if $wantsSwagger }}
|
||||||
{{- if isset .Params "customswaggerurl" }}
|
{{- if isset .Params "customswaggerurl" }}
|
||||||
<script src="{{ .Params.customSwaggerURL }}"></script>
|
<script src="{{ .Params.customSwaggerURL }}"></script>
|
||||||
{{- else if isset .Site.Params "customswaggerurl" }}
|
{{- else if isset .Site.Params "customswaggerurl" }}
|
||||||
|
|
|
@ -6,6 +6,14 @@
|
||||||
{{- $currentNode.Scratch.Delete "relearnIsHiddenNode" }}{{/* the node itself is flagged as hidden */}}
|
{{- $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 "relearnIsHiddenStem" }}{{/* the node or one of its parents is flagged as hidden */}}
|
||||||
{{- $currentNode.Scratch.Delete "relearnIsHiddenFrom" }}{{/* the node is hidden from the current page */}}
|
{{- $currentNode.Scratch.Delete "relearnIsHiddenFrom" }}{{/* the node is hidden from the current page */}}
|
||||||
|
{{- $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.Page.Store.Set "htmlHasMermaid" true }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $wantsSwagger := or (and (ne .Params.disableSwagger nil) (not .Params.disableSwagger)) (and (ne .Site.Params.disableSwagger nil) (not .Site.Params.disableSwagger)) }}
|
||||||
|
{{- if $wantsSwagger }}
|
||||||
|
{{- $currentNode.Page.Store.Set "htmlHasSwagger" true }}
|
||||||
|
{{- end }}
|
||||||
{{- template "relearn-structure" dict "node" .Site.Home "currentnode" $currentNode "hiddenstem" false "hiddencurrent" false "defaultOrdersectionsby" .Site.Params.ordersectionsby }}
|
{{- template "relearn-structure" dict "node" .Site.Home "currentnode" $currentNode "hiddenstem" false "hiddencurrent" false "defaultOrdersectionsby" .Site.Params.ordersectionsby }}
|
||||||
{{- define "relearn-structure" }}
|
{{- define "relearn-structure" }}
|
||||||
{{- $currentNode := .currentnode }}
|
{{- $currentNode := .currentnode }}
|
||||||
|
|
Loading…
Reference in a new issue