initial commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
{{- $authorName := "" }}
|
||||
{{- with .Site.Params.author }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .name }}
|
||||
{{- $authorName = . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- warnf "DEPRECATED usage of 'params.author' config parameter found, replace it with `params.author.name` in your hugo.toml; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-23-0" }}
|
||||
{{- $authorName = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $authorName }}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{- $style := lower .style }}
|
||||
{{- $set := "" }}
|
||||
{{- range site.Params.boxStyle }}
|
||||
{{- if eq (lower .identifier) $style }}
|
||||
{{- $title := or .title (.i18n | T) }}
|
||||
{{- $set = dict "style" $style "title" $title "icon" .icon }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not $set }}
|
||||
{{- range (slice
|
||||
(dict "identifier" "caution" "icon" "hand")
|
||||
(dict "identifier" "important" "icon" "bolt")
|
||||
(dict "identifier" "info" "icon" "info-circle")
|
||||
(dict "identifier" "note" "icon" "exclamation-circle")
|
||||
(dict "identifier" "tip" "icon" "lightbulb")
|
||||
(dict "identifier" "warning" "icon" "exclamation-triangle")
|
||||
) }}
|
||||
{{- if eq .identifier $style }}
|
||||
{{- $title := .identifier | T }}
|
||||
{{- $set = dict "style" $style "title" $title "icon" .icon }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not $set }}
|
||||
{{- $set = dict "style" $style "title" "" "icon" "" }}
|
||||
{{- end }}
|
||||
{{- if .title }}
|
||||
{{- $set = merge $set (dict "title" .title) }}
|
||||
{{- end }}
|
||||
{{- if .icon }}
|
||||
{{- $set = merge $set (dict "icon" .icon) }}
|
||||
{{- end }}
|
||||
{{- return $set }}
|
||||
@@ -0,0 +1,57 @@
|
||||
{{- $href := partial "permalink.gotmpl" (dict "to" .linkObject) }}
|
||||
{{- $silent := .silent | default false }}
|
||||
{{- $hideFilepath := .hideFilepath | default false }}
|
||||
{{- $u := urls.Parse .url }}
|
||||
{{- with $u.RawQuery }}
|
||||
{{- $href = printf "%s?%s" $href . }}
|
||||
{{- end }}
|
||||
{{- with $u.Fragment }}
|
||||
{{- $href = printf "%s#%s" $href . }}
|
||||
{{- if not $silent }}
|
||||
{{- partial "inline/validate-fragment.html" (dict "origPage" $.page "page" $.linkObject "parsedURL" $u "url" $.url "param" $.param "hideFilepath" $hideFilepath) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $href }}
|
||||
|
||||
{{- define "partials/inline/validate-fragment.html" }}
|
||||
{{- /*
|
||||
Validates the fragment portion of a link destination.
|
||||
*/}}
|
||||
|
||||
{{- /* Initialize. */}}
|
||||
{{- $errorLevel := .errorLevel }}
|
||||
{{- $origPage := .origPage }}
|
||||
{{- $p := .page }}
|
||||
{{- $url := .url }}
|
||||
{{- $u := .parsedURL }}
|
||||
{{- $param := .param }}
|
||||
{{- $hideFilepath := .hideFilepath }}
|
||||
|
||||
{{- /* Validate. */}}
|
||||
{{- with $u.Fragment }}
|
||||
{{- if $p.Fragments.Identifiers.Contains . }}
|
||||
{{- if gt ($p.Fragments.Identifiers.Count .) 1 }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $origPage $origPage.File $origPage.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: duplicate heading ID %q found" $filepath . }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $url "page" $origPage "param" $param "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- /* Determine target path for warning and error message. */}}
|
||||
{{- $targetPath := "" }}
|
||||
{{- with $p.File }}
|
||||
{{- $targetPath = .Path }}
|
||||
{{- else }}
|
||||
{{- $targetPath = .Path }}
|
||||
{{- end }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $origPage $origPage.File $origPage.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "heading ID %q not found" . }}
|
||||
{{- if not $hideFilepath }}
|
||||
{{- $msg = printf "%q: %s" $filepath $msg }}
|
||||
{{- end }}
|
||||
{{- if or $hideFilepath (ne $origPage $p) }}
|
||||
{{- $msg = printf "%s in %q" $msg $targetPath }}
|
||||
{{- end }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $url "page" $origPage "param" $param "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,40 @@
|
||||
{{- range .Site.Params.relearn.dependencies }}
|
||||
{{- $has := printf "has%s" .name }}
|
||||
{{- $disable := printf "disable%s" .name }}
|
||||
{{- $enable := printf "%s" (lower .name) }}
|
||||
|
||||
{{- $wantsPage := false }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $.File $.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- if ne (index $.Params $disable) nil }}
|
||||
{{- $wantsPage = not (index $.Params $disable) }}
|
||||
{{- warnf "%q: DEPRECATED front matter 'disable%s' found, use '%s' or '%s.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" $filepath .name (lower .name) (lower .name) }}
|
||||
{{- else if and (eq .name "Math") (ne (index $.Params "disableMathJax") nil) }}
|
||||
{{- $wantsPage = not (index $.Params "disableMathJax") }}
|
||||
{{- warnf "%q: DEPRECATED front matter 'disableMathJax' found, use 'math' or 'math.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- with index $.Params $enable }}
|
||||
{{- $wantsPage = or
|
||||
(and (reflect.IsMap .) (eq (index . "force") true))
|
||||
(and (not (reflect.IsMap .)) (eq . true))
|
||||
}}
|
||||
{{- end }}
|
||||
|
||||
{{- $wantsSite := false }}
|
||||
{{- if ne (index $.Site.Params $disable) nil }}
|
||||
{{- $wantsSite = not (index $.Site.Params $disable) }}
|
||||
{{- warnf "DEPRECATED option 'disable%s' found, use '%s' or '%s.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" .name (lower .name) (lower .name) }}
|
||||
{{- else if and (eq .name "Math") (ne (index $.Site.Params "disableMathJax") nil) }}
|
||||
{{- $wantsSite = not (index $.Site.Params "disableMathJax") }}
|
||||
{{- warnf "DEPRECATED option 'disableMathJax' found, use 'math' or 'math.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
|
||||
{{- end }}
|
||||
{{- with index $.Site.Params $enable }}
|
||||
{{- $wantsSite = or
|
||||
(and (reflect.IsMap .) (eq (index . "force") true))
|
||||
(and (not (reflect.IsMap .)) (eq . true))
|
||||
}}
|
||||
{{- end }}
|
||||
|
||||
{{- if or $wantsPage $wantsSite }}
|
||||
{{- $.Store.Set $has true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1 @@
|
||||
{{- return fileExists . }}
|
||||
@@ -0,0 +1,79 @@
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $height := "auto" }}
|
||||
{{- $width := "auto" }}
|
||||
{{- $effects := dict "border" false "dataurl" false "inlinecontent" false "lazy" true "lightbox" true "shadow" false }}
|
||||
{{- if .page.Site.Params.imageeffects }}
|
||||
{{- $effects = merge $effects .page.Site.Params.imageeffects }}
|
||||
{{- end }}
|
||||
{{- if .page.Params.imageEffects }}
|
||||
{{- $effects = merge $effects .page.Params.imageEffects }}
|
||||
{{- end }}
|
||||
{{- $u := urls.Parse .url }}
|
||||
{{- if $u.RawQuery }}
|
||||
{{- if $u.Query.Has "classes" }}
|
||||
{{- $classes := slice | append (split ($u.Query.Get "classes") ",") }}
|
||||
{{- range $classes }}
|
||||
{{- $k := . }}
|
||||
{{- $v := true }}
|
||||
{{- if strings.HasPrefix $k "no" }}
|
||||
{{- $k := strings.TrimPrefix "no" $k }}
|
||||
{{- $v := false }}
|
||||
{{- end }}
|
||||
{{- $effects = merge $effects (dict $k $v) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $u.Query.Has "featherlight" }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and .page .page.File .page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED usage of 'featherlight' image CSS class found, use 'lightbox' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-11-0" $filepath }}
|
||||
{{- $effects = merge $effects (dict "lightbox" (ne ($u.Query.Get "featherlight") "false")) }}
|
||||
{{- end }}
|
||||
{{- range $k, $v := $effects }}
|
||||
{{- if $u.Query.Has $k }}
|
||||
{{- $effects = merge $effects (dict $k (ne ($u.Query.Get $k) "false")) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $k, $v := $effects }}
|
||||
{{- if $u.Query.Has $k }}
|
||||
{{- $paramValue := $u.Query.Get $k }}
|
||||
{{- $newValue := true }}
|
||||
{{- if eq $paramValue "" }}
|
||||
{{- $newValue = true }}
|
||||
{{- else if eq $paramValue "true" }}
|
||||
{{- $newValue = true }}
|
||||
{{- else if eq $paramValue "false" }}
|
||||
{{- $newValue = false }}
|
||||
{{- else }}
|
||||
{{- $newValue = $paramValue }}
|
||||
{{- end }}
|
||||
{{- $effects = merge $effects (dict $k $newValue) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $u.Query.Get "height" }}
|
||||
{{- $height = . }}
|
||||
{{- end }}
|
||||
{{- with $u.Query.Get "width" }}
|
||||
{{- $width = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $classes := slice }}
|
||||
{{- range $k, $v := $effects }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- $classes = $classes | append $k }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and .linkObject $effects.inlinecontent (eq .linkObject.MediaType.Type "image/svg+xml") }}
|
||||
{{- $content := .linkObject.Content | replaceRE `(?s)^\s*<\?.*?\?>\s*` "" }}
|
||||
{{- $attributes = merge $attributes (dict "content" $content) }}
|
||||
{{- else if and .linkObject $effects.dataurl }}
|
||||
{{- $src := printf "data:%s;base64,%s" .linkObject.MediaType.Type (.linkObject.Content | base64Encode) }}
|
||||
{{- $attributes = merge $attributes (dict "src" $src) }}
|
||||
{{- else }}
|
||||
{{- $attributes = merge $attributes (dict "src" .url) }}
|
||||
{{- end }}
|
||||
{{- if $attributes.class }}{{ $classes = $classes | append (split $attributes.class " ") }}{{ end }}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit $classes " ")) }}
|
||||
{{- $attributes = merge $attributes (dict "style" (printf " height: %s; width: %s;%s" $height $width (index $attributes "style" | default ""))) }}
|
||||
{{- if $effects.lazy }}{{ $attributes = merge $attributes (dict "loading" "lazy") }}{{ end }}
|
||||
{{- return $attributes }}
|
||||
@@ -0,0 +1,72 @@
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- /* target will be boolean false if no user defined value was set and effect default should be applied */}}
|
||||
{{- $target := false }}
|
||||
{{- $u := urls.Parse .url }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- $attributes = merge $attributes (dict "rel" "external") }}
|
||||
{{- $target = "_blank" }}
|
||||
{{- if isset .page.Site.Params "externallinktarget" }}
|
||||
{{- $target = .page.Site.Params.externalLinkTarget }}
|
||||
{{- if in (slice "false" false 0) $target }}
|
||||
{{- $target = "" }}
|
||||
{{- end }}
|
||||
{{- if in (slice "true" true 1) $target }}
|
||||
{{- $target = "_blank" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $effects := dict "download" false "target" false }}
|
||||
{{- if .page.Site.Params.linkeffects }}
|
||||
{{- $effects = merge $effects .page.Site.Params.linkeffects }}
|
||||
{{- end }}
|
||||
{{- if .page.Params.linkeffects }}
|
||||
{{- $effects = merge $effects .page.Params.linkeffects }}
|
||||
{{- end }}
|
||||
{{- $target := .target | default $target }}
|
||||
{{- if ne (printf "%T" $target) "bool" }}
|
||||
{{- $effects = merge $effects (dict "target" $target) }}
|
||||
{{- end }}
|
||||
{{- if $u.RawQuery }}
|
||||
{{- if $u.Query.Has "classes" }}
|
||||
{{- $classes := slice | append (split ($u.Query.Get "classes") ",") }}
|
||||
{{- range $classes }}
|
||||
{{- $k := . }}
|
||||
{{- $v := true }}
|
||||
{{- if strings.HasPrefix $k "no" }}
|
||||
{{- $k := strings.TrimPrefix "no" $k }}
|
||||
{{- $v := false }}
|
||||
{{- end }}
|
||||
{{- $effects = merge $effects (dict $k $v) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $k, $v := $effects }}
|
||||
{{- if $u.Query.Has $k }}
|
||||
{{- $paramValue := $u.Query.Get $k }}
|
||||
{{- $newValue := true }}
|
||||
{{- if eq $paramValue "" }}
|
||||
{{- $newValue = true }}
|
||||
{{- else if eq $paramValue "true" }}
|
||||
{{- $newValue = true }}
|
||||
{{- else if eq $paramValue "false" }}
|
||||
{{- $newValue = false }}
|
||||
{{- else }}
|
||||
{{- $newValue = $paramValue }}
|
||||
{{- end }}
|
||||
{{- $effects = merge $effects (dict $k $newValue) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $classes := slice }}
|
||||
{{- range $k, $v := $effects }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- $classes = $classes | append $k }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $attributes.class }}{{ $classes = $classes | append (split $attributes.class " ") }}{{ end }}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit $classes " ")) }}
|
||||
{{- $attributes = merge $attributes (dict "href" .url) }}
|
||||
{{- $attributes = merge $attributes (dict "download" $effects.download) }}
|
||||
{{- $attributes = merge $attributes (dict "target" $effects.target) }}
|
||||
{{- return $attributes }}
|
||||
@@ -0,0 +1,48 @@
|
||||
{{- $page := .page }}
|
||||
{{- $linkObject := "" }}
|
||||
{{- $u := urls.Parse .url }}
|
||||
{{- $path := strings.TrimPrefix "./" $u.Path }}
|
||||
{{- $searchLocal := .searchLocal | default true }}
|
||||
{{- $searchGlobal := .searchGlobal | default true }}
|
||||
{{- $searchPage := .searchPage | default true }}
|
||||
{{- $searchResource := .searchResource | default true }}
|
||||
{{- if $path }}
|
||||
{{- with or
|
||||
(and $searchLocal $searchPage ($page.Page.GetPage $path))
|
||||
(and $searchLocal $searchPage ($page.Page.GetPage (strings.TrimRight "/" $path)))
|
||||
(and $searchGlobal $searchPage (site.GetPage $path))
|
||||
(and $searchGlobal $searchPage (site.GetPage (strings.TrimRight "/" $path)))
|
||||
(and $searchLocal $searchResource ($page.Page.Resources.Get $path))
|
||||
(and $searchGlobal $searchResource (resources.Get $path))
|
||||
}}
|
||||
{{- $linkObject = . }}
|
||||
{{- else }}
|
||||
{{- /* is it a link into another translation? */}}
|
||||
{{- if strings.HasPrefix $path "/" }}
|
||||
{{- range $page.AllTranslations }}
|
||||
{{- $lang := .Language.Lang }}
|
||||
{{- $prefix := printf "/%s" $lang }}
|
||||
{{- $suffix := strings.TrimPrefix $prefix $path | default "/" }}
|
||||
{{- /* with the second check we check if the prefix was finished;
|
||||
eg. /pir/index.html vs. /pirate/index.html, were the latter is
|
||||
an external address outside of this site */}}
|
||||
{{- if and (strings.HasPrefix $path $prefix) (strings.HasPrefix $suffix "/") }}
|
||||
{{- with or
|
||||
(and $searchLocal $searchPage (.GetPage $suffix))
|
||||
(and $searchLocal $searchPage (.GetPage (strings.TrimRight "/" $suffix)))
|
||||
(and $searchGlobal $searchPage (site.GetPage $path))
|
||||
(and $searchGlobal $searchPage (site.GetPage (strings.TrimRight "/" $path)))
|
||||
(and $searchLocal $searchResource (.Resources.Get $suffix))
|
||||
(and $searchGlobal $searchResource (resources.Get $suffix))
|
||||
}}
|
||||
{{- $linkObject = . }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $linkObject = $page.Page }}
|
||||
{{- end }}
|
||||
{{- return $linkObject }}
|
||||
@@ -0,0 +1,13 @@
|
||||
{{- $page := . }}
|
||||
{{- if (ne $page.Site.Params.disableRandomIds true) }}
|
||||
{{- $random := "" }}
|
||||
{{- $set := split "012345abcdefghijklmnopqrstuvwxyz" "" }}
|
||||
{{- range (seq 16) }}
|
||||
{{- with ($set | shuffle | first 1) }}
|
||||
{{- $random = printf "%s%s" $random . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- md5 $random }}
|
||||
{{- else }}
|
||||
{{- printf "00000000000000000000000000000000" }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,5 @@
|
||||
{{- $linkObject := "" }}
|
||||
{{- with and . .menu }}
|
||||
{{- $linkObject = partial "_relearn/refObject.gotmpl" (dict "page" $.page "objectRef" .PageRef "refObject" .Page "searchPage" $.searchPage "searchResource" $.searchResource) }}
|
||||
{{- end }}
|
||||
{{- return $linkObject }}
|
||||
@@ -0,0 +1,25 @@
|
||||
{{- $url := "" }}
|
||||
{{- /* because Hugo can not resolve a pageRef if it contains URL query params or
|
||||
fragments, we simply don't access the .Page here */}}
|
||||
{{- with and . .menu }}
|
||||
{{- if .PageRef }}
|
||||
{{- $url = .PageRef }}
|
||||
{{- $linkObject := partial "_relearn/refObject.gotmpl" (dict "page" $.page "objectRef" .PageRef "refObject" .Page) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .PageRef "page" $.page "linkObject" $linkObject "param" "link" "hideFilepath" true) }}
|
||||
{{- else }}
|
||||
{{- $msg := printf "config option 'pageRef' %q for 'menu' entry %q is not a page or a resource" .PageRef (or .KeyName .Identifier .Name .Title) }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .PageRef "page" $.page "param" "link" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- else if .URL }}
|
||||
{{- $url = .URL | relLangURL }}
|
||||
{{- $u := urls.Parse $url }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" $url "page" $.page "type" "menu link") $u.String }}
|
||||
{{- else }}
|
||||
{{- $msg := printf "config option 'url' %q for 'menu' entry %q is a local URL; if it references a page or a resource use 'pageRef' instead" .URL (or .KeyName .Identifier .Name .Title) }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .URL "page" $.page "param" "link" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $url }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- $title := "" }}
|
||||
{{- with and . .menu }}
|
||||
{{- $objectTitle := "" }}
|
||||
{{- $menuPage := partial "_relearn/menuObject.gotmpl" (dict "page" $.page "menu" . "searchResource" false) }}
|
||||
{{- with $menuPage }}
|
||||
{{- $objectTitle = or .LinkTitle .Title }}
|
||||
{{- else }}
|
||||
{{- $menuResource := partial "_relearn/menuObject.gotmpl" (dict "page" $.page "menu" . "searchPage" false) }}
|
||||
{{- with $menuResource }}
|
||||
{{- $objectTitle = .Title }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $title = or .Title (.Name | safeHTML) (.Identifier | safeHTML) }}
|
||||
{{- if and (eq $objectTitle .Title) (ne .Name .Title) }}
|
||||
{{- $title = (.Name | safeHTML) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $title }}
|
||||
@@ -0,0 +1,9 @@
|
||||
{{- /* https://discourse.gohugo.io/t/how-to-know-the-section-depth/37302/4 */ -}}
|
||||
{{- $page := .page }}
|
||||
{{- $depth := .depth | default 0 }}
|
||||
{{- with $page.Parent }}
|
||||
{{- $depth = add $depth 1 }}
|
||||
{{- partial "_relearn/pageDepth.gotmpl" (dict "page" . "depth" $depth) }}
|
||||
{{- else }}
|
||||
{{- $depth }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,4 @@
|
||||
{{- return or
|
||||
.Params.hidden
|
||||
(and .RelPermalink (not (or .Title (partial "title.gotmpl" (dict "page" . "linkTitle" true)))))
|
||||
}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- $ret := false }}
|
||||
{{- with .page }}
|
||||
{{- $ret = partialCached "_relearn/pageIsHidden.gotmpl" . .Path }}
|
||||
{{- if not $ret }}
|
||||
{{- with .Parent }}
|
||||
{{- if eq . $.to }}
|
||||
{{- /* stop if we reach the top */}}
|
||||
{{- else if partialCached "_relearn/pageIsHidden.gotmpl" . .Path }}
|
||||
{{- $ret = true }}
|
||||
{{- else }}
|
||||
{{- $ret = partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" $.to) .Path $.to.Path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $ret }}
|
||||
@@ -0,0 +1,5 @@
|
||||
{{- $ret := false }}
|
||||
{{- if hasPrefix .Path "/_relearn" }}
|
||||
{{- $ret = true }}
|
||||
{{- end }}
|
||||
{{- return $ret }}
|
||||
@@ -0,0 +1,132 @@
|
||||
{{- $next := "" }}
|
||||
{{- if eq .Page.Kind "term" }}
|
||||
{{- /* go to next term page */}}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $pages := partialCached "partials/_relearn/pagesTaxonomy.gotmpl" $taxonomy_page $taxonomy_page.Path }}
|
||||
{{- $next = partial "inline/next-term" (dict "collection" $pages "item" .) }}
|
||||
{{- else if eq .Page.Kind "taxonomy" }}
|
||||
{{- /* go to first term page */}}
|
||||
{{- $pages := partialCached "partials/_relearn/pagesTaxonomy.gotmpl" . .Path }}
|
||||
{{- with index $pages 0 }}
|
||||
{{- $next = .Page }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $next = partial "inline/next-page" . }}
|
||||
{{- end }}
|
||||
{{- return $next }}
|
||||
|
||||
{{- define "partials/inline/next-term" }}
|
||||
{{- $collection := .collection }}
|
||||
{{- $item := .item }}
|
||||
{{- $found := false }}
|
||||
{{- $result := "" }}
|
||||
{{- range $collection }}
|
||||
{{- if $found }}
|
||||
{{- $result = .Page.Page }}
|
||||
{{- break }}
|
||||
{{- else if eq $item .Page.Page }}
|
||||
{{- $found = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $result }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/next-page" }}
|
||||
{{- $nextVisible := "" }}
|
||||
{{- $currentNode := . }}
|
||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" $currentNode) $currentNode.Path }}
|
||||
{{- range $pages }}
|
||||
{{- $nextVisible = partial "inline/leftmost_descendant" . }}
|
||||
{{- if $nextVisible }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not $nextVisible }}
|
||||
{{- $nextVisible = partial "inline/next_sibling_or_ancestor" $currentNode }}
|
||||
{{- end }}
|
||||
{{- return $nextVisible }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/next_sibling_or_ancestor" }}
|
||||
{{- $currentNode := . }}
|
||||
{{- $nextSibling := "" }}
|
||||
{{- with partial "inline/parent" $currentNode }}
|
||||
{{- $parent := . }}
|
||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" $parent) $parent.Path }}
|
||||
{{- $nextVisible := partial "inline/next_sibling" (dict "siblings" $pages "currentNode" $currentNode) }}
|
||||
{{- range $pages }}
|
||||
{{- if not $nextVisible }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- $nextSibling = partial "inline/leftmost_descendant" $nextVisible }}
|
||||
{{- if $nextSibling }}
|
||||
{{- break }}
|
||||
{{- else }}
|
||||
{{- $nextVisible = partial "inline/next_sibling" (dict "siblings" $pages "currentNode" $nextVisible) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not $nextSibling }}
|
||||
{{- if $nextVisible }}
|
||||
{{- $nextSibling = partial "inline/leftmost_descendant" $nextVisible }}
|
||||
{{- end }}
|
||||
{{- if not $nextSibling }}
|
||||
{{- $nextSibling = partial "inline/next_sibling_or_ancestor" $parent }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $nextSibling }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/next_sibling" }}
|
||||
{{- $siblings := .siblings }}
|
||||
{{- $currentNode := .currentNode }}
|
||||
{{- $nextSibling := "" }}
|
||||
{{- $currentFound := false }}
|
||||
{{- range $siblings }}
|
||||
{{- if eq . $currentNode }}
|
||||
{{- $currentFound = true }}
|
||||
{{- else if and $currentFound (not (or (eq .Title "") .Params.hidden .Params.menuUrl .Params.menuPageRef)) }}
|
||||
{{- $nextSibling = . }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $nextSibling }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/leftmost_descendant" }}
|
||||
{{- $leftmostVisible := "" }}
|
||||
{{- if not (or (eq .Title "") .Params.hidden .Params.menuUrl .Params.menuPageRef) }}
|
||||
{{- if .RelPermalink }}
|
||||
{{- $leftmostVisible = . }}
|
||||
{{- else }}
|
||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
||||
{{- range $pages }}
|
||||
{{- with partial "inline/leftmost_descendant" . }}
|
||||
{{- $leftmostVisible = . }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $leftmostVisible }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/parent" }}
|
||||
{{- $nonheadless := "" }}
|
||||
{{- $page := . }}
|
||||
{{- $parent := .Parent }}
|
||||
{{- if not (partial "_relearn/pageIsSpecial.gotmpl" $page) }}
|
||||
{{- with $parent }}
|
||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
||||
{{- range $pages }}
|
||||
{{- if eq . $page }}
|
||||
{{- $nonheadless = $parent }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $nonheadless = $parent }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $nonheadless }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,106 @@
|
||||
{{- $prev := "" }}
|
||||
{{- if eq .Page.Kind "term" }}
|
||||
{{- /* go to previous term page or taxonomy page if it is the first term */}}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $pages := partialCached "partials/_relearn/pagesTaxonomy.gotmpl" $taxonomy_page $taxonomy_page.Path }}
|
||||
{{- $prev = partial "inline/prev-term" (dict "collection" $pages "item" .) | default $taxonomy_page }}
|
||||
{{- else if eq .Page.Kind "taxonomy" }}
|
||||
{{- $prev = .Site.Home }}
|
||||
{{- else if eq .Page.Kind "home" }}
|
||||
{{- /* no prev here */}}
|
||||
{{- else }}
|
||||
{{- $prev = or (partial "inline/prev_page" .) .Site.Home }}
|
||||
{{- end }}
|
||||
{{- return $prev }}
|
||||
|
||||
{{- define "partials/inline/prev-term" }}
|
||||
{{- $collection := .collection }}
|
||||
{{- $item := .item }}
|
||||
{{- $last := "" }}
|
||||
{{- $result := "" }}
|
||||
{{- range $collection }}
|
||||
{{- if eq $item .Page.Page }}
|
||||
{{- $result = $last }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- $last = .Page.Page }}
|
||||
{{- end }}
|
||||
{{- return $result }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/prev_page" }}
|
||||
{{- $previousVisible := "" }}
|
||||
{{- $currentNode := . }}
|
||||
{{- with partial "inline/parent" $currentNode }}
|
||||
{{- $parent := . }}
|
||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" $parent) $parent.Path }}
|
||||
{{- $previousSibling := partial "inline/prev_sibling" (dict "siblings" $pages "currentNode" $currentNode) }}
|
||||
{{- if $previousSibling }}
|
||||
{{- $previousVisible = partial "inline/rightmost_descendant" $previousSibling }}
|
||||
{{- if not $previousVisible }}
|
||||
{{- if $previousSibling.RelPermalink }}
|
||||
{{- $previousVisible = $previousSibling }}
|
||||
{{- else }}
|
||||
{{- $previousVisible = partial "inline/prev_page" $previousSibling }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- if $parent.RelPermalink }}
|
||||
{{- $previousVisible = $parent }}
|
||||
{{- else }}
|
||||
{{- $previousVisible = partial "inline/prev_page" $parent }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $previousVisible }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/prev_sibling" }}
|
||||
{{- $previousSibling := "" }}
|
||||
{{- $siblings := .siblings }}
|
||||
{{- $currentNode := .currentNode }}
|
||||
{{- range $siblings }}
|
||||
{{- if eq . $currentNode }}
|
||||
{{- break }}
|
||||
{{- else if not (or (eq .Title "") .Params.hidden .Params.menuUrl .Params.menuPageRef) }}
|
||||
{{- $previousSibling = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $previousSibling }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/rightmost_descendant" }}
|
||||
{{- $rightmostVisible := . }}
|
||||
{{- $pages := (partialCached "_relearn/pages.gotmpl" (dict "page" $rightmostVisible) $rightmostVisible.Path) | collections.Reverse }}
|
||||
{{- range $pages }}
|
||||
{{- if not (or (eq .Title "") .Params.hidden .Params.menuUrl .Params.menuPageRef) }}
|
||||
{{- with partial "inline/rightmost_descendant" . }}
|
||||
{{- if .RelPermalink }}
|
||||
{{- $rightmostVisible = . }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $rightmostVisible }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/parent" }}
|
||||
{{- $nonheadless := "" }}
|
||||
{{- $page := . }}
|
||||
{{- $parent := .Parent }}
|
||||
{{- if not (partial "_relearn/pageIsSpecial.gotmpl" $page) }}
|
||||
{{- with $parent }}
|
||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
||||
{{- range $pages }}
|
||||
{{- if eq . $page }}
|
||||
{{- $nonheadless = $parent }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $nonheadless = $parent }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $nonheadless }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,40 @@
|
||||
{{- $page := .page }}
|
||||
{{- /* default sort order for the theme is historically by weight */}}
|
||||
{{- $by := .by }}
|
||||
{{- if eq $by "auto" }}
|
||||
{{- $by = "" }}
|
||||
{{- end }}
|
||||
{{- $by = $by | default $page.Params.ordersectionsby | default $page.Site.Params.ordersectionsby | default "weight" }}
|
||||
|
||||
{{- $pages := slice }}
|
||||
|
||||
{{- if eq $by "weight" }}
|
||||
{{- $pages = $page.Pages.ByWeight }}
|
||||
{{- else if or (eq $by "name") (eq $by "title") (eq $by "linktitle") }}
|
||||
{{- $pages = $page.Pages.ByLinkTitle }}
|
||||
{{- else if eq $by "modifieddate" }}
|
||||
{{- $pages = $page.Pages.Lastmod }}
|
||||
{{- else if eq $by "expirydate" }}
|
||||
{{- $pages = $page.Pages.ByExpiryDate }}
|
||||
{{- else if eq $by "publishdate" }}
|
||||
{{- $pages = $page.Pages.ByPublishDate }}
|
||||
{{- else if eq $by "date" }}
|
||||
{{- $pages = $page.Pages.ByDate }}
|
||||
{{- else if eq $by "length" }}
|
||||
{{- $pages = $page.Pages.ByLength }}
|
||||
{{- else if eq $by "default" }}
|
||||
{{- $pages = $page.Pages }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: Unknown pages sort order '%s'" $filepath }}
|
||||
{{- $pages = $page.Pages }}
|
||||
{{- end }}
|
||||
|
||||
{{- $filtered_pages := slice }}
|
||||
{{- range $pages }}
|
||||
{{- if not (partial "_relearn/pageIsSpecial.gotmpl" .) }}
|
||||
{{- $filtered_pages = $filtered_pages | append . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- return $filtered_pages }}
|
||||
@@ -0,0 +1,15 @@
|
||||
{{- $pages := slice }}
|
||||
{{- range .Data.Terms }}
|
||||
{{- $count := 0 }}
|
||||
{{- range .Pages }}
|
||||
{{- /* count pages of term */}}
|
||||
{{- if and .Title .RelPermalink (or (ne .Site.Params.disableTagHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) }}
|
||||
{{- $count = add $count 1 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $count }}
|
||||
{{- $pages = $pages| append (dict "Title" (partial "title.gotmpl" (dict "page" .Page "linkTitle" true)) "Page" .Page "Count" $count )}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $pages = sort $pages ".Title" }}
|
||||
{{- return $pages }}
|
||||
@@ -0,0 +1,8 @@
|
||||
{{- $pages := slice }}
|
||||
{{- range .Pages }}
|
||||
{{- if and .Title .RelPermalink (or (ne .Site.Params.disableTagHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) }}
|
||||
{{- $pages = $pages | append (dict "Title" .Title "Page" . )}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $pages = sort $pages ".Title" }}
|
||||
{{- return $pages }}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- $linkObject := "" }}
|
||||
{{- /* because Hugo can not resolve a pageRef if it contains URL query params or
|
||||
fragments, we do it ourself if we detect such a case */}}
|
||||
{{- with .refObject }}
|
||||
{{- $linkObject = . }}
|
||||
{{- else }}
|
||||
{{- with .objectRef }}
|
||||
{{- $linkObject = partial "_relearn/linkObject.gotmpl" (dict "url" . "page" $.page "searchLocal" false "searchPage" $.searchPage "searchResource" $.searchResource) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $linkObject }}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- /* generates an uphill path from the current page to the root of the site */}}
|
||||
{{- $subdir := strings.TrimSuffix (relLangURL "/") (relLangURL "") }}
|
||||
{{- $relBasePath := .RelPermalink }}
|
||||
{{- $relBasePath = replaceRE "/[^/]*$" "" $relBasePath }}
|
||||
{{- $relBasePath = strings.TrimPrefix $subdir $relBasePath }}
|
||||
{{- $relBasePath = replaceRE "/[^/]*" "/.." $relBasePath }}
|
||||
{{- $relBasePath = trim $relBasePath "/" }}
|
||||
{{- if not $relBasePath }}
|
||||
{{- $relBasePath = "." }}
|
||||
{{- end }}
|
||||
{{- return $relBasePath }}
|
||||
@@ -0,0 +1,10 @@
|
||||
{{- /* generates an uphill path from the current page to the root of the server */}}
|
||||
{{- $subdir := strings.TrimSuffix (relLangURL "/") (relLangURL "") }}
|
||||
{{- $relBaseUri := .RelPermalink }}
|
||||
{{- $relBaseUri = replaceRE "/[^/]*$" "" $relBaseUri }}
|
||||
{{- $relBaseUri = replaceRE "/[^/]*" "/.." $relBaseUri }}
|
||||
{{- $relBaseUri = trim $relBaseUri "/" }}
|
||||
{{- if not $relBaseUri }}
|
||||
{{- $relBaseUri = "." }}
|
||||
{{- end }}
|
||||
{{- return $relBaseUri }}
|
||||
@@ -0,0 +1,260 @@
|
||||
{{- $page := . }}
|
||||
{{- $nonautothemevariants := slice }}
|
||||
{{- $formathtmlpre := ":root:not([data-r-output-format='print']):not([data-r-theme-variant='my-custom-variant'])" }}
|
||||
{{- $formathtml := "" }}
|
||||
{{- $minify := not hugo.IsServer }}
|
||||
{{- if and (isset site.Params "minify") (ne site.Params.minify "") }}
|
||||
{{- $minify = site.Params.minify }}
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
Unification run:
|
||||
- convert from old forms to slice of dicts
|
||||
- add default name property
|
||||
- convert auto property to slice
|
||||
- remember default variants for auto mode
|
||||
*/}}
|
||||
{{- $tempthemevariants := slice | append (.Site.Params.themeVariant | default "auto" ) }}
|
||||
{{- $themevariants := slice }}
|
||||
{{- range $tempthemevariant := $tempthemevariants }}
|
||||
{{- $themevariant := $tempthemevariant }}
|
||||
{{- if not (reflect.IsMap $themevariant) }}
|
||||
{{- $themevariant = dict "identifier" $tempthemevariant }}
|
||||
{{- end }}
|
||||
{{- if not $themevariant.name }}
|
||||
{{- $themevariant = collections.Merge $themevariant (dict "name" ($themevariant.identifier | humanize | strings.Title)) }}
|
||||
{{- end }}
|
||||
{{- if eq $themevariant.identifier "auto" }}
|
||||
{{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | default slice)) }}
|
||||
{{- end }}
|
||||
{{- if not (isset $themevariant "auto") }}
|
||||
{{- $nonautothemevariants = $nonautothemevariants | append $themevariant.identifier }}
|
||||
{{- end }}
|
||||
{{- if eq $themevariant.identifier "my-custom-variant" }}
|
||||
{{- errorf "\"theme-%s.css\": the variant identifier '%s' is reserved for the theme's variant generator, instead rename it to something different" "my-custom-variant" "my-custom-variant" }}
|
||||
{{- end }}
|
||||
{{- $themevariants = $themevariants | append $themevariant }}
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
Generator run:
|
||||
- fill up auto property with defaults
|
||||
- write variant & chroma CSS string of normal variants and for light and dark of auto variants
|
||||
*/}}
|
||||
{{- $defaultautothemevariants := slice }}
|
||||
{{- $defaultautothemevariants = $defaultautothemevariants | append (index .Site.Params.themeVariantAuto 0 | default (index $nonautothemevariants 0) | default "relearn-light") }}
|
||||
{{- $defaultautothemevariants = $defaultautothemevariants | append (index .Site.Params.themeVariantAuto 1 | default (index $nonautothemevariants 1) | default "relearn-dark") }}
|
||||
{{- $tempthemevariants = $themevariants }}
|
||||
{{- $themevariants = slice }}
|
||||
{{- range $tempthemevariant := $tempthemevariants }}
|
||||
{{- $themevariant := $tempthemevariant }}
|
||||
{{- if collections.IsSet $themevariant "auto" }}
|
||||
{{- $light := index $themevariant.auto 0 | default (index $defaultautothemevariants 0) }}
|
||||
{{- $dark := index $themevariant.auto 1 | default (index $defaultautothemevariants 1) }}
|
||||
{{- $themevariant = collections.Merge $themevariant (dict "auto" (slice | append $light | append $dark)) }}
|
||||
{{- $lightthemevariant := partial "inline/get-theme-details" (dict "themevariant" $themevariant "identifier" $light) }}
|
||||
{{- $darkthemevariant := partial "inline/get-theme-details" (dict "themevariant" $themevariant "identifier" $dark) }}
|
||||
{{- $formathtmlpre = print $formathtmlpre
|
||||
":not([data-r-theme-variant='" $themevariant.identifier "'])"
|
||||
}}
|
||||
{{- $formathtml = print $formathtml
|
||||
"\n:root:not([data-r-output-format='print'])[data-r-theme-variant='" $themevariant.identifier "'] {"
|
||||
"\n@media screen and (prefers-color-scheme: light) {"
|
||||
"\n" $lightthemevariant.themecontent
|
||||
"\n" $lightthemevariant.chromacontent
|
||||
"\n}"
|
||||
"\n@media screen and (prefers-color-scheme: dark) {"
|
||||
"\n" $darkthemevariant.themecontent
|
||||
"\n" $darkthemevariant.chromacontent
|
||||
"\n}"
|
||||
"\n}"
|
||||
}}
|
||||
{{- else }}
|
||||
{{- $themevariant = partial "inline/get-theme-details" (dict "themevariant" $themevariant "identifier" $themevariant.identifier)}}
|
||||
{{- $formathtmlpre = print $formathtmlpre
|
||||
":not([data-r-theme-variant='" $themevariant.identifier "'])"
|
||||
}}
|
||||
{{- $formathtml = print $formathtml
|
||||
"\n:root:not([data-r-output-format='print'])[data-r-theme-variant='" $themevariant.identifier "'] {"
|
||||
"\n" $themevariant.themecontent
|
||||
"\n" $themevariant.chromacontent
|
||||
"\n}"
|
||||
}}
|
||||
{{- end }}
|
||||
{{- $themevariants = $themevariants | append $themevariant }}
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
- Read default stuff
|
||||
*/}}
|
||||
{{- $defaultthemevariant := partial "inline/get-theme-details" (dict "themevariant" (dict) "identifier" "relearn-light") }}
|
||||
{{- $nucleuscontent := "" }}
|
||||
{{- with resources.Get "css/nucleus.css" }}
|
||||
{{- $nucleuscontent = .Content }}
|
||||
{{- end }}
|
||||
{{- $fontscontent := "" }}
|
||||
{{- with resources.Get "css/fonts.css" }}
|
||||
{{- $fontscontent = .Content }}
|
||||
{{- end }}
|
||||
{{- $htmlcontent := "" }}
|
||||
{{- with resources.Get "css/format-html.css" }}
|
||||
{{- $htmlcontent = .Content }}
|
||||
{{- end }}
|
||||
{{- $printcontent := "" }}
|
||||
{{- with resources.Get "css/format-print.css" }}
|
||||
{{- $printcontent = .Content }}
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
- Read variables.css and add custom box styles
|
||||
*/}}
|
||||
{{- $variablescontent := "" }}
|
||||
{{- with resources.Get "css/variables.css" }}
|
||||
{{- $boxcontent := "" }}
|
||||
{{- range $page.Site.Params.boxStyle }}
|
||||
{{- $identifier := upper .identifier }}
|
||||
{{- $boxcontent = print $boxcontent
|
||||
"\n --INTERNAL-BOX-" $identifier "-color: var(--BOX-" $identifier "-color, " .color ");"
|
||||
"\n --INTERNAL-BOX-" $identifier "-TEXT-color: var(--BOX-" $identifier "-TEXT-color, var(--INTERNAL-BOX-TEXT-color));"
|
||||
}}
|
||||
{{- end }}
|
||||
{{- $variablescontent = print
|
||||
":root {"
|
||||
"\n" .Content
|
||||
$boxcontent
|
||||
"\n}"
|
||||
}}
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
- Write theme.css
|
||||
*/}}
|
||||
{{- with resources.Get "css/theme.css" }}
|
||||
{{- $boxcontent := "" }}
|
||||
{{- range $page.Site.Params.boxStyle }}
|
||||
{{- $identifier := upper .identifier }}
|
||||
{{- $identifierl := lower .identifier }}
|
||||
{{- $boxcontent = print $boxcontent
|
||||
"\n.cstyle." $identifierl " {"
|
||||
"\n --VARIABLE-BOX-color: var(--INTERNAL-BOX-" $identifier "-color);"
|
||||
"\n --VARIABLE-BOX-TEXT-color: var(--INTERNAL-BOX-" $identifier "-TEXT-color);"
|
||||
"\n}\n"
|
||||
}}
|
||||
{{- end }}
|
||||
{{- $themecontent := print
|
||||
$variablescontent
|
||||
"\n\n" $nucleuscontent
|
||||
"\n" .Content
|
||||
$boxcontent
|
||||
"\n" $fontscontent
|
||||
}}
|
||||
{{- $cssres := $themecontent | resources.FromString "css/theme.css" }}
|
||||
{{- if $minify }}
|
||||
{{- $cssres = $cssres | minify }}
|
||||
{{- end }}
|
||||
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
- Write swagger.css
|
||||
*/}}
|
||||
{{- with resources.Get "css/swagger.css" }}
|
||||
{{- $swaggercontent := print
|
||||
$variablescontent "\n"
|
||||
.Content "\n"
|
||||
$fontscontent "\n"
|
||||
}}
|
||||
{{- $cssres := $swaggercontent | resources.FromString "css/swagger.css" }}
|
||||
{{- if $minify }}
|
||||
{{- $cssres = $cssres | minify }}
|
||||
{{- end }}
|
||||
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
- Write format-html.css
|
||||
*/}}
|
||||
{{- $htmlcontent = print
|
||||
"@media screen {"
|
||||
"\n" $formathtmlpre ","
|
||||
$formathtml
|
||||
"\n}"
|
||||
"\n@media print {"
|
||||
"\n" $defaultthemevariant.themecontent
|
||||
"\n" $defaultthemevariant.chromacontent
|
||||
"\n}"
|
||||
"\n@media print {"
|
||||
"\n" $printcontent
|
||||
"\n}"
|
||||
"\n" $htmlcontent
|
||||
}}
|
||||
{{- $cssres := $htmlcontent | resources.FromString "css/format-html.css" }}
|
||||
{{- if $minify }}
|
||||
{{- $cssres = $cssres | minify }}
|
||||
{{- end }}
|
||||
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
|
||||
|
||||
{{- /*
|
||||
- Write format-print.css
|
||||
*/}}
|
||||
{{- $printcontent = print
|
||||
":root[data-r-output-format='print'] {"
|
||||
"\n" $defaultthemevariant.themecontent
|
||||
"\n" $defaultthemevariant.chromacontent
|
||||
"\n}"
|
||||
"\n" $printcontent
|
||||
}}
|
||||
{{- $cssres := $printcontent | resources.FromString "css/format-print.css" }}
|
||||
{{- if $minify }}
|
||||
{{- $cssres = $cssres | minify }}
|
||||
{{- end }}
|
||||
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
|
||||
|
||||
{{- return $themevariants }}
|
||||
|
||||
{{- define "partials/inline/get-theme-details" }}
|
||||
{{- $themevariant := .themevariant }}
|
||||
{{- $identifier := .identifier }}
|
||||
{{- $themecontent := "" }}
|
||||
{{- with resources.Get (printf "css/theme-%s.css" $identifier) }}
|
||||
{{- $themecontent = replaceRE `([ \t]*)(:root)` "${1}&${2}" .Content }}
|
||||
{{- else }}
|
||||
{{- errorf "\"theme-%s.css\": file not found in \"assets/css\"; if you are migrating from a theme version older thant 6.0.0, you have to move it over from \"static/css\"" $identifier }}
|
||||
{{- end }}
|
||||
{{- $chroma := "" }}
|
||||
{{- $chromacontent := "" }}
|
||||
{{- range findRESubmatch `[ \t]*@import\s+[^$]*?chroma-([^.]*?)\.css` $themecontent }}
|
||||
{{- $chroma = index . 1 }}
|
||||
{{- errorf "\"theme-%s.css\": UNSUPPORTED use of @import for chroma stylesheet, instead use '--CODE-theme: %s;'; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-0-0" $identifier $chroma }}
|
||||
{{- end }}
|
||||
{{- $tempthemecontent := $themecontent }}
|
||||
{{- range findRESubmatch `[ \t]*@import\s+[^$]*?theme-([^.]*?)\.css` $themecontent }}
|
||||
{{- $subidentifier := index . 1 }}
|
||||
{{- $themevariant = partial "inline/get-theme-details" (dict "themevariant" $themevariant "identifier" $subidentifier) }}
|
||||
{{- $tempthemecontent = replaceRE (printf `[ \t]*@import\s+[^$]*?theme-%s\.css["']?\s*\)?\s*;?` $subidentifier) $themevariant.themecontent $tempthemecontent 1 }}
|
||||
{{- $chroma = $themevariant.chroma }}
|
||||
{{- $chromacontent = $themevariant.chromacontent }}
|
||||
{{- end }}
|
||||
{{- $themecontent = replaceRE `(&\s*)+:root` "&:root" $tempthemecontent }}
|
||||
{{- range findRESubmatch `[ \t]*--CODE-theme\s*:\s*([^;]*?)\s*;` $themecontent }}
|
||||
{{- $chroma = index . 1 }}
|
||||
{{- $cssres := resources.Get (printf "css/chroma-%s.css" $chroma) }}
|
||||
{{- if not $cssres }}
|
||||
{{- errorf "\"chroma-%s.css\": file not found in \"assets/css\"; if you are migrating from a theme version older thant 6.0.0, you have to move it over from \"static/css\"" $chroma }}
|
||||
{{- end }}
|
||||
{{- $chromacontent = $cssres.Content }}
|
||||
{{- end }}
|
||||
{{- if not $chroma }}
|
||||
{{- $chroma = "relearn-light" }}
|
||||
{{- $cssres := resources.Get (printf "css/chroma-%s.css" $chroma) }}
|
||||
{{- if not $cssres }}
|
||||
{{- errorf "\"chroma-%s.css\": file not found in \"assets/css\"; if you are migrating from a theme version older thant 6.0.0, you have to move it over from \"static/css\"" $chroma }}
|
||||
{{- end }}
|
||||
{{- $chromacontent = $cssres.Content }}
|
||||
{{- $themecontent = replaceRE `(:root\s*\{[ \t]*)(\s*)` (printf "${1}${2}--CODE-theme: %s;${2}" $chroma) $themecontent }}
|
||||
{{- end }}
|
||||
{{- $themevariant = collections.Merge $themevariant (dict "themecontent" $themecontent) }}
|
||||
{{- $themevariant = collections.Merge $themevariant (dict "chroma" $chroma) }}
|
||||
{{- $themevariant = collections.Merge $themevariant (dict "chromacontent" $chromacontent) }}
|
||||
{{- return $themevariant }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{- $pageParam := index .page.Params .param }}
|
||||
{{- $siteParam := index site.Params .param }}
|
||||
{{- $applyErrorIgnore := .applyErrorIgnore | default true }}
|
||||
{{- $errorlevel := or (and $pageParam $pageParam.errorlevel) (and $siteParam $siteParam.errorlevel) }}
|
||||
{{- $errorignore := slice | append (.page.Params.errorignore | default slice ) | append (site.Params.errorignore | default slice ) }}
|
||||
{{- if and (eq $errorlevel "warning") (partial "inline/show-error" (dict "errorignore" $errorignore "url" .url "applyErrorIgnore" $applyErrorIgnore)) }}
|
||||
{{- warnf .msg }}
|
||||
{{- else if and (eq $errorlevel "error") (partial "inline/show-error" (dict "errorignore" $errorignore "url" .url "applyErrorIgnore" $applyErrorIgnore)) }}
|
||||
{{- errorf .msg }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/show-error" }}
|
||||
{{- $ret := true }}
|
||||
{{- if .applyErrorIgnore }}
|
||||
{{- range .errorignore }}
|
||||
{{- if findRE . $.url 1 }}
|
||||
{{- $ret = false }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $ret }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,4 @@
|
||||
{{/* the following check avoids to print out content of headless bundles if called from nestedContent.gotmpl */}}
|
||||
{{- if .RelPermalink }}
|
||||
{{- partial "content.html" . | safeHTML }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,6 @@
|
||||
{{- $assetsBuster := "" }}
|
||||
{{- $assetBusting := not site.Params.disableAssetsBusting }}
|
||||
{{- if $assetBusting }}
|
||||
{{- $assetsBuster = printf "?%d" now.Unix }}
|
||||
{{- end }}
|
||||
{{- return $assetsBuster }}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- warnf "DEPRECATED partial 'assetbusting.hugo' used, use 'assetbusting.gotmpl' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
|
||||
{{- partial "assetbusting.gotmpl" . }}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- .Store.Set "relearnIsNested" false }}
|
||||
{{- .Render "views/article" }}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
<article>
|
||||
<header class="headline">
|
||||
</header>
|
||||
|
||||
{{- $title := partial "title.gotmpl" (dict "page" .) }}
|
||||
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
||||
{{ partial "partials/shortcodes/taxonomy.html" (dict "page" . "taxonomy" .) }}
|
||||
|
||||
<footer class="footline">
|
||||
</footer>
|
||||
</article>
|
||||
12
themes/hugo-theme-relearn/layouts/partials/bodys/term.html
Normal file
12
themes/hugo-theme-relearn/layouts/partials/bodys/term.html
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
<article>
|
||||
<header class="headline">
|
||||
</header>
|
||||
|
||||
{{- $title := partial "title.gotmpl" (dict "page" .) }}
|
||||
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
||||
{{ partial "partials/shortcodes/term.html" (dict "page" . "term" .) }}
|
||||
|
||||
<footer class="footline">
|
||||
</footer>
|
||||
</article>
|
||||
33
themes/hugo-theme-relearn/layouts/partials/bodys/tree.html
Normal file
33
themes/hugo-theme-relearn/layouts/partials/bodys/tree.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{{- .Store.Set "relearnIsNested" true }}
|
||||
{{- partialCached "inline/article-walker" . .Path | safeHTML }}
|
||||
|
||||
{{- define "partials/inline/article-walker" }}
|
||||
{{- $html := "" }}
|
||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
||||
{{- range $pages }}
|
||||
{{- if not (partialCached "_relearn/pageIsHidden.gotmpl" . .Path) }}
|
||||
{{- $html = printf "%s%s" $html (partialCached "inline/article-walker" . .Path) }}
|
||||
{{- $child := . }}
|
||||
{{- range .Site.Params.relearn.dependencies }}
|
||||
{{- $has := printf "has%s" .name }}
|
||||
{{- $hasnested := printf "relearnHasNested%s" .name }}
|
||||
{{- $.Store.Set $hasnested (or ($.Store.Get $hasnested) ($child.Store.Get $hasnested) ($child.Store.Get $has)) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- $article := "" }}
|
||||
{{- if .Title }}
|
||||
{{- $article = .Render "views/article" }}
|
||||
{{- end }}
|
||||
{{- if len $html }}
|
||||
{{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
|
||||
{{- $html = printf `%s
|
||||
<section>
|
||||
<h1 class="a11y-only">%s</h1>%s
|
||||
</section>` $article (T "Subsections" $title | htmlEscape) $html }}
|
||||
{{- else }}
|
||||
{{- $html = $article }}
|
||||
{{- end }}
|
||||
{{- return $html }}
|
||||
{{- end }}
|
||||
43
themes/hugo-theme-relearn/layouts/partials/breadcrumbs.html
Normal file
43
themes/hugo-theme-relearn/layouts/partials/breadcrumbs.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{{- $page := .page }}
|
||||
{{- $to := $page }}
|
||||
{{- $pageurl := partial "permalink.gotmpl" (dict "to" $page) }}
|
||||
{{- $lasturl := partial "permalink.gotmpl" (dict "to" $page) }}
|
||||
{{- if .dirOnly }}
|
||||
{{- $page = $page.Parent }}
|
||||
{{- $to = $page }}
|
||||
{{- $lasturl = partial "permalink.gotmpl" (dict "to" $page) }}
|
||||
{{- end }}
|
||||
{{- $depth := add 1 (int (partial "_relearn/pageDepth.gotmpl" (dict "page" $page))) }}
|
||||
{{- if .page.Site.Params.disableRootBreadcrumb }}
|
||||
{{- $depth = add $depth -1 }}
|
||||
{{- end }}
|
||||
{{- $breadcrumb := slice }}
|
||||
{{- range seq $depth }}
|
||||
{{- if $to }}
|
||||
{{- if partial "_relearn/pageIsSpecial.gotmpl" $to }}
|
||||
{{- break }}
|
||||
{{- else if or $to.Title (eq $to.Kind "taxonomy") (eq $to.Kind "term") }}
|
||||
{{- $breadcrumb = $breadcrumb | append $to }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- $to = $to.Parent }}
|
||||
{{- end }}
|
||||
{{- $len := len $breadcrumb -}}
|
||||
{{- $breadcrumbReversed := slice }}
|
||||
{{- range seq $len }}
|
||||
{{- $breadcrumbReversed = $breadcrumbReversed | append (index $breadcrumb (sub $len .)) }}
|
||||
{{- end }}
|
||||
{{- $depth := 0 }}
|
||||
{{- range $i, $e := $breadcrumbReversed }}
|
||||
{{- $to := $e }}
|
||||
{{- $depth = add $depth 1 }}
|
||||
{{- $title := partial "title.gotmpl" (dict "page" $to "linkTitle" true) }}
|
||||
{{- $url := partial "permalink.gotmpl" (dict "to" $to) }}
|
||||
{{- $isPage := eq $url $pageurl }}
|
||||
{{- $isLast := eq $url $lasturl }}
|
||||
{{- $link := and $url (not $isPage) }}
|
||||
{{- printf "<li" | safeHTML }}
|
||||
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">{{ if $link }}<a itemprop="item" href="{{ $url }}">{{end}}<span itemprop="name">{{ $title }}</span>{{ if $link }}</a>{{ end }}<meta itemprop="position" content="{{ $depth }}">{{ if not $isLast }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }}</li>
|
||||
{{- end }}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{- $LastModifierDisplayName := "" }}
|
||||
{{- $LastModifierEmail := "" }}
|
||||
{{- $Date := "" }}
|
||||
{{- with .GitInfo }}
|
||||
{{- with .AuthorName }}
|
||||
{{- $LastModifierDisplayName = . }}
|
||||
{{- end }}
|
||||
{{- with .AuthorEmail }}
|
||||
{{- $LastModifierEmail = . }}
|
||||
{{- end }}
|
||||
{{- with .AuthorDate }}
|
||||
{{- $Date = . | time.Format ":date_medium" }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with .Params.LastModifierDisplayName }}
|
||||
{{- $LastModifierDisplayName = . }}
|
||||
{{- end }}
|
||||
{{- with .Params.LastModifierEmail }}
|
||||
{{- $LastModifierEmail = . }}
|
||||
{{- end }}
|
||||
{{- with .Date }}
|
||||
{{- $Date = . | time.Format ":date_medium" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $LastModifierDisplayName }}
|
||||
<i class='fa-fw fas fa-user'></i> {{ with $LastModifierEmail }}<a href="mailto:{{ . }}">{{ end }}{{ $LastModifierDisplayName }}{{ with $LastModifierEmail }}</a>{{ end }}
|
||||
{{- with $Date }}
|
||||
<i class='fa-fw fas fa-calendar'></i> {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- partial "term-list.html" (dict
|
||||
"page" .
|
||||
"taxonomy" "categories"
|
||||
"icon" "layer-group"
|
||||
) }}
|
||||
@@ -0,0 +1 @@
|
||||
{{- partial "tags.html" . }}
|
||||
1
themes/hugo-theme-relearn/layouts/partials/content.html
Normal file
1
themes/hugo-theme-relearn/layouts/partials/content.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ .Content }}
|
||||
@@ -0,0 +1,3 @@
|
||||
<!-- import your comments system
|
||||
{{ template "_internal/disqus.html" . }}
|
||||
-->
|
||||
@@ -0,0 +1,5 @@
|
||||
<!-- Partial intended to be overwritten with tags loaded at the end of the page loading (usually for Javascript)
|
||||
<script>
|
||||
console.log("running some javascript");
|
||||
</script>
|
||||
-->
|
||||
@@ -0,0 +1,8 @@
|
||||
<!-- compat way of adding custom scripts in old Hugo documentation -->
|
||||
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
|
||||
{{- if or (fileExists "static/css/custom.css") (fileExists "assets/css/custom.css") }}
|
||||
<link href="{{"css/custom.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
|
||||
{{- end }}
|
||||
{{- if or (fileExists "static/js/custom.js") (fileExists "assets/js/custom.js") }}
|
||||
<script src="{{"js/custom.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- end }}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- $page := .page }}
|
||||
{{- $location := .location }}
|
||||
{{- partialCached "_relearn/dependencies.gotmpl" $page $page.Path }}
|
||||
{{- range $k, $v := $page.Site.Params.relearn.dependencies }}
|
||||
{{- $has := printf "has%s" $v.name }}
|
||||
{{- $hasnested := printf "relearnHasNested%s" $v.name }}
|
||||
{{- $wants := or ($page.Page.Store.Get $has) (and ($page.Page.Store.Get "relearnIsNested") ($page.Page.Store.Get $hasnested)) }}
|
||||
{{- if and $wants }}
|
||||
{{- if $v.location }}
|
||||
{{- warnf "DEPRECATED parameter 'location' for dependency '%s' configured in your hugo.toml, query the 'location' parameter inside your dependency loader instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-27-0" $k}}
|
||||
{{- end }}
|
||||
{{- if or (not $v.location) (eq $location $v.location) }}
|
||||
{{- $dep := printf "dependencies/%s.html" $k }}
|
||||
{{- partial $dep (dict "page" $page "location" $location) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- warnf "DEPRECATED partial 'dependencies.html' used, use 'dependencies.gotmpl' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
|
||||
{{- partial "dependencies.gotmpl" . }}
|
||||
@@ -0,0 +1,34 @@
|
||||
{{- $page := .page }}
|
||||
{{- $location := .location }}
|
||||
{{- if eq $location "footer" }}
|
||||
{{- with $page }}
|
||||
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
|
||||
{{- $init := "{}" }}
|
||||
{{- if isset .Params "mathjaxinitialize" }}
|
||||
{{- $init = .Params.mathJaxInitialize }}
|
||||
{{- else if isset .Site.Params "mathjaxinitialize" }}
|
||||
{{- $init = .Site.Params.mathJaxInitialize }}
|
||||
{{- end }}
|
||||
<script>
|
||||
function useMathJax( config ){
|
||||
window.MathJax = Object.assign( window.MathJax || {}, {
|
||||
tex: {
|
||||
inlineMath: [['\\(', '\\)'], ['$', '$']], // inline
|
||||
displayMath: [['\\[', '\\]'], ['$$', '$$']], // block
|
||||
},
|
||||
options: {
|
||||
enableMenu: false // avoid translation hassle for context menu
|
||||
}
|
||||
}, config );
|
||||
}
|
||||
useMathJax( JSON.parse({{ $init }}) );
|
||||
</script>
|
||||
{{- if and (isset .Params "custommathjaxurl") .Params.customMathJaxURL }}
|
||||
<script id="MathJax-script" async src="{{ .Params.customMathJaxURL }}"></script>
|
||||
{{- else if and (isset .Site.Params "custommathjaxurl") .Site.Params.customMathJaxURL }}
|
||||
<script id="MathJax-script" async src="{{ .Site.Params.customMathJaxURL }}"></script>
|
||||
{{- else }}
|
||||
<script id="MathJax-script" async src="{{"js/mathjax/tex-mml-chtml.js" | relURL}}{{ $assetBusting }}"></script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,33 @@
|
||||
{{- $page := .page }}
|
||||
{{- $location := .location }}
|
||||
{{- if eq $location "footer" }}
|
||||
{{- with $page }}
|
||||
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
|
||||
<script src="{{"js/d3/d3-color.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-dispatch.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-drag.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-ease.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-interpolate.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-selection.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-timer.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-transition.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-zoom.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/js-yaml.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- if and (isset .Params "custommermaidurl") .Params.customMermaidURL }}
|
||||
<script src="{{ .Params.customMermaidURL }}" defer></script>
|
||||
{{- else if and (isset .Site.Params "custommermaidurl") .Site.Params.customMermaidURL }}
|
||||
<script src="{{ .Site.Params.customMermaidURL }}" defer></script>
|
||||
{{- else }}
|
||||
<script src="{{"js/mermaid.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- end }}
|
||||
{{- $init := "{}" }}
|
||||
{{- if isset .Params "mermaidinitialize" }}
|
||||
{{- $init = .Params.mermaidInitialize }}
|
||||
{{- else if isset .Site.Params "mermaidinitialize" }}
|
||||
{{- $init = .Site.Params.mermaidInitialize }}
|
||||
{{- end }}
|
||||
<script>
|
||||
window.themeUseMermaid = JSON.parse({{ $init }});
|
||||
</script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- $page := .page }}
|
||||
{{- $location := .location }}
|
||||
{{- if eq $location "footer" }}
|
||||
{{- with $page }}
|
||||
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
|
||||
<script src="{{"js/js-yaml.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- $urlOpenapi := "" }}
|
||||
{{- $relOpenapi := "" }}
|
||||
{{- $cssInProject := false }}
|
||||
{{- if and (isset .Params "customopenapiurl") .Params.customOpenapiURL }}
|
||||
{{- $urlOpenapi = .Params.customOpenapiURL }}
|
||||
{{- $relOpenapi = .Params.customOpenapiURL }}
|
||||
{{- else if and (isset .Site.Params "customopenapiurl") .Site.Params.customOpenapiURL }}
|
||||
{{- $urlOpenapi = .Site.Params.customOpenapiURL }}
|
||||
{{- $relOpenapi = .Site.Params.customOpenapiURL }}
|
||||
{{- else }}
|
||||
{{- $urlOpenapi = printf "%s%s" ("js/swagger-ui/swagger-ui-bundle.js" | relURL) $assetBusting }}
|
||||
{{- $relOpenapi = printf "%s%s" ("/js/swagger-ui/swagger-ui-bundle.js") $assetBusting }}
|
||||
{{- $cssInProject = true }}
|
||||
{{- end }}
|
||||
<script>window.noZensmooth = true;</script>
|
||||
<script src="{{ $urlOpenapi }}" defer></script>
|
||||
{{- $urlOpenapi := replace $urlOpenapi "swagger-ui-bundle" "swagger-ui-standalone-preset" }}
|
||||
<script src="{{ $urlOpenapi }}" defer></script>
|
||||
{{- $relOpenapi := replace $relOpenapi "swagger-ui-bundle" "swagger-ui" }}
|
||||
{{- $relOpenapi := replace $relOpenapi ".js" ".css" }}
|
||||
<script>
|
||||
window.themeUseOpenapi = { css: {{ $relOpenapi }}, cssInProject: {{ $cssInProject | safeJS }}, assetsBuster: "{{ $assetBusting }}" };
|
||||
</script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
32
themes/hugo-theme-relearn/layouts/partials/favicon.html
Normal file
32
themes/hugo-theme-relearn/layouts/partials/favicon.html
Normal file
@@ -0,0 +1,32 @@
|
||||
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
|
||||
{{- $faviconMatch := false }}
|
||||
{{- $svg := dict "ext" "svg" "type" "type=\"image/svg+xml\"" }}
|
||||
{{- $png := dict "ext" "png" "type" "type=\"image/png\"" }}
|
||||
{{- $ico := dict "ext" "ico" "type" "type=\"image/x-icon\" sizes=\"any\"" }}
|
||||
{{- $faviconTypes := slice $svg $png $ico }}
|
||||
{{- $faviconNames := slice "favicon" "logo" }}
|
||||
{{- $normal := dict "suffix" "" "media" "" }}
|
||||
{{- $light := dict "suffix" "-light" "media" " media=\"(prefers-color-scheme: light\")" }}
|
||||
{{- $dark := dict "suffix" "-dark" "media" " media=\"(prefers-color-scheme: dark\")" }}
|
||||
{{- $faviconVariants := slice $normal $light $dark }}
|
||||
{{- range $faviconNames }}
|
||||
{{- $faviconName := . }}
|
||||
{{- range $faviconTypes }}
|
||||
{{- $faviconType := . }}
|
||||
{{- range $faviconVariants }}
|
||||
{{- $faviconVariant := . }}
|
||||
{{- with (resources.Get (printf "/images/%s%s.%s" $faviconName $faviconVariant.suffix $faviconType.ext)) }}
|
||||
{{- $faviconMatch = true }}
|
||||
<link href="{{ .RelPermalink }}{{ $assetBusting }}" rel="icon" {{ $faviconType.type | safeHTMLAttr }}{{ $faviconVariant.media | safeHTMLAttr }}>
|
||||
{{- else }}
|
||||
{{- if (fileExists (printf "/static/images/%s%s.%s" $faviconName $faviconVariant.suffix $faviconType.ext)) }}
|
||||
{{- $faviconMatch = true }}
|
||||
<link href="{{ printf "images/%s%s.%s" $faviconName $faviconVariant.suffix $faviconType.ext | relURL }}{{ $assetBusting }}" rel="icon" {{ $faviconType.type | safeHTMLAttr }}{{ $faviconVariant.media | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $faviconMatch }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1 @@
|
||||
{{ .Params.headingPost | safeHTML }}
|
||||
@@ -0,0 +1 @@
|
||||
{{ .Params.headingPre | safeHTML }}
|
||||
2
themes/hugo-theme-relearn/layouts/partials/heading.html
Normal file
2
themes/hugo-theme-relearn/layouts/partials/heading.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{{- $title := partial "title.gotmpl" (dict "page" .) }}
|
||||
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
||||
3
themes/hugo-theme-relearn/layouts/partials/logo.html
Normal file
3
themes/hugo-theme-relearn/layouts/partials/logo.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<a id="R-logo" class="R-default" href="{{ partial "permalink.gotmpl" (dict "to" .Site.Home) }}">
|
||||
<div class="logo-title">{{ .Site.Params.linkTitle | default .Site.Title }}</div>
|
||||
</a>
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
<p>Built with <a href="https://github.com/McShelby/hugo-theme-relearn" title="love"><i class="fas fa-heart"></i></a> by <a href="https://gohugo.io/">Hugo</a></p>
|
||||
@@ -0,0 +1 @@
|
||||
{{ if .Params.menuPost }}{{ .Params.menuPost | safeHTML }}{{ else }}{{ .Params.Post | safeHTML }}{{ end }}
|
||||
1
themes/hugo-theme-relearn/layouts/partials/menu-pre.html
Normal file
1
themes/hugo-theme-relearn/layouts/partials/menu-pre.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ if .Params.menuPre }}{{ .Params.menuPre | safeHTML }}{{ else }}{{ .Params.Pre | safeHTML }}{{ end }}
|
||||
406
themes/hugo-theme-relearn/layouts/partials/menu.html
Normal file
406
themes/hugo-theme-relearn/layouts/partials/menu.html
Normal file
@@ -0,0 +1,406 @@
|
||||
|
||||
{{- $showvisitedlinks := .Site.Params.showVisitedLinks }}
|
||||
<aside id="R-sidebar" class="default-animation{{ if $showvisitedlinks }} showVisitedLinks{{ end }}">
|
||||
{{- $currentNode := . }}
|
||||
<div id="R-header-topbar" class="default-animation"></div>
|
||||
<div id="R-header-wrapper" class="default-animation">
|
||||
<div id="R-header" class="default-animation">
|
||||
{{ partial "logo.html" . }}
|
||||
</div>{{ partial "search.html" . }}
|
||||
</div>
|
||||
<div id="R-homelinks" class="default-animation{{ if not .Site.Params.disableLandingPageButton }} homelinks{{ end }}">
|
||||
{{- if not .Site.Params.disableLandingPageButton }}
|
||||
{{- if (ne .Site.Params.landingPageURL nil) }}
|
||||
{{- warnf "UNSUPPORTED usage of 'landingPageURL' config parameter found, remove it and optionally overwrite the `logo.html` partial to provide a link if it should not point to the project's home page; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/4/#4-2-0" }}
|
||||
{{- end }}
|
||||
<ul>
|
||||
<li><a class="padding" href="{{ partial "permalink.gotmpl" (dict "to" .Site.Home) }}">{{ .Site.Params.landingPageName | default `<i class="fa-fw fas fa-home"></i> Home` | safeHTML }}</a></li>
|
||||
</ul>
|
||||
{{- end }}
|
||||
<hr class="padding">
|
||||
</div>
|
||||
<div id="R-content-wrapper" class="highlightable">
|
||||
{{- $menuconfigs := .Params.sidebarmenus | default site.Params.sidebarmenus | default (slice
|
||||
(dict "type" "page" "identifier" "home")
|
||||
(dict "type" "menu" "identifier" "shortcuts")
|
||||
) }}
|
||||
{{- range $menuconfigs }}
|
||||
{{- $config := . }}
|
||||
{{- if eq $config.type "page" }}
|
||||
{{- partial "partials/inline/page-tree" (dict "currentnode" $currentNode "config" $config "showvisitedlinks" $showvisitedlinks) }}
|
||||
{{- else if eq $config.type "menu" }}
|
||||
{{- partial "partials/inline/menu-tree" (dict "currentnode" $currentNode "config" $config "showvisitedlinks" $showvisitedlinks) }}
|
||||
{{- else }}
|
||||
{{- warnf "WARNING: unknown menu type '%s' found in parameter 'sidebarmenus' for menu '%s'; use either 'page' or 'menu'" $config.type $config.identifier }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $siteLanguages := .Site.Languages }}
|
||||
{{- $showlangswitch := and hugo.IsMultilingual (not .Site.Params.disableLanguageSwitchingButton) (gt (int (len $siteLanguages)) 1) }}
|
||||
{{- $themevariants := partialCached "_relearn/themeVariants.gotmpl" . }}
|
||||
{{- $showvariantswitch := gt (int (len $themevariants)) 1 }}
|
||||
{{- $footer := partial "menu-footer.html" . }}
|
||||
{{- $showfooter := not (eq 0 (int (len ($footer | plainify)))) }}
|
||||
<div class="padding footermargin footerLangSwitch footerVariantSwitch footerVisitedLinks footerFooter{{if $showlangswitch}} showLangSwitch{{end}}{{if $showvariantswitch}} showVariantSwitch{{end}}{{if $showvisitedlinks}} showVisitedLinks{{end}}{{if $showfooter}} showFooter{{end}}"></div>
|
||||
<div id="R-menu-footer">
|
||||
<hr class="padding default-animation footerLangSwitch footerVariantSwitch footerVisitedLinks footerFooter{{if $showlangswitch}} showLangSwitch{{end}}{{if $showvariantswitch}} showVariantSwitch{{end}}{{if $showvisitedlinks}} showVisitedLinks{{end}}{{if $showfooter}} showFooter{{end}}">
|
||||
<div id="R-prefooter" class="footerLangSwitch footerVariantSwitch footerVisitedLinks{{if $showlangswitch}} showLangSwitch{{end}}{{if $showvariantswitch}} showVariantSwitch{{end}}{{if $showvisitedlinks}} showVisitedLinks{{end}}">
|
||||
<ul>
|
||||
<li id="R-select-language-container" class="footerLangSwitch{{if $showlangswitch}} showLangSwitch{{end}}">
|
||||
<div class="padding menu-control">
|
||||
<i class="fa-fw fas fa-language"></i>
|
||||
<span> </span>
|
||||
<div class="control-style">
|
||||
<label class="a11y-only" for="R-select-language">{{ T "Language" }}</label>
|
||||
<select id="R-select-language" onchange="location = this.querySelector( this.value ).dataset.url;">
|
||||
{{- $page := .Page }}
|
||||
{{- $pageLang := .Page.Language.Lang }}
|
||||
{{- range .Page.AllTranslations }}
|
||||
<option id="R-select-language-{{ .Language.Lang }}" value="#R-select-language-{{ .Language.Lang }}" data-url="{{ partial "permalink.gotmpl" (dict "to" .) }}" lang="{{ .Language.LanguageCode }}"{{ if eq $pageLang .Language.Lang }} selected{{ end }}>{{ .Language.LanguageName }}</option>
|
||||
{{- end }}
|
||||
</select>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</li>
|
||||
<li id="R-select-variant-container" class="footerVariantSwitch{{if $showvariantswitch}} showVariantSwitch{{end}}">
|
||||
<div class="padding menu-control">
|
||||
<i class="fa-fw fas fa-paint-brush"></i>
|
||||
<span> </span>
|
||||
<div class="control-style">
|
||||
<label class="a11y-only" for="R-select-variant">{{ T "Theme" }}</label>
|
||||
<select id="R-select-variant" onchange="window.relearn.changeVariant( this.value );">
|
||||
{{- $firstvariant := true }}
|
||||
{{- range $themevariants }}
|
||||
{{- $themevariant := . }}
|
||||
<option id="R-select-variant-{{ $themevariant.identifier }}" value="{{ $themevariant.identifier }}"{{- if $firstvariant }} selected{{ end }}>{{ $themevariant.name }}</option>
|
||||
{{- $firstvariant = false }}
|
||||
{{- end }}
|
||||
</select>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<script>window.relearn.markVariant();</script>
|
||||
</li>
|
||||
<li class="footerVisitedLinks{{if $showvisitedlinks}} showVisitedLinks{{end}}">
|
||||
<div class="padding menu-control">
|
||||
<i class="fa-fw fas fa-history"></i>
|
||||
<span> </span>
|
||||
<div class="control-style">
|
||||
<button onclick="clearHistory();">{{ T "Clear-History" }}</button>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="R-footer" class="footerFooter{{if $showfooter}} showFooter{{end}}">
|
||||
{{- $footer }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
{{- define "partials/inline/page-tree" }}
|
||||
{{- $currentNode := .currentnode }}
|
||||
{{- $config := .config }}
|
||||
{{- $showvisitedlinks := .showvisitedlinks }}
|
||||
<div id="R-shortcutmenu-{{ $config.identifier }}" class="R-sidebarmenu">
|
||||
{{- $rootObject := site.Home }}
|
||||
{{- if $config.pageRef }}
|
||||
{{- $rootObject = partial "_relearn/refObject.gotmpl" (dict "page" $currentNode "objectRef" $config.pageRef) }}
|
||||
{{- if not $rootObject }}
|
||||
{{- $msg := printf "config option 'pageRef' %q for 'sidebarmenus' %q is not a page or a resource" $config.pageRef $config.identifier }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $config.pageRef "page" $currentNode "param" "link" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $rootObject }}
|
||||
{{- $entry := . }}
|
||||
{{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" $entry) $entry.Path }}
|
||||
{{- $title := "" }}
|
||||
{{- if not ($config.disableTitle | default true) }}
|
||||
{{- $title = $entry.Params.menuTitle | default (T (print $config.identifier "-menuTitle")) }}
|
||||
{{- end }}
|
||||
{{- with $title }}
|
||||
<div class="nav-title padding">{{ . }}</div>
|
||||
{{- end }}
|
||||
{{- $classes := "space " }}
|
||||
{{- if ($config.main | default true) }}
|
||||
{{- $classes = "enlarge morespace " }}
|
||||
{{- end }}
|
||||
<ul class="{{ $classes }}collapsible-menu">
|
||||
{{- $defaultAlwaysopen := site.Params.alwaysopen | default false }}
|
||||
{{- range $entries }}
|
||||
{{- $isSubSelf := eq . $currentNode }}
|
||||
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
||||
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
||||
{{- $isSubCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||
{{- if or $isSubSelf $isSubAncestor }}
|
||||
{{- partial "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) }}
|
||||
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not $entry.RelPermalink) (eq $entry $currentNode) ($entry.IsAncestor $currentNode)) }}
|
||||
{{- $id := md5 .Path }}
|
||||
{{- partialCached "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) $id }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- define "partials/inline/page-walker" }}
|
||||
{{- $currentNode := .currentnode }}
|
||||
{{- $showvisitedlinks := .showvisitedlinks }}
|
||||
{{- $alwaysopen := .alwaysopen }}
|
||||
{{- $isSelf := .isSelf }}
|
||||
{{- $isAncestor := .isAncestor }}
|
||||
{{- $isHidden := .isHidden }}
|
||||
{{- with .sect }}
|
||||
{{- $isActive := $isSelf }}
|
||||
{{- $entry := . }}
|
||||
{{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
||||
{{- $hasVisibleChildren := false }}
|
||||
{{- range $entries }}
|
||||
{{- $isSubSelf := eq . $currentNode }}
|
||||
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
||||
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
||||
{{- if or $isSubAncestor $isSubSelf (not $isSubHidden) }}
|
||||
{{- $hasVisibleChildren = true }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
|
||||
{{- $url := partial "permalink.gotmpl" (dict "to" .) }}
|
||||
{{- $isCrosslink := false }}
|
||||
{{- if .Params.menuPageRef }}
|
||||
{{- $isCrosslink = true }}
|
||||
{{- $url = .Params.menuPageRef }}
|
||||
{{- $linkObject := partial "_relearn/refObject.gotmpl" (dict "page" . "objectRef" .Params.menuPageRef) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .Params.menuPageRef "page" . "linkObject" $linkObject "param" "link" "silent" true) }}
|
||||
{{- end }}
|
||||
{{- else if .Params.menuUrl }}
|
||||
{{- $isCrosslink = true }}
|
||||
{{- $url = .Params.menuUrl | relLangURL }}
|
||||
{{- end }}
|
||||
{{- $pre := partial "menu-pre.html" . }}
|
||||
{{- $post := partial "menu-post.html" . }}
|
||||
{{- if and $hasVisibleChildren (not $isCrosslink) }}
|
||||
{{- $isCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||
{{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
|
||||
{{- if and (not $url) (not $isCollapsible) }}
|
||||
{{- $currentAlwaysopen = true }}
|
||||
{{- end }}
|
||||
{{- $entryId := md5 .Path }}
|
||||
{{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
|
||||
<li class="{{if $isActive }}active {{end}}{{if (or $isSelf $isAncestor) }}parent {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}{{if $currentAlwaysopen}}alwaysopen {{end}}" data-nav-id="{{ $url }}">
|
||||
{{- if $isCollapsible }}<input type="checkbox" id="R-section-{{ $entryId }}" aria-controls="R-subsections-{{ $entryId }}"{{ if $isOpen }} checked{{ end }}><label for="R-section-{{ $entryId }}"><i class="fa-fw fas fa-chevron-right"></i><span class="a11y-only">{{ T "Submenu" $title }}</span></label>{{ end }}
|
||||
{{- if $url }}
|
||||
{{- $attributes := partial "_relearn/linkAttributes.gotmpl" (dict "url" $url "page" $currentNode "attributes" (dict "class" "padding")) -}}
|
||||
<a
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- printf " %s" $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
{{- else -}}
|
||||
<span class="padding">
|
||||
{{- end }}
|
||||
{{- $pre }}{{ $title }}{{ $post }}
|
||||
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}<ul id="R-subsections-{{ $entryId }}" class="collapsible-menu">
|
||||
{{- $defaultAlwaysopen := site.Params.alwaysopen | default true }}
|
||||
{{- range $entries }}
|
||||
{{- $isSubSelf := eq . $currentNode }}
|
||||
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
||||
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
||||
{{- $isSubCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||
{{- if or $isSubSelf $isSubAncestor }}
|
||||
{{- partial "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) }}
|
||||
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not $entry.RelPermalink) (eq $entry $currentNode) ($entry.IsAncestor $currentNode)) }}
|
||||
{{- $id := md5 .Path }}
|
||||
{{- partialCached "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) $id }}
|
||||
{{- end }}
|
||||
{{- end }}</ul></li>
|
||||
{{- else if $url }}
|
||||
<li class="{{if $isActive }}active {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}{{if $isCrosslink }}crosslink {{end}}" data-nav-id="{{ $url }}">
|
||||
{{- if $url }}
|
||||
{{- $attributes := partial "_relearn/linkAttributes.gotmpl" (dict "url" $url "page" $currentNode "attributes" (dict "class" "padding")) -}}
|
||||
<a
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- printf " %s" $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
{{- else -}}
|
||||
<span class="padding">
|
||||
{{- end }}
|
||||
{{- $pre }}{{ $title }}{{ $post }}
|
||||
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/menu-tree" }}
|
||||
{{- $currentNode := .currentnode }}
|
||||
{{- $config := .config }}
|
||||
{{- $showvisitedlinks := .showvisitedlinks }}
|
||||
{{- with index site.Menus $config.identifier }}
|
||||
<div id="R-shortcutmenu-{{ $config.identifier }}" class="R-sidebarmenu">
|
||||
{{- $topLevelMenu := "" }}
|
||||
{{- $topLevelObject := "" }}
|
||||
{{- $entries := . }}
|
||||
{{- with and (eq (len $entries) 1) (index $entries 0) }}
|
||||
{{- if and (not .PageRef) (not .URL) }}
|
||||
{{- /* because in Hugo menus can not have parameter but menu entries can,
|
||||
we can flag a single top level menu entry as a container; this container
|
||||
entry carrys just meta information and parameter, uses its children
|
||||
to build the "real" menu, and has no own `url` or `pageRef` */}}
|
||||
{{- $topLevelMenu = . }}
|
||||
{{- $topLevelObject = partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" $topLevelMenu) }}
|
||||
{{- $entries = .Children }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $title := "" }}
|
||||
{{- if not ($config.disableTitle | default false) }}
|
||||
{{- if $topLevelMenu }}
|
||||
{{- $title = partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" $topLevelMenu) }}
|
||||
{{- else if eq $config.identifier "shortcuts" }}
|
||||
{{- if not site.Params.DisableShortcutsTitle }}
|
||||
{{- $title = T (print $config.identifier "-menuTitle") }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $title = T (print $config.identifier "-menuTitle") }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $title }}
|
||||
<div class="nav-title padding">{{ . }}</div>
|
||||
{{- end }}
|
||||
{{- $classes := "space " }}
|
||||
{{- if ($config.main | default false) }}
|
||||
{{- $classes = "enlarge morespace " }}
|
||||
{{- end }}
|
||||
<ul class="{{ $classes }}collapsible-menu">
|
||||
{{- $root := or $topLevelMenu site }}
|
||||
{{- $defaultAlwaysopen := site.Params.alwaysopen | default false }}
|
||||
{{- range $entries }}
|
||||
{{- $entriesObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" .) }}
|
||||
{{- $isSubSelf := eq $entriesObject $currentNode }}
|
||||
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
||||
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
|
||||
{{- $isSubCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||
{{- if or $isSubSelf $isSubAncestor }}
|
||||
{{- partial "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) }}
|
||||
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not (partial "_relearn/menuPermalink.gotmpl" (dict "page" $currentNode "menu" $topLevelMenu))) (eq $topLevelObject $currentNode) (and $topLevelMenu ($currentNode.HasMenuCurrent $topLevelMenu.Menu $topLevelMenu))) }}
|
||||
{{- $id := md5 (print .) }}
|
||||
{{- partialCached "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) $id }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{- else }}
|
||||
{{- if ne $config.identifier "shortcuts" }}
|
||||
{{- $msg := printf "config option 'identifier' for 'sidebarmenus' %q is not a menu" $config.identifier }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $config.pageRef "page" $currentNode "param" "link" "msg" $msg "applyErrorIgnore" false) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- define "partials/inline/menu-walker" }}
|
||||
{{- $currentNode := .currentnode }}
|
||||
{{- $showvisitedlinks := .showvisitedlinks }}
|
||||
{{- $alwaysopen := .alwaysopen }}
|
||||
{{- $isSelf := .isSelf }}
|
||||
{{- $isAncestor := .isAncestor }}
|
||||
{{- $isHidden := .isHidden }}
|
||||
{{- $root := .root }}
|
||||
{{- with .menu }}
|
||||
{{- $isActive := $isSelf }}
|
||||
{{- $entryMenu := . }}
|
||||
{{- $entryObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" $entryMenu) }}
|
||||
{{- $entries := .Children }}
|
||||
{{- $hasVisibleChildren := false }}
|
||||
{{- range $entries }}
|
||||
{{- $entriesObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" .) }}
|
||||
{{- $isSubSelf := eq $entriesObject $currentNode }}
|
||||
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
||||
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
|
||||
{{- if or $isSubAncestor $isSubSelf (not $isSubHidden) }}
|
||||
{{- $hasVisibleChildren = true }}
|
||||
{{- break }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $title := partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .) }}
|
||||
{{- $url := partial "_relearn/menuPermalink.gotmpl" (dict "page" $currentNode "menu" .) }}
|
||||
{{- $pre := .Pre }}
|
||||
{{- $post := .Post }}
|
||||
{{- with $entryObject }}
|
||||
{{- $pre = or $pre (partial "menu-pre.html" .) }}
|
||||
{{- $post = or $post (partial "menu-post.html" .) }}
|
||||
{{- end }}
|
||||
{{- if $hasVisibleChildren }}
|
||||
{{- $isCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||
{{- $currentAlwaysopen := .Params.alwaysopen | default $root.Params.alwaysopen | default $alwaysopen }}
|
||||
{{- if and (not $url) (not $isCollapsible) }}
|
||||
{{- $currentAlwaysopen = true }}
|
||||
{{- end }}
|
||||
{{- $entryId := md5 (print $entryMenu) }}
|
||||
{{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
|
||||
<li class="{{if $isActive }}active {{end}}{{if (or $isSelf $isAncestor) }}parent {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}{{if $currentAlwaysopen}}alwaysopen {{end}}" data-nav-id="{{ $url }}">
|
||||
{{- if $isCollapsible }}<input type="checkbox" id="R-section-{{ $entryId }}" aria-controls="R-subsections-{{ $entryId }}"{{ if $isOpen }} checked{{ end }}><label for="R-section-{{ $entryId }}"><i class="fa-fw fas fa-chevron-right"></i><span class="a11y-only">{{ T "Submenu" $title }}</span></label>{{ end }}
|
||||
{{- if $url }}
|
||||
{{- $attributes := partial "_relearn/linkAttributes.gotmpl" (dict "url" $url "page" $currentNode "attributes" (dict "class" "padding")) -}}
|
||||
<a
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- printf " %s" $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
{{- else -}}
|
||||
<span class="padding">
|
||||
{{- end }}
|
||||
{{- $pre }}{{ $title }}{{ $post }}
|
||||
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}<ul id="R-subsections-{{ $entryId }}" class="collapsible-menu">
|
||||
{{- $defaultAlwaysopen := site.Params.alwaysopen | default true }}
|
||||
{{- range $entries }}
|
||||
{{- $entriesObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" .) }}
|
||||
{{- $isSubSelf := eq $entriesObject $currentNode }}
|
||||
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
||||
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
|
||||
{{- $isSubCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||
{{- if or $isSubSelf $isSubAncestor }}
|
||||
{{- partial "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) }}
|
||||
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not (partial "_relearn/menuPermalink.gotmpl" (dict "page" $currentNode "menu" $entryMenu))) (eq $entryObject $currentNode) ($currentNode.HasMenuCurrent $entryMenu.Menu $entryMenu)) }}
|
||||
{{- $id := md5 (print .) }}
|
||||
{{- partialCached "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) $id }}
|
||||
{{- end }}
|
||||
{{- end }}</ul></li>
|
||||
{{- else if $url }}
|
||||
<li class="{{if $isActive }}active {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}" data-nav-id="{{ $url }}">
|
||||
{{- if $url }}
|
||||
{{- $attributes := partial "_relearn/linkAttributes.gotmpl" (dict "url" $url "page" $currentNode "attributes" (dict "class" "padding")) -}}
|
||||
<a
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- printf " %s" $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
{{- else -}}
|
||||
<span class="padding">
|
||||
{{- end }}
|
||||
{{- $pre }}{{ $title }}{{ $post }}
|
||||
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
47
themes/hugo-theme-relearn/layouts/partials/meta.html
Normal file
47
themes/hugo-theme-relearn/layouts/partials/meta.html
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
<meta charset="utf-8">
|
||||
{{- /* to avoid that user swiping to the left leaves a gap on the right side, we set minimum-scale, even if not advised to */}}
|
||||
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0">
|
||||
{{- if (ne .Site.Params.disableGeneratorVersion true) }}
|
||||
{{- $gen := hugo.Generator }}
|
||||
{{- $gen = replaceRE "\\s*/>$" ">" $gen }}
|
||||
{{ $gen | safeHTML }}
|
||||
{{- $ver := partial "version.txt" }}
|
||||
{{- $ver := printf "<meta name=\"generator\" content=\"%s %s\">" "Relearn" $ver }}
|
||||
{{ $ver | safeHTML }}
|
||||
{{- end }}
|
||||
{{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
|
||||
{{- if not (and $title .RelPermalink (or (ne .Site.Params.disableSeoHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) ) }}
|
||||
<meta name="robots" content="noindex, nofollow, noarchive, noimageindex">
|
||||
{{- end }}
|
||||
{{- $url := "" }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and .File .File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $errorlevel := or .Params.link.errorlevel .Site.Params.link.errorlevel }}
|
||||
{{- if .Params.menuPageRef }}
|
||||
{{- $url = .Params.menuPageRef }}
|
||||
{{- $linkObject := partial "_relearn/refObject.gotmpl" (dict "page" . "objectRef" .Params.menuPageRef) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .Params.menuPageRef "page" . "linkObject" $linkObject "param" "link") }}
|
||||
{{- else }}
|
||||
{{- $msg := printf "%q: front matter 'menuPageRef' %q is not a page or a resource" $filepath .Params.menuPageRef }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .Params.menuPageRef "page" . "param" "link" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- else if .Params.menuUrl }}
|
||||
{{- $url = .Params.menuUrl | relLangURL }}
|
||||
{{- $u := urls.Parse $url }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" $url "page" . "type" "menu link") $u.String }}
|
||||
{{- else }}
|
||||
{{- $msg := printf "%q: front matter 'menuUrl' is a local URL; if it references a page or a resource use 'menuPageRef' instead" $filepath .Params.menuUrl }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .Params.menuUrl "page" . "param" "link" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $url }}
|
||||
<meta http-equiv="refresh" content="0; url={{ $url }}">
|
||||
{{- end }}
|
||||
<meta name="description" content="{{ with trim (or .Description .Summary | plainify | htmlUnescape) "\n\r\t " }}{{ . }}{{ end }}">
|
||||
{{- $authorName := partialCached "_relearn/authorName.gotmpl" . }}
|
||||
<meta name="author" content="{{ $authorName }}">
|
||||
{{- partial "twitter_cards.html" . }}
|
||||
{{- partial "opengraph.html" . }}
|
||||
{{- partial "schema.html" . }}
|
||||
84
themes/hugo-theme-relearn/layouts/partials/opengraph.html
Normal file
84
themes/hugo-theme-relearn/layouts/partials/opengraph.html
Normal file
@@ -0,0 +1,84 @@
|
||||
{{- /* based on Hugo 0.125.5 opengraph.html */}}
|
||||
<meta property="og:url" content="{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}">
|
||||
|
||||
{{- with site.Title | plainify }}
|
||||
<meta property="og:site_name" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- with partial "title.gotmpl" (dict "page" . "fullyQualified" true "reverse" true) | plainify }}
|
||||
<meta property="og:title" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- with trim (or .Description .Summary | plainify | htmlUnescape) "\n\r\t " }}
|
||||
<meta property="og:description" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- with site.Language.LanguageCode }}
|
||||
<meta property="og:locale" content="{{ replace . `-` `_` }}">
|
||||
{{- end }}
|
||||
|
||||
{{- if and .IsPage (not (partial "_relearn/pageIsSpecial.gotmpl" .)) }}
|
||||
<meta property="og:type" content="article">
|
||||
{{- with .FirstSection }}
|
||||
<meta property="article:section" content="{{ partial "title.gotmpl" (dict "page" .) | plainify }}">
|
||||
{{- end }}
|
||||
{{- $iso8601 := "2006-01-02T15:04:05-07:00" }}
|
||||
{{- with or .PublishDate .Date }}
|
||||
<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
{{- with .Lastmod }}
|
||||
<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
{{- range .GetTerms "tags" | first 6 }}
|
||||
<meta property="article:tag" content="{{ partial "title.gotmpl" (dict "page" .Page "linkTitle" true) | plainify }}">
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
<meta property="og:type" content="website">
|
||||
{{- end }}
|
||||
|
||||
{{- with partial "_funcs/get-page-images" . }}
|
||||
{{- range . | first 6 }}
|
||||
<meta property="og:image" content="{{ .Permalink }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Params.audio }}
|
||||
{{- range . | first 6 }}
|
||||
<meta property="og:audio" content="{{ . | absURL }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Params.videos }}
|
||||
{{- range . | first 6 }}
|
||||
<meta property="og:video" content="{{ . | absURL }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- range .GetTerms "series" }}
|
||||
{{- range .Pages | first 7 }}
|
||||
{{- if ne $ . }}
|
||||
<meta property="og:see_also" content="{{ .Permalink }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- $facebookApp := "" }}
|
||||
{{- with site.Params.social }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .facebook_app_id }}
|
||||
{{- $facebookApp = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with site.Params.social }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .facebook_app_id }}
|
||||
<meta property="fb:app_id" content="{{ . }}">
|
||||
{{- else }}
|
||||
{{- with .facebook_admin }}
|
||||
<meta property="fb:admins" content="{{ . }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1 @@
|
||||
{{- warnf "DEPRECATED partial 'page-meta.hugo' used, delete it from your templates; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- warnf "DEPRECATED partial 'pageHelper/title.hugo' used, use 'title.gotmpl' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
|
||||
{{- partial "title.gotmpl" . }}
|
||||
19
themes/hugo-theme-relearn/layouts/partials/permalink.gotmpl
Normal file
19
themes/hugo-theme-relearn/layouts/partials/permalink.gotmpl
Normal file
@@ -0,0 +1,19 @@
|
||||
{{- $to := .to }}
|
||||
{{- $abs := .abs }}
|
||||
{{- $basename := .basename }}
|
||||
{{- $link := "" }}
|
||||
{{- if isset . "link" }}
|
||||
{{- $link = .link }}
|
||||
{{- else if not $to }}
|
||||
{{- else if $abs }}
|
||||
{{- $link = $to.Permalink }}
|
||||
{{- else }}
|
||||
{{- $link = $to.RelPermalink }}
|
||||
{{- end }}
|
||||
{{- if not $basename }}
|
||||
{{- $basename = "index" }}
|
||||
{{- end }}
|
||||
{{- if and (ne site.Params.disableExplicitIndexURLs true) (eq (substr $link -1) "/") }}
|
||||
{{- $link = printf "%s%s.html" $link $basename }}
|
||||
{{- end }}
|
||||
{{- $link }}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- warnf "DEPRECATED partial 'relLangPrettyUglyURL.hugo' used, use 'permalink.gotmpl' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
|
||||
{{- partial "permalink.gotmpl" . }}
|
||||
57
themes/hugo-theme-relearn/layouts/partials/schema.html
Normal file
57
themes/hugo-theme-relearn/layouts/partials/schema.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{{- /* based on Hugo 0.125.5 schema.html */}}
|
||||
{{- with partial "title.gotmpl" (dict "page" . "fullyQualified" true "reverse" true) | plainify }}
|
||||
<meta itemprop="name" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- with trim (or .Description .Summary | plainify | htmlUnescape) "\n\r\t " }}
|
||||
<meta itemprop="description" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
||||
{{- with or .PublishDate .Date }}
|
||||
<meta itemprop="datePublished" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
|
||||
{{- with .Lastmod }}
|
||||
<meta itemprop="dateModified" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
|
||||
{{- with .WordCount }}
|
||||
<meta itemprop="wordCount" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- $images := partial "_funcs/get-page-images" . }}
|
||||
{{- range first 6 $images }}
|
||||
<meta itemprop="image" content="{{ .Permalink }}">
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
Keywords precedence:
|
||||
|
||||
1. Use "keywords" term page titles.
|
||||
2. Use "keywords" from front matter if "keywords" is not a taxonomy.
|
||||
3. Use "tags" term page titles.
|
||||
4. Use term page titles from all taxonomies.
|
||||
|
||||
*/}}
|
||||
{{- $keywords := slice }}
|
||||
{{- range .GetTerms "keywords" }}
|
||||
{{- $keywords = $keywords | append (partial "title.gotmpl" (dict "page" .Page "linkTitle" true) | plainify) }}
|
||||
{{- else }}
|
||||
{{- with .Keywords }}
|
||||
{{- $keywords = . }}
|
||||
{{- else }}
|
||||
{{- range .GetTerms "tags" }}
|
||||
{{- $keywords = $keywords | append (partial "title.gotmpl" (dict "page" .Page "linkTitle" true) | plainify) }}
|
||||
{{- else }}
|
||||
{{- range $taxonomy, $_ := site.Taxonomies }}
|
||||
{{- range $.GetTerms $taxonomy }}
|
||||
{{- $keywords = $keywords | append (partial "title.gotmpl" (dict "page" .Page "linkTitle" true) | plainify) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $keywords }}
|
||||
<meta itemprop="keywords" content="{{ delimit . `,` }}">
|
||||
{{- end }}
|
||||
70
themes/hugo-theme-relearn/layouts/partials/search.html
Normal file
70
themes/hugo-theme-relearn/layouts/partials/search.html
Normal file
@@ -0,0 +1,70 @@
|
||||
{{- if not .Site.Params.disableSearch }}
|
||||
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
|
||||
{{- $link := "" }}
|
||||
{{- with .Site.Home.OutputFormats.Get "search" }}
|
||||
{{- warnf "UNSUPPORTED usage of 'search' output format found, remove it from your config; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
|
||||
{{- end }}
|
||||
{{- with .Site.Home.OutputFormats.Get "searchpage" }}
|
||||
{{- warnf "UNSUPPORTED usage of 'searchpage' output format found, remove it from your config; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
|
||||
{{- end }}
|
||||
{{- if not .Site.Params.disableSearchIndex }}
|
||||
{{- $url := trim (or .Site.Params.searchIndexURL "searchindex.js") "/" }}
|
||||
{{- $url = path.Join (path.Dir $url) (print (path.BaseName $url) "." .Language.Lang (path.Ext $url)) }}
|
||||
{{- if .IsHome }}
|
||||
{{- $templateres := resources.Get "_relearn_searchindex.js" }}
|
||||
{{- $resultres := $templateres | resources.ExecuteAsTemplate $url .Site.Home }}
|
||||
{{- /* the following code causes Hugo to generate our file - although it is in comments */}}<!-- {{ $resultres.RelPermalink }} -->
|
||||
{{- end }}
|
||||
<script>
|
||||
window.index_js_url={{ (printf "%s%s" $url $assetBusting) | relURL }};
|
||||
</script>
|
||||
{{- if not .Site.Params.disableSearchPage }}
|
||||
{{- with .Site.GetPage "/_relearn/searchpage/_relearn_searchpage" }}
|
||||
{{- $link = partial "permalink.gotmpl" (dict "to" .) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
<search>{{ if $link }}<form action="{{ $link }}" method="get">{{ end }}
|
||||
<div class="searchbox default-animation">
|
||||
{{ if $link }}<button class="search-detail" type="submit" title="{{ T "Search" }} (CTRL+ALT+f)">{{ end }}<i class="fas fa-search"{{ if not $link }} title="{{ T "Search" }} (CTRL+ALT+f)"{{ end }}></i>{{ if $link }}</button>{{ end }}
|
||||
<label class="a11y-only" for="R-search-by">{{ T "Search" }}</label>
|
||||
<input data-search-input id="R-search-by" name="search-by" class="search-by" type="search" placeholder="{{ T "Search-placeholder" }}">
|
||||
<button class="search-clear" type="button" data-search-clear="" title="{{ T "Clear-search" }}"><i class="fas fa-times" title="{{ T "Clear-search" }}"></i></button>
|
||||
</div>
|
||||
{{ if $link }}</form>{{ end }}</search>
|
||||
{{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Language.LanguageCode }}
|
||||
{{- $contentlangs := (union (slice | append (.Site.Params.additionalContentLanguage | default slice)) (slice $pageBaseLang)) }}
|
||||
{{- $quotedcontentlangs := slice }}
|
||||
{{- $missingcontentlangs := slice }}
|
||||
{{- range $contentlangs }}
|
||||
{{- $f := printf "/static/js/lunr/lunr.%s.min.js" . }}
|
||||
{{- if partialCached "_relearn/fileExists.gotmpl" $f $f }}
|
||||
{{- $quotedcontentlangs = $quotedcontentlangs | append (printf "'%s'" .) }}
|
||||
{{- else }}
|
||||
{{- $missingcontentlangs = $missingcontentlangs | append . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $contentlangs = $contentlangs | complement $missingcontentlangs }}
|
||||
<script>
|
||||
var contentLangs=[{{ delimit $quotedcontentlangs ", " | safeJS }}];
|
||||
</script>
|
||||
<script src="{{"js/auto-complete.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/lunr/lunr.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/lunr/lunr.stemmer.support.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/lunr/lunr.multi.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- $tinyseg := false }}
|
||||
{{- $wordcut := false }}
|
||||
{{- range $contentlangs }}
|
||||
{{- if and (not $tinyseg) (or (eq . "ja")) }}
|
||||
{{- $tinyseg = true }}
|
||||
<script src="{{"js/lunr/tinyseg.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- end }}
|
||||
{{- if and (not $wordcut) (or (eq . "hi") (eq . "th")) }}
|
||||
{{- $wordcut = true }}
|
||||
<script src="{{"js/lunr/wordcut.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- end }}
|
||||
{{- $file := (printf "js/lunr/lunr.%s.min.js" .) }}
|
||||
<script src="{{ $file | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- end }}
|
||||
<script src="{{ "js/search.js" | relURL }}{{ $assetBusting }}" defer></script>
|
||||
{{- end }}
|
||||
@@ -0,0 +1,69 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'attachments' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED shortcode `attachments` found, use `resources` instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments#migration" $filepath }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $style := .style | default "default" }}
|
||||
{{- if and (not $color) (eq (len $color) 0) }}
|
||||
{{- $style = .style | default "transparent" }}
|
||||
{{- end }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title | default ("Attachments-label" | T)) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon | default "paperclip") " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- $sort := .sort | default "asc" }}
|
||||
{{- $pattern := .pattern | default "" }}
|
||||
{{- $defaultUrlPrefix := strings.TrimRight "/" $page.RelPermalink }}
|
||||
{{- if .IsTranslated -}}
|
||||
{{- $defaultLanguage := (index $page.Site.Home.AllTranslations 0).Language.Lang }}
|
||||
{{- $defaultLanguagePage := index (where $page.AllTranslations "Language.Lang" $defaultLanguage) 0 }}
|
||||
{{- $defaultUrlPrefix = strings.TrimRight "/" $defaultLanguagePage.RelPermalink }}
|
||||
{{- end }}
|
||||
{{- $urlPrefix := strings.TrimRight "/" $page.RelPermalink }}
|
||||
{{- with $page }}
|
||||
{{- if ne .BundleType "leaf" }}
|
||||
{{- warnf "%q: UNSUPPORTED usage of 'attachments' shortcode found while using Hugo >= 0.112.0, use a leaf bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments/index.html#single-language" $filepath }}
|
||||
{{- end -}}
|
||||
<div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
|
||||
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}</div>
|
||||
<ul class="box-content attachments-files">
|
||||
{{- $fileDir := path.Dir (strings.TrimPrefix (path.Clean hugo.WorkingDir) (path.Clean .File.Filename)) }}
|
||||
{{- $fileDir = printf "%s/" (path.Clean (strings.TrimPrefix "/" $fileDir)) }}
|
||||
{{- $fileLink := $fileDir }}
|
||||
{{- $fileLink = strings.TrimPrefix "content/" $fileLink }}
|
||||
{{- $filesName := printf "%s.files" .File.BaseFileName }}
|
||||
{{- if and (eq .File.BaseFileName "index") (fileExists (printf "%sfiles" $fileDir)) }}
|
||||
{{- /* backward compat to < 5.9.0 behavior */}}
|
||||
{{- $filesName = "files" }}
|
||||
{{- end }}
|
||||
{{- $dir := printf "%s%s" $fileDir $filesName }}
|
||||
{{- if fileExists $dir }}
|
||||
{{- range sort (readDir $dir) "Name" $sort }}
|
||||
{{- if findRE $pattern .Name}}
|
||||
{{- $size := .Size }}
|
||||
{{- $unit := "Byte-symbol" }}
|
||||
{{- if ge $size 1024 }}
|
||||
{{- $size = div $size 1024 }}
|
||||
{{- $unit = "Kilobyte-symbol" }}
|
||||
{{- end }}
|
||||
{{- if ge $size 1024 }}
|
||||
{{- $size = div $size 1024 }}
|
||||
{{- $unit = "Megabyte-symbol" }}
|
||||
{{- end }}
|
||||
{{- $unitsymbol := $unit | T }}
|
||||
{{- $link := (printf "%s%s/%s" $fileLink $filesName .Name) | relLangURL }}
|
||||
{{- /* Hugo stores the attachments always in the default language subdirectory */}}
|
||||
{{- $link = replace $link $urlPrefix $defaultUrlPrefix 1 }}
|
||||
<li><a href="{{ $link }}">{{.Name}}</a> ({{$size}} {{$unitsymbol}})</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'badge' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $content := .content }}
|
||||
{{- $style := .style | default "default" }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon) " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- with $page -}}
|
||||
<span class="badge cstyle {{ $style }}{{ if or $icon $title }} badge-with-title{{ end }}">{{ if or $icon $title }}<span class="badge-title">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title | .RenderString }}{{ end }}</span>{{ end }}<span class="badge-content"{{ if $color }} style="background-color: {{ $color }};"{{ end }}>{{ $content | safeHTML }}</span></span>
|
||||
{{- end }}
|
||||
@@ -0,0 +1,84 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'button' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $content := .content }}
|
||||
{{- $href := (trim .href " ") | default "" }}
|
||||
{{- $style := .style | default "default" }}
|
||||
{{- if and (not $color) (eq (len $color) 0) }}
|
||||
{{- $style = .style | default "transparent" }}
|
||||
{{- end }}
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $type := .type | default "" }}
|
||||
{{- $isButton := false }}
|
||||
{{- $isLink := false }}
|
||||
{{- if or $type (strings.HasPrefix $href "javascript:") }}
|
||||
{{- $isButton = true }}
|
||||
{{- $href = substr $href (len "javascript:") }}
|
||||
{{- if not $type }}
|
||||
{{- $type = "button" }}
|
||||
{{- end }}
|
||||
{{- else if not $href }}
|
||||
{{- else }}
|
||||
{{- $isLink = true }}
|
||||
{{- $u := urls.Parse .href }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" .href "page" $page "type" "link") $u.String }}
|
||||
{{- else }}
|
||||
{{- $linkObject := partial "_relearn/linkObject.gotmpl" (dict "url" .href "page" $page) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $href = partial "_relearn/decoratedLink.gotmpl" (dict "url" .href "page" $page "linkObject" $linkObject "param" "link") }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: link '%s' is not a page or a resource" $filepath .href }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .href "page" $page "param" "link" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (isset . "target") (or (ne (printf "%T" .target) "string") (ne (trim .target " " ) "")) }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'target' for shortcode 'button' found, use link effects instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-4-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $attributes = merge $attributes (partial "_relearn/linkAttributes.gotmpl" (dict "url" $href "page" $page "target" .target)) -}}
|
||||
{{- end }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" (or .title $content) "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon) " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- $iconposition := .iconposition | default "left" }}
|
||||
{{- with $page -}}
|
||||
<span class="btn cstyle {{ if or $isButton $isLink }}interactive {{ end }}{{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
|
||||
{{- if $isButton -}}
|
||||
<button onclick="{{ $href | safeJS }}"{{ if gt (len $type) 0 }} type="{{ $type }}"{{ end }}>
|
||||
{{- else if $isLink -}}
|
||||
<a
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- printf " %s" $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
{{- else -}}
|
||||
<span>
|
||||
{{- end }}
|
||||
{{- if and $icon (eq $iconposition "left") }}<i class="{{ $icon }}"></i>{{ end }}
|
||||
{{- if and $icon (eq $iconposition "left") $title }} {{ end }}
|
||||
{{- if $title }}<span class="title">{{- $title | safeHTML }}</span>{{ end }}
|
||||
{{- if and $icon (eq $iconposition "right") $title }} {{ end }}
|
||||
{{- if and $icon (eq $iconposition "right") }}<i class="{{ $icon }}"></i>{{ end }}
|
||||
{{- if $isButton -}}
|
||||
</button>
|
||||
{{- else if $isLink -}}
|
||||
</a>
|
||||
{{- else -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</span>
|
||||
{{- end }}
|
||||
@@ -0,0 +1,68 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'children' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $showhidden := .showhidden | default false }}
|
||||
{{- if eq (printf "%T" $showhidden) "string" }}
|
||||
{{- $showhidden = (eq $showhidden "true") }}
|
||||
{{- end }}
|
||||
{{- $style := .style | default "li" }}
|
||||
{{- $depth := .depth | default 1 }}
|
||||
{{- $withDescription := .description | default false }}
|
||||
{{- if eq (printf "%T" $withDescription) "string" }}
|
||||
{{- $withDescription = (eq $withDescription "true") }}
|
||||
{{- end }}
|
||||
{{- $sortTerm := .sort | lower }}
|
||||
{{- $containerstyle := .containerstyle | default "ul" }}
|
||||
{{- if( and (not (eq $style "li") ) (eq $containerstyle "ul" ) ) }}
|
||||
{{- $containerstyle = "div" }}
|
||||
{{- end }}
|
||||
|
||||
{{- with $page -}}
|
||||
{{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }}
|
||||
{{- $pages := partial "_relearn/pages.gotmpl" (dict "page" . "by" $sortTerm) }}
|
||||
{{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }}
|
||||
{{ (printf "</%s>" $containerstyle)|safeHTML }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "childs" }}
|
||||
{{- $page := .page }}
|
||||
{{- range .menu }}
|
||||
{{- $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
||||
{{- if not $hidden }}
|
||||
{{- if not .IsHome }}
|
||||
{{- if hasPrefix $.style "h" }}
|
||||
{{- $num := sub ( int (trim $.style "h") ) 1 }}
|
||||
{{- $numn := add $num $.count }}
|
||||
{{ (printf ` <h%d class="children-title" id="%s">` $numn (.LinkTitle | plainify | anchorize))|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}{{ (printf "</h%d>" $numn)|safeHTML }}
|
||||
{{- else if eq $.style "li" }}
|
||||
{{ (printf ` <%s class="children-title">` $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}
|
||||
{{- else }}
|
||||
{{ (printf ` <%s class="children-title">` $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}{{ (printf "</%s>" $.style)|safeHTML }}
|
||||
{{- end }}
|
||||
{{- if $.description }}
|
||||
{{- with or .Description .Summary -}}
|
||||
<p>{{ . }}</p>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if lt $.count $.depth }}
|
||||
{{- if eq $.style "li" }}
|
||||
{{- (printf "<%s>" $.containerstyle)|safeHTML }}
|
||||
{{- end }}
|
||||
{{- $pages := partial "_relearn/pages.gotmpl" (dict "page" . "by" $.sortTerm) }}
|
||||
{{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }}
|
||||
{{- if eq $.style "li" }}
|
||||
{{- (printf "</%s>" $.containerstyle)|safeHTML }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not .IsHome }}
|
||||
{{- if eq $.style "li" }}
|
||||
{{- (printf "</%s>" $.style)|safeHTML -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'expand' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $title := .title | default (T "Expand-title") }}
|
||||
{{- $title = trim $title " " }}
|
||||
{{- $expanded := .expanded | default false }}
|
||||
{{- if and (isset . "open") (or (ne (printf "%T" .open) "string") (ne (trim .open " " ) "")) }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'open' for shortcode 'expand' found, use 'expanded' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-3-0" $filepath }}
|
||||
{{- $expanded = .open }}
|
||||
{{- end }}
|
||||
{{- if eq (printf "%T" $expanded) "string" }}
|
||||
{{- $expanded = (eq $expanded "true") }}
|
||||
{{- end }}
|
||||
{{- partial "shortcodes/notice.html" (dict
|
||||
"page" .page
|
||||
"content" .content
|
||||
"expanded" $expanded
|
||||
"style" "transparent"
|
||||
"title" $title
|
||||
) }}
|
||||
@@ -0,0 +1,112 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'highlight' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $attributes := dict }}
|
||||
{{- $otherAttributes := dict }}
|
||||
{{- $content := "" }}
|
||||
{{- $options := dict }}
|
||||
{{- $otherOptions := dict }}
|
||||
{{- $type := "" }}
|
||||
{{- range $k, $v := . }}
|
||||
{{- if eq $k "context" }}
|
||||
{{- else if eq $k "page" }}
|
||||
{{- else if eq $k "attributes" }}
|
||||
{{- $attributes = $v }}
|
||||
{{- else if eq $k "content" }}
|
||||
{{- $content = trim $v "\n\r" }}
|
||||
{{- else if eq $k "options" }}
|
||||
{{- if eq (printf "%T" $v) "string" }}
|
||||
{{- range (split $v ",") }}
|
||||
{{- $pair := split . "=" }}
|
||||
{{- $options = $options | merge (dict (index $pair 0) (index $pair 1)) }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $options = $v }}
|
||||
{{- end }}
|
||||
{{- else if eq $k "type" }}
|
||||
{{- $type = $v }}
|
||||
{{- else if eq $k "title" }}
|
||||
{{- $otherAttributes = $otherAttributes | merge (dict $k $v) }}
|
||||
{{- else if eq $k "wrap" }}
|
||||
{{- $otherAttributes = $otherAttributes | merge (dict $k $v) }}
|
||||
{{- else }}
|
||||
{{- $otherOptions = $otherOptions | merge (dict $k $v) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* separate attributes from options */}}
|
||||
{{- $hl_inline := false }}
|
||||
{{- if and (isset $page.Params "markup") (isset $page.Params.markup "highlight") (isset $page.Params.markup.highlight "hl_inline") }}
|
||||
{{- $hl_inline = $page.Params.markup.highlight.hl_inline }}
|
||||
{{- end }}
|
||||
{{- $options = $options | merge $otherOptions }}
|
||||
{{- $otherOptions := dict }}
|
||||
{{- range $k, $v := $options }}
|
||||
{{- if eq $k "hl_inline" }}
|
||||
{{- $hl_inline = $v }}
|
||||
{{- $otherOptions = (dict $k $v) | merge $otherOptions }}
|
||||
{{- else if eq $k "title" }}
|
||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||
{{- else if eq $k "wrap" }}
|
||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||
{{- else }}
|
||||
{{- $otherOptions = (dict $k $v) | merge $otherOptions }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $options = $otherOptions }}
|
||||
|
||||
{{- /* separate shortcode attributes from rest */}}
|
||||
{{- $title := "" }}
|
||||
{{- $wrap := true }}
|
||||
{{- if isset $page.Site.Params "highlightwrap" }}
|
||||
{{- $wrap = $page.Site.Params.highlightWrap }}
|
||||
{{- end }}
|
||||
{{- if isset $page.Params "highlightwrap" }}
|
||||
{{- $wrap = $page.Params.highlightWrap }}
|
||||
{{- end }}
|
||||
{{- $attributes = $attributes | merge $otherAttributes }}
|
||||
{{- $otherAttributes := dict }}
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if eq $k "title" }}
|
||||
{{- $title = $v }}
|
||||
{{- else if eq $k "wrap" }}
|
||||
{{- $wrap = $v }}
|
||||
{{- else }}
|
||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $attributes = $otherAttributes }}
|
||||
{{- if eq (printf "%T" $wrap) "string" }}
|
||||
{{- $wrap = (eq $wrap "true") }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* enrich attributes */}}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) "highlight" slice) " ")) }}
|
||||
{{- if and $wrap (not $hl_inline) }}
|
||||
{{- $attributes = merge $options (dict "class" (delimit (append (index $attributes "class" | default slice) "wrap-code" slice) " ")) }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* print da shtuff */}}
|
||||
{{- $div := slice }}
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- $div = $div | append (printf "%s=%q" $k $v | safeHTMLAttr) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $content = highlight $content $type $options }}
|
||||
{{- $content = replaceRE "^([\\s\\n\\r]*)(<pre\\s+?[\\s\\S]*)$" "${1}<div class=\"highlight\">${2}</div>" $content }}
|
||||
{{- $content = replaceRE "(class=\")([^\"]*)\"" (printf "%s" (delimit $div " ")) $content 1 }}
|
||||
{{- if and $title (not $hl_inline) }}
|
||||
{{- partial "shortcodes/tab.html" (dict
|
||||
"page" $page
|
||||
"title" $title
|
||||
"content" $content
|
||||
)}}
|
||||
{{- else }}
|
||||
{{- $content | safeHTML }}
|
||||
{{- if and (not $hl_inline) (not (hasSuffix $content "\n")) }}
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'icon' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $icon := .icon | default "" }}
|
||||
{{- $icon = trim $icon " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- with $page }}
|
||||
{{- if $icon -}}
|
||||
<i class="{{ $icon }}"></i>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,73 @@
|
||||
{{- /* based on Hugo 0.125.5 render-image.html */}}
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'image' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $title := .title }}
|
||||
{{- $alt := .alt }}
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $linkObject := "" }}
|
||||
{{- $u := urls.Parse .url }}
|
||||
{{- $src := $u.String }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" .url "page" $page "type" "image") $u.String }}
|
||||
{{- else }}
|
||||
{{- $linkObject = partial "_relearn/linkObject.gotmpl" (dict "url" .url "page" $page "searchPage" false) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $src = partial "_relearn/decoratedLink.gotmpl" (dict "url" .url "page" $page "linkObject" $linkObject "param" "image") }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: image '%s' is not a resource" $filepath .url }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .url "page" $page "param" "image" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "_relearn/makeRandomMd5.gotmpl" $page) .id }}
|
||||
{{- $attributes = merge $attributes (partial "_relearn/imageAttributes.gotmpl" (dict "url" $src "page" $page "linkObject" $linkObject)) }}
|
||||
{{- $attributes = merge $attributes (dict "alt" $alt "title" ($title | transform.HTMLEscape)) }}
|
||||
{{- $classes := split $attributes.class " " }}
|
||||
{{- $isLightbox := in $classes "lightbox" }}
|
||||
{{- if $isLightbox -}}
|
||||
<a href="#R-image-{{ $id }}" class="lightbox-link">
|
||||
{{- end }}
|
||||
{{- $attributes_figure := $attributes }}
|
||||
{{- $attributes_figure = merge $attributes_figure (dict "class" (delimit ((split $attributes_figure.class " ") | append "figure-image") " ")) }}
|
||||
{{- $attributes_figure = merge $attributes_figure (dict "style" (index $attributes_figure "style")) -}}
|
||||
{{- partial "partials/inline/img" (dict "attributes" $attributes_figure) }}
|
||||
{{- if $isLightbox -}}
|
||||
</a>
|
||||
<a href="javascript:history.back();" class="lightbox-back" id="R-image-{{ $id }}">
|
||||
{{- $attributes_lightbox := $attributes }}
|
||||
{{- $attributes_lightbox = merge $attributes_lightbox (dict "class" (delimit ((split $attributes_lightbox.class " ") | append "lightbox-image") " ")) }}
|
||||
{{- $attributes_lightbox = merge $attributes_lightbox (dict "style" "") -}}
|
||||
{{- partial "partials/inline/img" (dict "attributes" $attributes_lightbox) }}</a>
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/img" }}
|
||||
{{- if .attributes.content }}
|
||||
{{- $attrs := ""}}
|
||||
{{- range $k, $v := .attributes }}
|
||||
{{- if eq $k "content" }}
|
||||
{{- else if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- $attrs = printf "%s %s" $attrs $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- $attrs = printf "%s %s=%q" $attrs $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- printf (.attributes.content | replaceRE "^<svg" (printf "<svg%s" $attrs)) | safeHTML }}
|
||||
{{- else -}}
|
||||
<img
|
||||
{{- range $k, $v := .attributes }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- printf " %s" $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,34 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'include' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $content := "" }}
|
||||
{{- $linkObject := or
|
||||
(partial "_relearn/linkObject.gotmpl" (dict "url" .file "page" $page "searchGlobal" false "searchResource" false))
|
||||
(partial "_relearn/linkObject.gotmpl" (dict "url" .file "page" $page "searchPage" false)) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $content = $linkObject.Content }}
|
||||
{{- else }}
|
||||
{{- if (fileExists .file) }}
|
||||
{{- $content = .file | readFile }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: include '%s' is not a page, a resource or a file" $filepath .file }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .file "page" $page "param" "include" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $hideFirstHeading := .hidefirstheading | default false }}
|
||||
{{- if eq (printf "%T" $hideFirstHeading) "string" }}
|
||||
{{- $hideFirstHeading = (eq $hideFirstHeading "true") }}
|
||||
{{- end }}
|
||||
{{- if $content }}
|
||||
{{- if $hideFirstHeading }}<div class="include hide-first-heading">
|
||||
|
||||
{{ end }}
|
||||
{{- with $page }}
|
||||
{{- $content | safeHTML }}
|
||||
{{- end }}
|
||||
{{- if $hideFirstHeading }}</div>{{ end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,44 @@
|
||||
{{- /* based on Hugo 0.125.5 render-link.html */}}
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'link' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- if strings.HasPrefix .url "HAHAHUGOSHORTCODE" }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: WARNING you must call the ref / relref shortcode with '%% %%' instead of '< >' to work correctly for the anchor target attribute" $filepath }}
|
||||
{{- end }}
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $title := .title | default "" }}
|
||||
{{- $title = trim $title " " }}
|
||||
{{- $attributes = merge $attributes (dict "title" ($title | transform.HTMLEscape)) }}
|
||||
{{- $content := .content }}
|
||||
{{- /* target will be boolean false if no user defined value was set and effect default should be applied */}}
|
||||
{{- $target := false }}
|
||||
{{- $linkObject := "" }}
|
||||
{{- $u := urls.Parse .url }}
|
||||
{{- $href := $u.String }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" .url "page" $page "type" "link") $u.String }}
|
||||
{{- else }}
|
||||
{{- $linkObject = partial "_relearn/linkObject.gotmpl" (dict "url" .url "page" $page) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $href = partial "_relearn/decoratedLink.gotmpl" (dict "url" .url "page" $page "linkObject" $linkObject "param" "link") }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: link '%s' is not a page or a resource" $filepath .url }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .url "page" $page "param" "link" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $attributes = merge $attributes (partial "_relearn/linkAttributes.gotmpl" (dict "url" $href "page" $page "linkObject" $linkObject "target" .target)) -}}
|
||||
<a
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- printf " %s" $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}>{{ $content | safeHTML }}</a>
|
||||
@@ -0,0 +1,33 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'math' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $content := .content }}
|
||||
{{- $align := .align | default "center" }}
|
||||
|
||||
{{- /* separate shortcode attributes from rest */}}
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $otherAttributes := dict }}
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if eq $k "align" }}
|
||||
{{- else }}
|
||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $attributes = $otherAttributes }}
|
||||
|
||||
{{- /* enrich attributes */}}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) "math" slice) " ")) }}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) (printf "align-%s" $align) slice) " ")) }}
|
||||
|
||||
{{- with $page -}}
|
||||
<span
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}>{{ $content | safeHTML }}</span>
|
||||
{{- .Store.Set "hasMath" true }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,48 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'mermaid' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $content := .content }}
|
||||
{{- $align := .align | default "center" }}
|
||||
{{- $zoom := $page.Site.Params.mermaidZoom | default false }}
|
||||
{{- with $page.Params.mermaidZoom }}
|
||||
{{- $zoom = . }}
|
||||
{{- if eq (printf "%T" .) "string" }}
|
||||
{{- $zoom = (eq . "true") }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .zoom }}
|
||||
{{- $zoom = . }}
|
||||
{{- if eq (printf "%T" .) "string" }}
|
||||
{{- $zoom = (eq . "true") }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* separate shortcode attributes from rest */}}
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $otherAttributes := dict }}
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if eq $k "align" }}
|
||||
{{- else if eq $k "zoom" }}
|
||||
{{- else }}
|
||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $attributes = $otherAttributes }}
|
||||
|
||||
{{- /* enrich attributes */}}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) "mermaid" slice) " ")) }}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) (printf "align-%s" $align) slice) " ")) }}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) (printf "%s" (cond $zoom "zoomable" "")) slice) " ")) }}
|
||||
|
||||
{{- with $page -}}
|
||||
<pre
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}>{{ $content | htmlEscape | safeHTML }}</pre>
|
||||
{{- .Store.Set "hasMermaid" true }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,78 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'notice' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $class := .class | default "notices" }}
|
||||
{{- $containerstyle := .containerstyle | default "div" }}
|
||||
{{- $containerclass := .containerclass | default slice | append "box-content" }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $content := trim .content "\n\r\t " }}
|
||||
{{- $hasContent := ne (strings.TrimPrefix "<p>" $content) "" }}
|
||||
{{- if not (hasPrefix $content "<") }}
|
||||
{{- $content = printf "<p>\n%s" $content }}
|
||||
{{- end }}
|
||||
{{- $groupid := .groupid }}
|
||||
{{- $style := .style | default "default" }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon) " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- $expander := false }}
|
||||
{{- $expanded := .expanded | default "" }}
|
||||
{{- if $hasContent }}
|
||||
{{- if eq (printf "%T" $expanded) "string" }}
|
||||
{{- if ne (trim $expanded " ") "" }}
|
||||
{{- $expander = true }}
|
||||
{{- $expanded = (eq $expanded "true") }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $expander = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $params := .params | default dict }}
|
||||
{{- $classes := split (index $params "class" | default "") " " }}
|
||||
{{- $classes = $classes | append "box" }}
|
||||
{{- $classes = $classes | append "cstyle" }}
|
||||
{{- $classes = $classes | append $class }}
|
||||
{{- $classes = $classes | append $style }}
|
||||
{{- if $expander }}
|
||||
{{- $classes = $classes | append "expand" }}
|
||||
{{- else }}
|
||||
{{- $expanded = true }}
|
||||
{{- end }}
|
||||
{{- $params = dict "class" (delimit $classes " ") | merge $params }}
|
||||
{{- if $color }}
|
||||
{{- $styles := split (index $params "style" | default "") ";" }}
|
||||
{{- $styles = $styles | append (printf "--VARIABLE-BOX-color: %s" $color) }}
|
||||
{{- $params = dict "style" (delimit $styles ";") | merge $params }}
|
||||
{{- end }}
|
||||
{{ if $groupid }}
|
||||
{{- $params = dict "name" $groupid | merge $params }}
|
||||
{{- end }}
|
||||
{{- with $page }}
|
||||
{{- if or $icon $title $hasContent -}}
|
||||
<details
|
||||
{{- if $expanded }} open{{ end }}
|
||||
{{- range $k, $v := $params }}
|
||||
{{- if not (or (in (slice "open" "summary") $k) (strings.HasPrefix $k "on")) }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
<summary class="box-label{{ if and (not $expander) (not $icon) (not $title) }} a11y-only{{ end }}"{{ if not $expander }} tabindex="-1"{{ end }}>{{ if $expander }}
|
||||
<i class="expander-icon fa-fw fas fa-chevron-right"></i> {{ end }}{{ if $icon }}
|
||||
<i class="{{ $icon }}"></i> {{ end }}{{ if $title }}
|
||||
{{ $title | .RenderString }}{{ else }}
|
||||
<span class="a11y-only">{{ T "Details" }}</span>{{ end }}
|
||||
</summary>
|
||||
{{- if $hasContent }}
|
||||
{{ printf " <%s class=\"%s\">" $containerstyle (delimit $containerclass " ") | safeHTML }}
|
||||
{{ $content | safeHTML }}
|
||||
{{ printf " </%s>" $containerstyle | safeHTML }}
|
||||
{{- end }}
|
||||
</details>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,37 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'openapi' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $u := urls.Parse .src }}
|
||||
{{- $src := $u.String }}
|
||||
{{- $spec := "" }}
|
||||
{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "_relearn/makeRandomMd5.gotmpl" $page) .id }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" .src "page" $page "type" "OpenAPI spec link") $u.String }}
|
||||
{{- else }}
|
||||
{{- $path := strings.TrimPrefix "./" $u.Path }}
|
||||
{{- with or
|
||||
($page.Resources.Get $path)
|
||||
(resources.Get $path)
|
||||
}}
|
||||
{{- $src = "" }}
|
||||
{{- $spec = .Content }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: OpenAPI spec '%s' is not a resource" $filepath .src }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .src "page" $page "param" "openapi" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $page -}}
|
||||
<div class="sc-openapi-wrapper is-loading helper-loading-container">
|
||||
<div
|
||||
class="sc-openapi-container"
|
||||
id="R-openapi-{{ $id }}"
|
||||
data-openapi-url="{{ $src }}"
|
||||
data-openapi-spec="{{ $spec | safeHTMLAttr }}"
|
||||
></div>
|
||||
</div>
|
||||
{{- .Store.Set "hasOpenApi" true }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,69 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'resources' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $style := .style | default "default" }}
|
||||
{{- if and (not $color) (eq (len $color) 0) }}
|
||||
{{- $style = .style | default "transparent" }}
|
||||
{{- end }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title | default ("Attachments-label" | T)) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon | default "paperclip") " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- $expanded := .expanded | default "" }}
|
||||
{{- if eq (printf "%T" $expanded) "string" }}
|
||||
{{- if ne (trim $expanded " ") "" }}
|
||||
{{- $expanded = (eq $expanded "true") }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $sort := .sort | default "asc" }}
|
||||
{{- $pattern := .pattern | default "" }}
|
||||
{{- if eq $page.BundleType "" }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: UNSUPPORTED usage of 'resources' shortcode found, use a page bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/resources" $filepath }}
|
||||
{{- end }}
|
||||
{{- $content := partial "inline/resource-list" (dict
|
||||
"page" $page
|
||||
"sort" $sort
|
||||
"pattern" $pattern
|
||||
) }}
|
||||
{{- partial "shortcodes/notice.html" (dict
|
||||
"page" $page
|
||||
"class" "attachments"
|
||||
"containerstyle" "ul"
|
||||
"containerclass" (slice "attachments-files")
|
||||
"color" $color
|
||||
"content" $content
|
||||
"expanded" $expanded
|
||||
"icon" $icon
|
||||
"style" $style
|
||||
"title" $title
|
||||
) }}
|
||||
|
||||
{{- define "partials/inline/resource-list" }}
|
||||
{{- $sort := .sort }}
|
||||
{{- $pattern := .pattern }}
|
||||
{{- with .page }}
|
||||
{{- range sort .Resources "Name" $sort }}
|
||||
{{- if findRE $pattern .Name }}
|
||||
{{- $size := len .Content }}
|
||||
{{- $unit := "Byte-symbol" }}
|
||||
{{- if ge $size 1024 }}
|
||||
{{- $size = div $size 1024 }}
|
||||
{{- $unit = "Kilobyte-symbol" }}
|
||||
{{- end }}
|
||||
{{- if ge $size 1024 }}
|
||||
{{- $size = div $size 1024 }}
|
||||
{{- $unit = "Megabyte-symbol" }}
|
||||
{{- end }}
|
||||
{{- $unitsymbol := $unit | T }}
|
||||
<li><a href="{{ .RelPermalink }}">{{.Name}}</a> ({{$size}} {{$unitsymbol}})</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'siteparam' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $paramNames := split .name "." }}
|
||||
{{- with $page }}
|
||||
{{- $params := .Site.Params }}
|
||||
{{- range $paramName := $paramNames }}
|
||||
{{- with $params }}
|
||||
{{- $params = index . (lower $paramName) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $params }}
|
||||
{{- . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'tab' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $tabs := (slice | append (dict
|
||||
"color" .color
|
||||
"content" .content
|
||||
"icon" .icon
|
||||
"name" .name
|
||||
"style" .style
|
||||
"title" .title
|
||||
)) }}
|
||||
{{- partial "shortcodes/tabs.html" (dict
|
||||
"page" $page
|
||||
"color" ""
|
||||
"content" $tabs
|
||||
"groupid" ""
|
||||
"icon" ""
|
||||
"style" ""
|
||||
"title" ""
|
||||
) }}
|
||||
@@ -0,0 +1,81 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'tabs' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $groupid := .groupid | default (partial "_relearn/makeRandomMd5.gotmpl" $page) | plainify | anchorize }}
|
||||
{{- $color := .color }}
|
||||
{{- $style := .style }}
|
||||
{{- $title := .title }}
|
||||
{{- $icon := .icon }}
|
||||
{{- $tabs := slice }}
|
||||
{{- range $tab := (.content | default slice) }}
|
||||
{{- if and (not $tab.title) $tab.name }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'name' for shortcode 'tab' found, use 'title' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-16-0" $filepath }}
|
||||
{{- $tab = merge $tab (dict "title" .name) }}
|
||||
{{- end }}
|
||||
{{- with $tab }}
|
||||
{{- $color := .color | default $color | default "" }}
|
||||
{{- $content := trim .content "\n\r\t " }}
|
||||
{{- $hasContent := ne (strings.TrimPrefix "<p>" $content) "" }}
|
||||
{{- if not (hasPrefix $content "<") }}
|
||||
{{- $content = printf "<p>\n%s" $content }}
|
||||
{{- end }}
|
||||
{{- $style := .style | default $style | default (cond (ne $color "") "filled" "initial") }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon) " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- if $hasContent }}
|
||||
{{- $tabs = $tabs | append (dict
|
||||
"color" $color
|
||||
"content" $content
|
||||
"icon" $icon
|
||||
"itemid" (printf "%s%s" ($title | $page.RenderString | plainify | anchorize) ($icon | plainify | anchorize))
|
||||
"style" $style
|
||||
"title" $title
|
||||
) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $color = .color | default "" }}
|
||||
{{- $style = .style | default (cond (ne $color "") "filled" "initial") }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon) " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- with $page }}
|
||||
{{- if len $tabs -}}
|
||||
<div class="tab-panel" data-tab-group="{{ $groupid }}">
|
||||
<div class="tab-nav">
|
||||
<div class="tab-nav-title">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | $page.RenderString }}{{ if (not $title) }}​{{ end }}</div>
|
||||
{{- range $idx, $tab := $tabs }}
|
||||
<button
|
||||
data-tab-item="{{ .itemid }}"
|
||||
class="tab-nav-button tab-panel-style cstyle {{ .style }}{{ cond (eq $idx 0) " active" ""}}"{{ if .color }} style="--VARIABLE-BOX-color: {{ .color }};"{{ end }}{{ if eq $idx 0 }} tabindex="-1"{{ end }}
|
||||
onclick="switchTab('{{ $groupid }}','{{ .itemid }}')"
|
||||
>
|
||||
<span class="tab-nav-text">{{ if .icon }}<i class="{{ .icon }}"></i>{{ end }}{{ if and .icon .title }} {{ end }}{{ .title | $page.RenderString }}{{ if (not .title) }}​{{ end }}</span>
|
||||
</button>
|
||||
{{- end }}
|
||||
</div>
|
||||
<div class="tab-content-container">
|
||||
{{- range $idx, $tab := $tabs }}
|
||||
<div
|
||||
data-tab-item="{{ .itemid }}"
|
||||
class="tab-content tab-panel-style cstyle {{ .style }}{{ cond (eq $idx 0) " active" ""}}"{{ if .color }} style="--VARIABLE-BOX-color: {{ .color }};"{{ end }}>
|
||||
<div class="tab-content-text">
|
||||
{{ .content | safeHTML }}
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,26 @@
|
||||
{{- $taxonomy := .taxonomy }}
|
||||
{{- if eq "string" (printf "%T" $taxonomy) }}
|
||||
{{- $taxonomy = .page.GetPage $taxonomy }}
|
||||
{{- end }}
|
||||
{{- $headingstyle := .headingstyle | default "h2" }}
|
||||
{{- with $taxonomy }}
|
||||
{{- .Content }}
|
||||
{{- $lastCapital := "" }}
|
||||
{{- $pages := partialCached "partials/_relearn/pagesTaxonomy.gotmpl" . .Path }}
|
||||
{{- range $pages }}
|
||||
{{- $capital := substr .Title 0 1 | upper }}
|
||||
{{- if ne $lastCapital $capital }}
|
||||
{{- if ne $lastCapital "" }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{ (printf `<%s id="%s">%s</%s>` $headingstyle ($capital | plainify | anchorize) $capital $headingstyle) | safeHTML }}
|
||||
<ul class="columnize">
|
||||
{{- end }}
|
||||
{{- /* display terms of a taxonomy */}}
|
||||
<li><a href="{{ partial "permalink.gotmpl" (dict "to" .Page) }}">{{ .Title }}</a> ({{ .Count }})</li>
|
||||
{{- $lastCapital = $capital }}
|
||||
{{- end }}
|
||||
{{- if ne $lastCapital "" }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,30 @@
|
||||
{{- $term := .term }}
|
||||
{{- if eq "string" (printf "%T" $term) }}
|
||||
{{- $term = .page.GetPage $term }}
|
||||
{{- end }}
|
||||
{{- $headingstyle := .headingstyle | default "h2" }}
|
||||
{{- with $term }}
|
||||
{{- .Content }}
|
||||
{{- $lastCapital := "" }}
|
||||
{{- $pages := partialCached "partials/_relearn/pagesTerm.gotmpl" . .Path }}
|
||||
{{- range $pages }}
|
||||
{{- $capital := substr .Title 0 1 | upper }}
|
||||
{{- if ne $lastCapital $capital }}
|
||||
{{- if ne $lastCapital "" }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{ (printf `<%s id="%s">%s</%s>` $headingstyle ($capital | plainify | anchorize) $capital $headingstyle) | safeHTML }}
|
||||
<ul class="columnize">
|
||||
{{- end }}
|
||||
{{- /* display pages of a term */}}
|
||||
{{- $breadcrumb := "" }}
|
||||
{{- if (ne .Page.Site.Params.disableTermBreadcrumbs true) }}
|
||||
{{- $breadcrumb = trim (partial "breadcrumbs.html" (dict "page" .Page "dirOnly" true) | plainify | htmlUnescape) "\n\r\t " }}
|
||||
{{- end }}
|
||||
<li><a href="{{ partial "permalink.gotmpl" (dict "to" .Page) }}">{{ .Title }}</a>{{ with $breadcrumb }}<div class="breadcrumbs highlightable" title="{{ . }}">{{ . }}</div>{{ end }}</li>
|
||||
{{- $lastCapital = $capital }}
|
||||
{{- end }}
|
||||
{{- if ne $lastCapital "" }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
80
themes/hugo-theme-relearn/layouts/partials/stylesheet.html
Normal file
80
themes/hugo-theme-relearn/layouts/partials/stylesheet.html
Normal file
@@ -0,0 +1,80 @@
|
||||
{{- $outputFormat := "html" }}
|
||||
{{- with .Store.Get "relearnOutputFormat" }}
|
||||
{{- $outputFormat = . }}
|
||||
{{- else }}
|
||||
{{- warnf "WARNING no key `relearnOutputFormat` found in page store, set one by providing the file `layouts/_default/view/storeOutputFormat.<MYOUTPUTFORMAT>.html` for your self-defined output format; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-0-0" }}
|
||||
{{- end }}
|
||||
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
|
||||
{{- /* https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use */}}
|
||||
<link href="{{"css/fontawesome-all.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fontawesome-all.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet"></noscript>
|
||||
<link href="{{"css/auto-complete.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/auto-complete.css" | relURL}}{{ $assetBusting }}" rel="stylesheet"></noscript>
|
||||
<link href="{{"css/perfect-scrollbar.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
|
||||
{{- $themevariants := partialCached "_relearn/themeVariants.gotmpl" . }}
|
||||
{{- $wrap := true }}
|
||||
{{- if isset site.Params "highlightwrap" }}
|
||||
{{- $wrap = site.Params.highlightWrap }}
|
||||
{{- end }}
|
||||
{{- if isset .Params "highlightwrap" }}
|
||||
{{- $wrap = .Params.highlightWrap }}
|
||||
{{- end }}
|
||||
{{- $disableInlineCopyToClipboard := site.Params.disableInlineCopyToClipBoard }}
|
||||
{{- $minify := not hugo.IsServer }}
|
||||
{{- if and (isset site.Params "minify") (ne site.Params.minify "") }}
|
||||
{{- $minify = site.Params.minify }}
|
||||
{{- end }}
|
||||
{{- $min := cond $minify ".min" "" }}
|
||||
<link href="{{(printf "css/theme%s.css" $min) | relURL}}{{ $assetBusting }}" rel="stylesheet">
|
||||
<link href="{{(printf "css/format-%s%s.css" $outputFormat $min) | relURL}}{{ $assetBusting }}" rel="stylesheet" id="R-format-style">
|
||||
<script>
|
||||
window.relearn = window.relearn || {};
|
||||
window.relearn.relBasePath='{{ partial "_relearn/relBasePath.gotmpl" . | safeJS }}';
|
||||
window.relearn.relBaseUri='{{ partial "_relearn/relBaseUri.gotmpl" . | safeJS }}';
|
||||
window.relearn.absBaseUri='{{ replaceRE "/*$" "" .Site.BaseURL | safeJS }}';
|
||||
{{ printf "window.relearn.min = `%s`;" $min | safeJS }}
|
||||
window.relearn.disableAnchorCopy={{ printf "%t" (eq .Site.Params.disableAnchorCopy true) | safeJS }};
|
||||
window.relearn.disableAnchorScrolling={{ printf "%t" (eq .Site.Params.disableAnchorScrolling true) | safeJS }};
|
||||
window.relearn.enableBlockCodeWrap={{ printf "%t" (eq $wrap true) | safeJS }};
|
||||
window.relearn.disableInlineCopyToClipboard={{ printf "%t" (eq $disableInlineCopyToClipboard true) | safeJS }};
|
||||
{{ "// variant stuff" | safeJS }}
|
||||
{{- $quotedthemevariants := slice }}
|
||||
{{- range $themevariants }}
|
||||
{{- $quotedthemevariants = $quotedthemevariants | append (printf "'%s'" .identifier) }}
|
||||
{{- end }}
|
||||
window.relearn.themevariants = [ {{ delimit $quotedthemevariants ", " | safeJS }} ];
|
||||
window.relearn.customvariantname = "my-custom-variant";
|
||||
window.relearn.changeVariant = function(variant) {
|
||||
var oldVariant = document.documentElement.dataset.rThemeVariant;
|
||||
window.localStorage.setItem(window.relearn.absBaseUri + "/variant", variant);
|
||||
document.documentElement.dataset.rThemeVariant = variant;
|
||||
if (oldVariant != variant) {
|
||||
document.dispatchEvent( new CustomEvent('themeVariantLoaded', { detail: { variant, oldVariant } }) );
|
||||
}
|
||||
}
|
||||
window.relearn.markVariant = function() {
|
||||
var variant = window.localStorage.getItem(window.relearn.absBaseUri + "/variant");
|
||||
var select = document.querySelector("#R-select-variant");
|
||||
if (select) {
|
||||
select.value = variant;
|
||||
}
|
||||
}
|
||||
window.relearn.initVariant = function() {
|
||||
var variant = window.localStorage.getItem(window.relearn.absBaseUri + "/variant") ?? "";
|
||||
if( variant == window.relearn.customvariantname ){
|
||||
}else if( !variant || !window.relearn.themevariants.includes(variant) ){
|
||||
variant = window.relearn.themevariants[0];
|
||||
window.localStorage.setItem(window.relearn.absBaseUri + "/variant", variant);
|
||||
}
|
||||
document.documentElement.dataset.rThemeVariant = variant;
|
||||
}
|
||||
window.relearn.initVariant();
|
||||
window.relearn.markVariant();
|
||||
{{ "// translations" | safeJS }}
|
||||
{{ printf "window.T_Copy_to_clipboard = `%s`;" (T `Copy-to-clipboard`) | safeJS }}
|
||||
{{ printf "window.T_Copied_to_clipboard = `%s`;" (T `Copied-to-clipboard`) | safeJS }}
|
||||
{{ printf "window.T_Copy_link_to_clipboard = `%s`;" (T `Copy-link-to-clipboard`) | safeJS }}
|
||||
{{ printf "window.T_Link_copied_to_clipboard = `%s`;" (T `Link-copied-to-clipboard`) | safeJS }}
|
||||
{{ printf "window.T_Reset_view = `%s`;" (T `Reset-view`) | safeJS }}
|
||||
{{ printf "window.T_View_reset = `%s`;" (T `View-reset`) | safeJS }}
|
||||
{{ printf "window.T_No_results_found = `%s`;" (T "No-results-found") | safeJS }}
|
||||
{{ printf "window.T_N_results_found = `%s`;" (T "N-results-found") | safeJS }}
|
||||
</script>
|
||||
5
themes/hugo-theme-relearn/layouts/partials/tags.html
Normal file
5
themes/hugo-theme-relearn/layouts/partials/tags.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{{- partial "term-list.html" (dict
|
||||
"page" .
|
||||
"taxonomy" "tags"
|
||||
"class" "tags"
|
||||
) }}
|
||||
32
themes/hugo-theme-relearn/layouts/partials/term-list.html
Normal file
32
themes/hugo-theme-relearn/layouts/partials/term-list.html
Normal file
@@ -0,0 +1,32 @@
|
||||
{{- $page := .page }}
|
||||
{{- $taxonomy := .taxonomy }}
|
||||
{{- $class := .class }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $style := .style | default "" }}
|
||||
{{- if and (not $style) (eq (len $style) 0) }}
|
||||
{{- $color = .color | default "var(--INTERNAL-TAG-BG-color)" }}
|
||||
{{- end }}
|
||||
{{- $icon := .icon | default "" }}
|
||||
{{- $icon = trim $icon " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- $taxonomy_page := $page.Site.GetPage $taxonomy }}
|
||||
{{- $term_pages := slice }}
|
||||
{{- range $page.GetTerms $taxonomy }}
|
||||
{{- $term_pages = $term_pages | append (dict "Title" (partial "title.gotmpl" (dict "page" . "linkTitle" true)) "Term" . )}}
|
||||
{{- end }}
|
||||
{{- $taxonomy_title := partial "title.gotmpl" (dict "page" $taxonomy_page) }}
|
||||
{{- with $term_pages }}
|
||||
<div class="R-taxonomy taxonomy-{{ $taxonomy }} cstyle{{ with $style }} {{ . }}{{ end }}{{ with $class }} {{ . }}{{ end }}" title="{{ $taxonomy_title }}"{{ if $color }}{{ printf " style=\"--VARIABLE-TAGS-BG-color: %s;\"" $color | safeHTMLAttr }}{{ end }}>
|
||||
{{- if $icon }}
|
||||
<i class="{{ $icon }}"></i>
|
||||
{{- end }}
|
||||
<ul>
|
||||
{{- range sort . ".Title" }}
|
||||
{{- $to := .Term }}
|
||||
<li><a class="term-link" href="{{ partial "permalink.gotmpl" (dict "to" $to) }}">{{ .Title }}</a></li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end }}
|
||||
39
themes/hugo-theme-relearn/layouts/partials/title.gotmpl
Normal file
39
themes/hugo-theme-relearn/layouts/partials/title.gotmpl
Normal file
@@ -0,0 +1,39 @@
|
||||
{{- $title := "" }}
|
||||
{{- with .page }}
|
||||
{{- $siteTitle := site.Title }}
|
||||
{{- if $.linkTitle }}
|
||||
{{- $siteTitle := or site.Params.linkTitle site.Title }}
|
||||
{{- end }}
|
||||
{{- $title = .Title }}
|
||||
{{- if $.linkTitle }}
|
||||
{{- $title = or .LinkTitle $title }}
|
||||
{{- end }}
|
||||
|
||||
{{- if eq .Kind "home" }}
|
||||
{{- $title = $title | default $siteTitle }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $taxonomy_title := default (default $taxonomy_page.Data.Singular (i18n $taxonomy_page.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $term_title := default (humanize .Data.Term | strings.Title) .Title }}
|
||||
{{- if $.linkTitle }}
|
||||
{{- $title = printf "%s" $term_title }}
|
||||
{{- else if $.reverse }}
|
||||
{{- $title = printf "%s %s %s" $term_title (default "::" .Site.Params.titleSeparator) $taxonomy_title }}
|
||||
{{- else }}
|
||||
{{- $title = printf "%s %s %s" $taxonomy_title (default "::" .Site.Params.titleSeparator) $term_title }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $.fullyQualified }}
|
||||
{{- if and $title $siteTitle (not (eq $title $siteTitle)) }}
|
||||
{{- if $.reverse }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" site.Params.titleSeparator) $siteTitle }}
|
||||
{{- else }}
|
||||
{{- $title = printf "%s %s %s" $siteTitle (default "::" site.Params.titleSeparator) $title }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $title }}
|
||||
@@ -0,0 +1,3 @@
|
||||
{{- $toc_content := partial "toc-id.html" . }}
|
||||
{{- $toc_content = strings.Replace $toc_content "id=\"TableOfContents\"" "class=\"TableOfContents\"" 1 }}
|
||||
{{- $toc_content | safeHTML }}
|
||||
31
themes/hugo-theme-relearn/layouts/partials/toc-id.html
Normal file
31
themes/hugo-theme-relearn/layouts/partials/toc-id.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{{- if or (eq .Kind "taxonomy") (eq .Kind "term") }}
|
||||
{{- $lastCapital := "" }}
|
||||
{{- $pages := slice }}
|
||||
{{- if eq .Kind "taxonomy" }}
|
||||
{{- $pages = partialCached "partials/_relearn/pagesTaxonomy.gotmpl" . .Path }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $pages = partialCached "partials/_relearn/pagesTerm.gotmpl" . .Path }}
|
||||
{{- end }}
|
||||
{{- $toc_pages := "" }}
|
||||
{{- range $pages }}
|
||||
{{- $capital := substr .Title 0 1 | upper }}
|
||||
{{- if ne $lastCapital $capital }}
|
||||
{{- $toc_pages = printf "%s <li><a href=\"#%s\">%s</a></li>\n" $toc_pages ($capital | plainify | anchorize) $capital }}
|
||||
{{- end }}
|
||||
{{- $lastCapital = $capital }}
|
||||
{{- end }}
|
||||
{{- $toc := trim (partial "toc.html" .) "\n\r\t " }}
|
||||
{{- if and (not $toc) $toc_pages }}
|
||||
{{- $toc = printf "<nav id=\"TableOfContents\"></nav>" }}
|
||||
{{- end }}
|
||||
{{- if and $toc $toc_pages }}
|
||||
{{- $toc = replaceRE "^(<nav id=\"TableOfContents\">)[\\s]*" "${1}\n <ul>\n" $toc }}
|
||||
{{- $toc = replaceRE "^(<nav id=\"TableOfContents\">[\\s]*<ul>)[\\s]*<ul>[\\n\\r]*" "${1}\n" $toc }}
|
||||
{{- $toc = replaceRE "[\\s]*(</nav>)$" "\n </ul>\n${1}" $toc }}
|
||||
{{- $toc = replaceRE "[ \\t]*</ul>[\\s]*(</ul>[\\s]*</nav>)$" " ${1}" $toc }}
|
||||
{{- $toc = replaceRE "([ \\t]*</ul>[\\s]*</nav>)$" (printf "%s${1}" $toc_pages) $toc }}
|
||||
{{- end }}
|
||||
{{ $toc | safeHTML }}
|
||||
{{- else }}
|
||||
{{- partial "toc.html" . }}
|
||||
{{- end }}
|
||||
1
themes/hugo-theme-relearn/layouts/partials/toc.html
Normal file
1
themes/hugo-theme-relearn/layouts/partials/toc.html
Normal file
@@ -0,0 +1 @@
|
||||
{{- .TableOfContents }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- partial "topbar/button/edit.html" (dict
|
||||
"page" .
|
||||
)}}
|
||||
{{- partial "topbar/button/source.html" (dict
|
||||
"page" .
|
||||
)}}
|
||||
{{- partial "topbar/button/markdown.html" (dict
|
||||
"page" .
|
||||
)}}
|
||||
{{- partial "topbar/button/print.html" (dict
|
||||
"page" .
|
||||
)}}
|
||||
{{- partial "topbar/button/prev.html" (dict
|
||||
"page" .
|
||||
)}}
|
||||
{{- partial "topbar/button/next.html" (dict
|
||||
"page" .
|
||||
)}}
|
||||
{{- partial "topbar/button/more.html" (dict
|
||||
"page" .
|
||||
)}}
|
||||
@@ -0,0 +1,6 @@
|
||||
{{- partial "topbar/button/sidebar.html" (dict
|
||||
"page" .
|
||||
)}}
|
||||
{{- partial "topbar/button/toc.html" (dict
|
||||
"page" .
|
||||
)}}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{- $onwidths := cond (isset . "onwidths") .onwidths "area-more" }}
|
||||
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
|
||||
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
|
||||
{{- with .page }}
|
||||
{{- $show := .File }}
|
||||
{{- if $show }}
|
||||
{{- $show = not (partial "_relearn/pageIsSpecial.gotmpl" .) }}
|
||||
{{- end }}
|
||||
{{- if $show }}
|
||||
{{- $filePath := printf "%s%s" (strings.TrimLeft "/" (replace .File.Dir "\\" "/")) .File.LogicalName }}
|
||||
{{- $href := "" }}
|
||||
{{- if .Site.Params.editURL }}
|
||||
{{- $href = .Site.Params.editURL }}
|
||||
{{- if not (strings.Contains $href "${FilePath}") }}
|
||||
{{- $href = printf "%s%s" $href "${FilePath}" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if isset .Params "editurl" }}
|
||||
{{- $href = .Params.editURL }}
|
||||
{{- end }}
|
||||
{{- $href = strings.Replace $href "${FilePath}" $filePath }}
|
||||
{{- if $href }}
|
||||
{{- partial "topbar/func/button.html" (dict
|
||||
"page" .
|
||||
"class" "topbar-button-edit"
|
||||
"href" $href
|
||||
"icon" "pen"
|
||||
"onwidths" $onwidths
|
||||
"onwidthm" $onwidthm
|
||||
"onwidthl" $onwidthl
|
||||
"hint" (printf "%s (CTRL+ALT+w)" (T "Edit-this-page"))
|
||||
)}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,22 @@
|
||||
{{- $onwidths := cond (isset . "onwidths") .onwidths "area-more" }}
|
||||
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
|
||||
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
|
||||
{{- with .page }}
|
||||
{{- $format := .OutputFormats.Get "markdown" }}
|
||||
{{- $show := and $format (not (.Param "disableMarkdownButton")) }}
|
||||
{{- if $show }}
|
||||
{{- $show = not (partial "_relearn/pageIsSpecial.gotmpl" .) }}
|
||||
{{- end }}
|
||||
{{- if $show }}
|
||||
{{- partial "topbar/func/button.html" (dict
|
||||
"page" .
|
||||
"class" "topbar-button-markdown"
|
||||
"href" $format.RelPermalink
|
||||
"icon" "fa-fw fab fa-markdown"
|
||||
"onwidths" $onwidths
|
||||
"onwidthm" $onwidthm
|
||||
"onwidthl" $onwidthl
|
||||
"hint" (T "Show-Markdown")
|
||||
)}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- $onempty := cond (isset . "onempty") .onempty "hide" }}
|
||||
{{- $onwidths := cond (isset . "onwidths") .onwidths "show" }}
|
||||
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
|
||||
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
|
||||
{{- partial "topbar/func/area-button.html" (dict
|
||||
"page" .page
|
||||
"area" "more"
|
||||
"icon" "ellipsis-v"
|
||||
"onempty" $onempty
|
||||
"onwidths" $onwidths
|
||||
"onwidthm" $onwidthm
|
||||
"onwidthl" $onwidthl
|
||||
"hint" (printf "%s" (T "More-action"))
|
||||
)}}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- $onwidths := cond (isset . "onwidths") .onwidths "show" }}
|
||||
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
|
||||
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
|
||||
{{- with .page }}
|
||||
{{- $show := not (.Param "disableNextPrev") }}
|
||||
{{- if $show }}
|
||||
{{- $endarrow := "🡒" }}
|
||||
{{- if eq (.Language.LanguageDirection | default (T "Reading-direction") | default "ltr") "rtl" }}
|
||||
{{- $endarrow = "🡐" }}
|
||||
{{- end }}
|
||||
{{- $next := partialCached "_relearn/pageNext.gotmpl" . .Path }}
|
||||
{{- $nextTitle := partial "title.gotmpl" (dict "page" $next "outputFormat" "html") }}
|
||||
{{- partial "topbar/func/button.html" (dict
|
||||
"page" .
|
||||
"class" "topbar-button-next"
|
||||
"href" (partial "permalink.gotmpl" (dict "to" $next))
|
||||
"icon" "chevron-right"
|
||||
"onwidths" $onwidths
|
||||
"onwidthm" $onwidthm
|
||||
"onwidthl" $onwidthl
|
||||
"hint" (printf "%s (%s)" $nextTitle ($endarrow | safeHTML))
|
||||
)}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- $onwidths := cond (isset . "onwidths") .onwidths "show" }}
|
||||
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
|
||||
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
|
||||
{{- with .page }}
|
||||
{{- $show := not (.Param "disableNextPrev") }}
|
||||
{{- if $show }}
|
||||
{{- $startarrow := "🡐" }}
|
||||
{{- if eq (.Language.LanguageDirection | default (T "Reading-direction") | default "ltr") "rtl" }}
|
||||
{{- $startarrow = "🡒" }}
|
||||
{{- end }}
|
||||
{{- $prev := partialCached "_relearn/pagePrev.gotmpl" . .Path }}
|
||||
{{- $prevTitle := partial "title.gotmpl" (dict "page" $prev "outputFormat" "html") }}
|
||||
{{- partial "topbar/func/button.html" (dict
|
||||
"page" .
|
||||
"class" "topbar-button-prev"
|
||||
"href" (partial "permalink.gotmpl" (dict "to" $prev))
|
||||
"icon" "chevron-left"
|
||||
"onwidths" $onwidths
|
||||
"onwidthm" $onwidthm
|
||||
"onwidthl" $onwidthl
|
||||
"hint" (printf "%s (%s)" $prevTitle ($startarrow | safeHTML))
|
||||
)}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,22 @@
|
||||
{{- $onwidths := cond (isset . "onwidths") .onwidths "area-more" }}
|
||||
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
|
||||
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
|
||||
{{- with .page }}
|
||||
{{- $format := .OutputFormats.Get "print" }}
|
||||
{{- $show := and $format (not (.Param "disablePrintButton")) }}
|
||||
{{- if $show }}
|
||||
{{- $show = not (partial "_relearn/pageIsSpecial.gotmpl" .) }}
|
||||
{{- end }}
|
||||
{{- if $show }}
|
||||
{{- partial "topbar/func/button.html" (dict
|
||||
"page" .
|
||||
"class" "topbar-button-print"
|
||||
"href" $format.RelPermalink
|
||||
"icon" "print"
|
||||
"onwidths" $onwidths
|
||||
"onwidthm" $onwidthm
|
||||
"onwidthl" $onwidthl
|
||||
"hint" (printf "%s (CTRL+ALT+p)" (T "Print-this-chapter"))
|
||||
)}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
{{- $onwidths := cond (isset . "onwidths") .onwidths "show" }}
|
||||
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "hide" }}
|
||||
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "hide" }}
|
||||
{{- with .page }}
|
||||
{{- partial "topbar/func/button.html" (dict
|
||||
"page" .
|
||||
"class" "topbar-button-sidebar"
|
||||
"href" "javascript:toggleNav()"
|
||||
"icon" "bars"
|
||||
"onwidths" $onwidths
|
||||
"onwidthm" $onwidthm
|
||||
"onwidthl" $onwidthl
|
||||
"hint" (printf "%s (CTRL+ALT+n)" (T "Navigation-toggle"))
|
||||
)}}
|
||||
{{- end }}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user