diff --git a/exampleSite/content/shortcodes/attachments/index.en.md b/exampleSite/content/shortcodes/attachments/index.en.md index 7f8ecaba5b..3bf8824551 100644 --- a/exampleSite/content/shortcodes/attachments/index.en.md +++ b/exampleSite/content/shortcodes/attachments/index.en.md @@ -27,7 +27,7 @@ While the examples are using shortcodes with named parameter you are free to als ````go {{ partial "shortcodes/attachments.html" (dict - "context" . + "page" . "sort" "asc" )}} ```` diff --git a/exampleSite/content/shortcodes/badge.en.md b/exampleSite/content/shortcodes/badge.en.md index d49b098dcc..1cb515e667 100644 --- a/exampleSite/content/shortcodes/badge.en.md +++ b/exampleSite/content/shortcodes/badge.en.md @@ -31,30 +31,30 @@ While the examples are using shortcodes with named parameter you are free to als ````go {{ partial "shortcodes/badge.html" (dict - "context" . + "page" . "content" "Important" )}} {{ partial "shortcodes/badge.html" (dict - "context" . + "page" . "style" "primary" "title" "Version" "content" "6.6.6" )}} {{ partial "shortcodes/badge.html" (dict - "context" . + "page" . "style" "red" - "icon" "angle-double-up" + "icon" "angle-double-up" "content" "Captain" )}} {{ partial "shortcodes/badge.html" (dict - "context" . + "page" . "style" "info" "content" "New" )}} {{ partial "shortcodes/badge.html" (dict - "context" . + "page" . "color" "fuchsia" - "icon" "fab fa-hackerrank" + "icon" "fab fa-hackerrank" "content" "Awesome" )}} ```` diff --git a/exampleSite/content/shortcodes/button.en.md b/exampleSite/content/shortcodes/button.en.md index 5d95b83231..f7bd7887db 100644 --- a/exampleSite/content/shortcodes/button.en.md +++ b/exampleSite/content/shortcodes/button.en.md @@ -25,12 +25,12 @@ While the examples are using shortcodes with named parameter you are free to als ````go {{ partial "shortcodes/button.html" (dict - "context" . + "page" . "href" "https://gohugo.io/" "content" "Get Hugo" )}} {{ partial "shortcodes/button.html" (dict - "context" . + "page" . "href" "https://gohugo.io/" "style" "warning" "icon" "dragon" diff --git a/exampleSite/content/shortcodes/children/_index.en.md b/exampleSite/content/shortcodes/children/_index.en.md index 4397a3d68d..048342d2ed 100644 --- a/exampleSite/content/shortcodes/children/_index.en.md +++ b/exampleSite/content/shortcodes/children/_index.en.md @@ -24,7 +24,7 @@ While the examples are using shortcodes with named parameter you are free to als ````go {{ partial "shortcodes/children.html" (dict - "context" . + "page" . "sort" "weight" )}} ```` diff --git a/exampleSite/content/shortcodes/expand.en.md b/exampleSite/content/shortcodes/expand.en.md index 9e0ead6e09..f89147b8ce 100644 --- a/exampleSite/content/shortcodes/expand.en.md +++ b/exampleSite/content/shortcodes/expand.en.md @@ -46,7 +46,7 @@ While the examples are using shortcodes with named parameter you are free to use ````go {{ partial "shortcodes/expand.html" (dict - "context" . + "page" . "title" "Expand me..." "content" "Thank you!" )}} diff --git a/exampleSite/content/shortcodes/highlight.en.md b/exampleSite/content/shortcodes/highlight.en.md index ed4e857185..b46b2b5416 100644 --- a/exampleSite/content/shortcodes/highlight.en.md +++ b/exampleSite/content/shortcodes/highlight.en.md @@ -52,7 +52,7 @@ print("Hello World!") ````go {{ partial "shortcodes/highlight.html" (dict - "context" . + "page" . "content" "print(\"Hello World!\")" "lineNos" "true" "type" "py" @@ -66,7 +66,7 @@ print("Hello World!") ````go {{ partial "shortcodes/highlight.html" (dict - "context" . + "page" . "content" "print(\"Hello World!\")" "options" "lineNos=true,wrap=true" "type" "py" diff --git a/exampleSite/content/shortcodes/icon.en.md b/exampleSite/content/shortcodes/icon.en.md index 74b093f8a4..3b5de79ff1 100644 --- a/exampleSite/content/shortcodes/icon.en.md +++ b/exampleSite/content/shortcodes/icon.en.md @@ -37,15 +37,15 @@ While the examples are using shortcodes with positional parameter you are free t ````go {{ partial "shortcodes/icon.html" (dict - "context" . + "page" . "icon" "exclamation-triangle" )}} {{ partial "shortcodes/icon.html" (dict - "context" . + "page" . "icon" "angle-double-up" )}} {{ partial "shortcodes/icon.html" (dict - "context" . + "page" . "icon" "skull-crossbones" )}} ```` diff --git a/exampleSite/content/shortcodes/include.en.md b/exampleSite/content/shortcodes/include.en.md index 95bc43555e..9be81a5cae 100644 --- a/exampleSite/content/shortcodes/include.en.md +++ b/exampleSite/content/shortcodes/include.en.md @@ -28,7 +28,7 @@ While the examples are using shortcodes with named parameter you are free to use ````go {{ partial "shortcodes/include .html" (dict - "context" . + "page" . "file" "shortcodes/INCLUDE_ME.md" )}} ```` diff --git a/exampleSite/content/shortcodes/math.en.md b/exampleSite/content/shortcodes/math.en.md index 22b78b10db..b4de6083a4 100644 --- a/exampleSite/content/shortcodes/math.en.md +++ b/exampleSite/content/shortcodes/math.en.md @@ -46,7 +46,7 @@ $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \ ````go {{ partial "shortcodes/math.html" (dict - "context" . + "page" . "content" "$$left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$" "align" "center" )}} diff --git a/exampleSite/content/shortcodes/mermaid.en.md b/exampleSite/content/shortcodes/mermaid.en.md index 905d81ac01..f350fce57d 100644 --- a/exampleSite/content/shortcodes/mermaid.en.md +++ b/exampleSite/content/shortcodes/mermaid.en.md @@ -56,7 +56,7 @@ graph LR; ````go {{ partial "shortcodes/mermaid.html" (dict - "context" . + "page" . "content" "graph LR;\nIf --> Then\nThen --> Else" "align" "center" "zoom" "true" diff --git a/exampleSite/content/shortcodes/notice.en.md b/exampleSite/content/shortcodes/notice.en.md index 50a022da35..285b6234ef 100644 --- a/exampleSite/content/shortcodes/notice.en.md +++ b/exampleSite/content/shortcodes/notice.en.md @@ -36,7 +36,7 @@ It is all about the boxes. ````go {{ partial "shortcodes/notice.html" (dict - "context" . + "page" . "style" "primary" "title" "There may be pirates" "icon" "skull-crossbones" diff --git a/exampleSite/content/shortcodes/openapi/_index.en.md b/exampleSite/content/shortcodes/openapi/_index.en.md index db73bc22da..9ee621e78a 100644 --- a/exampleSite/content/shortcodes/openapi/_index.en.md +++ b/exampleSite/content/shortcodes/openapi/_index.en.md @@ -25,8 +25,8 @@ While the examples are using shortcodes with named parameter you are free to als ````go {{ partial "shortcodes/openapi.html" (dict - "context" . - "src" "https://petstore3.openapi.io/api/v3/openapi.json" + "page" . + "src" "https://petstore3.openapi.io/api/v3/openapi.json" )}} ```` diff --git a/exampleSite/content/shortcodes/siteparam.en.md b/exampleSite/content/shortcodes/siteparam.en.md index 5a6462a7b1..47a94a662b 100644 --- a/exampleSite/content/shortcodes/siteparam.en.md +++ b/exampleSite/content/shortcodes/siteparam.en.md @@ -29,7 +29,7 @@ While the examples are using shortcodes with named parameter you are free to use ````go {{ partial "shortcodes/siteparam.html" (dict - "context" . + "page" . "name" "editURL" )}} ```` diff --git a/exampleSite/content/shortcodes/tab.en.md b/exampleSite/content/shortcodes/tab.en.md index c78742c5c9..8864ccf69e 100644 --- a/exampleSite/content/shortcodes/tab.en.md +++ b/exampleSite/content/shortcodes/tab.en.md @@ -37,7 +37,7 @@ printf("Hello World!"); ````go {{ partial "shortcodes/tab.html" (dict - "context" . + "page" . "title" "c" "content" ("```c\nprintf(\"Hello World!\")\n```" | .RenderString) )}} diff --git a/exampleSite/content/shortcodes/tabs.en.md b/exampleSite/content/shortcodes/tabs.en.md index 0c1d12f5f9..31e19a1faf 100644 --- a/exampleSite/content/shortcodes/tabs.en.md +++ b/exampleSite/content/shortcodes/tabs.en.md @@ -67,7 +67,7 @@ printf"Hello World!"); ````go {{ partial "shortcodes/tabs.html" (dict - "context" . + "page" . "title" "hello." "content" (slice (dict diff --git a/exampleSite/layouts/partials/shortcodes/piratify.html b/exampleSite/layouts/partials/shortcodes/piratify.html index 5eddc533c8..cfeee0d4cc 100644 --- a/exampleSite/layouts/partials/shortcodes/piratify.html +++ b/exampleSite/layouts/partials/shortcodes/piratify.html @@ -1,21 +1,26 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'piratify' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $content := .content }} {{- $pagefield := cond (ne $content nil) nil (.pagefield | default "Content") }} {{- $writenotice := cond (ne .writenotice nil) .writenotice false }} {{- $langtrg := "pir" }} -{{- $langsrc := cond (eq $context.Lang $langtrg) (.langsrc | default "en") $context.Lang }} +{{- $langsrc := cond (eq $page.Lang $langtrg) (.langsrc | default "en") $page.Lang }} {{- $baseURL := urls.Parse site.BaseURL }} {{- $baseURLpath := $baseURL.Path | default "/" }} -{{- $l := $context.RelPermalink }} +{{- $l := $page.RelPermalink }} {{- $c := "" }} +{{- $srcPage := "" }} {{- if ne $content nil }} {{- $c = $content }} {{- else if eq $pagefield "Content" }} - {{- $c = $context.Content }} + {{- $c = $page.Content }} {{- else if eq $pagefield "TableOfContents" }} - {{- $c = $context.TableOfContents }} + {{- $c = $page.TableOfContents }} {{- end }} -{{- range $context.AllTranslations }} +{{- range $page.AllTranslations }} {{- if eq .Language.Lang $langsrc }} {{- $l = .RelPermalink }} {{- if ne $content nil }} @@ -29,10 +34,10 @@ {{- break }} {{- end }} {{- end }} -{{- if eq $context.Lang $langtrg }} +{{- if eq $page.Lang $langtrg }} {{- if $writenotice }} {{- partial "shortcodes/notice.html" (dict - "context" $context + "page" $page "content" "<p>Fello' pirrrates, grog made us dizzy! Be awarrre <b>some stuff may look weird</b> in this trrranslat'n. Like <b>Merrrmaids</b>, do'n <b>math or chemistrrry</b> and stuff.</p>\n" "icon" "skull-crossbones" "style" "warning" @@ -128,9 +133,9 @@ {{- end }} {{- $c = replaceRE (printf "(src|href)=\"([^\"]*?)/%s/([^\"]*?.files/[^\"]*?\")" $langtrg) "${1}=\"${2}/${3}" $c }} {{- if $srcPage }} - {{- $context.Store.Set "hasMathJax" (or ($context.Store.Get "hasMathJax") ($srcPage.Store.Get "hasMathJax")) }} - {{- $context.Store.Set "hasMermaid" (or ($context.Store.Get "hasMermaid") ($srcPage.Store.Get "hasMermaid")) }} - {{- $context.Store.Set "hasOpenapi" (or ($context.Store.Get "hasOpenapi") ($srcPage.Store.Get "hasOpenapi")) }} + {{- $page.Store.Set "hasMathJax" (or ($page.Store.Get "hasMathJax") ($srcPage.Store.Get "hasMathJax")) }} + {{- $page.Store.Set "hasMermaid" (or ($page.Store.Get "hasMermaid") ($srcPage.Store.Get "hasMermaid")) }} + {{- $page.Store.Set "hasOpenapi" (or ($page.Store.Get "hasOpenapi") ($srcPage.Store.Get "hasOpenapi")) }} {{- end }} {{- end }} {{ $c | safeHTML }} \ No newline at end of file diff --git a/exampleSite/layouts/partials/toc.html b/exampleSite/layouts/partials/toc.html index 517fbcf460..97a5fc0c46 100644 --- a/exampleSite/layouts/partials/toc.html +++ b/exampleSite/layouts/partials/toc.html @@ -15,7 +15,7 @@ </nav> {{- else }} {{- partial "shortcodes/piratify.html" (dict - "context" . + "page" . "pagefield" "TableOfContents" ) }} {{- end }} diff --git a/exampleSite/layouts/shortcodes/piratify.html b/exampleSite/layouts/shortcodes/piratify.html index 09e409a670..ccf63fccc1 100644 --- a/exampleSite/layouts/shortcodes/piratify.html +++ b/exampleSite/layouts/shortcodes/piratify.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/piratify.html" (dict - "context" .Page + "page" .Page "pagefield" "Content" "writenotice" (.Get "writenotice" | default (.Get 0)) ) }} \ No newline at end of file diff --git a/layouts/404.html b/layouts/404.html index f82c1c3b89..e8c1103847 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -66,7 +66,7 @@ <main id="body-inner" class="chapter" tabindex="-1"> <div class="flex-block-wrapper"> <article> - <h1 id="404"><span>4</span>{{ partial "shortcodes/icon.html" (dict "context" . "icon" "far fa-frown" )}}<span>4</span></h1> + <h1 id="404"><span>4</span>{{ partial "shortcodes/icon.html" (dict "page" . "icon" "far fa-frown" )}}<span>4</span></h1> <h2 id="{{ T "title-404" | anchorize }}">{{ T "title-404" }}</h2> <p></p> <p>{{ T "message-404" }}</p> diff --git a/layouts/_default/_markup/render-codeblock-math.html b/layouts/_default/_markup/render-codeblock-math.html index 566b662035..0cadcf928c 100644 --- a/layouts/_default/_markup/render-codeblock-math.html +++ b/layouts/_default/_markup/render-codeblock-math.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/math.html" (dict - "context" .Page + "page" .Page "content" .Inner "align" (index .Attributes "align") ) }} \ No newline at end of file diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html index 196cac09f1..676a6d83bd 100644 --- a/layouts/_default/_markup/render-codeblock-mermaid.html +++ b/layouts/_default/_markup/render-codeblock-mermaid.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/mermaid.html" (dict - "context" .Page + "page" .Page "content" .Inner "align" (index .Attributes "align") ) }} \ No newline at end of file diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html index fa5570d87c..2760287be0 100644 --- a/layouts/_default/_markup/render-codeblock.html +++ b/layouts/_default/_markup/render-codeblock.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/highlight.html" (dict - "context" .Page + "page" .Page "attributes" .Attributes "content" .Inner "options" .Options diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index bb4f848b4a..db609b56fe 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -6,7 +6,7 @@ {{- $id = "" }} {{- end }} {{- partial "shortcodes/image.html" (dict - "context" .Page + "page" .Page "url" .Destination "title" .Title "alt" .Text diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 01ab9f9306..ec188b8f08 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/link.html" (dict - "context" .Page + "page" .Page "url" .Destination "title" .Title "content" .Text diff --git a/layouts/partials/body.searchpage.html b/layouts/partials/body.searchpage.html index ac4f1484a9..ef1a9e7adc 100644 --- a/layouts/partials/body.searchpage.html +++ b/layouts/partials/body.searchpage.html @@ -10,7 +10,7 @@ <label class="a11y-only" for="search-by-detail">{{ T "Search" }}</label> <input data-search-input id="search-by-detail" class="search-by" name="search-by" type="search" placeholder="{{ T "Search-placeholder" }}"> {{- partial "shortcodes/button.html" (dict - "context" $page + "page" $page "type" "submit" "style" "secondary" "icon" "search" diff --git a/layouts/partials/make-random-md5.hugo b/layouts/partials/make-random-md5.hugo index e6dba739df..60fc793bf0 100644 --- a/layouts/partials/make-random-md5.hugo +++ b/layouts/partials/make-random-md5.hugo @@ -1,5 +1,5 @@ -{{- $context := . }} -{{- if (ne $context.Site.Params.disableRandomIds true) }} +{{- $page := . }} +{{- if (ne $page.Site.Params.disableRandomIds true) }} {{- $random := "" }} {{- $set := split "012345abcdefghijklmnopqrstuvwxyz" "" }} {{- range (seq 16) }} diff --git a/layouts/partials/shortcodes/attachments.html b/layouts/partials/shortcodes/attachments.html index 41557cd46f..78fbe705b9 100644 --- a/layouts/partials/shortcodes/attachments.html +++ b/layouts/partials/shortcodes/attachments.html @@ -1,7 +1,11 @@ {{- $version := split hugo.Version "." }} {{- $major := int (index $version 0) }} {{- $minor := int (index $version 1) }} -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'attachments' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $color := .color | default "" }} {{- $content := .content }} {{- $style := .style | default "default" }} @@ -24,19 +28,19 @@ {{- end }} {{- $sort := .sort | default "asc" }} {{- $pattern := .pattern | default "" }} -{{- $defaultUrlPrefix := strings.TrimRight "/" $context.RelPermalink }} +{{- $defaultUrlPrefix := strings.TrimRight "/" $page.RelPermalink }} {{- if .IsTranslated -}} - {{- $defaultLanguage := (index $context.Site.Home.AllTranslations 0).Lang }} - {{- $defaultLanguagePage := index (where $context.AllTranslations "Language.Lang" $defaultLanguage) 0 }} + {{- $defaultLanguage := (index $page.Site.Home.AllTranslations 0).Lang }} + {{- $defaultLanguagePage := index (where $page.AllTranslations "Language.Lang" $defaultLanguage) 0 }} {{- $defaultUrlPrefix = strings.TrimRight "/" $defaultLanguagePage.RelPermalink }} {{- end }} -{{- $urlPrefix := strings.TrimRight "/" $context.RelPermalink }} -{{- with $context }} +{{- $urlPrefix := strings.TrimRight "/" $page.RelPermalink }} +{{- with $page }} {{- if ne .BundleType "leaf" }} {{- if or (and (eq $major 0) (ge $minor 112)) (gt $major 0) }} - {{- 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" $context.File.Path }} + {{- 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" $page.File.Path }} {{- else }} - {{- warnf "%q: DEPRECATED usage of 'attachments' shortcode found which will not be compatible 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" $context.File.Path }} + {{- warnf "%q: DEPRECATED usage of 'attachments' shortcode found which will not be compatible 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" $page.File.Path }} {{- end }} {{- end }} <div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}> diff --git a/layouts/partials/shortcodes/badge.html b/layouts/partials/shortcodes/badge.html index d38a4da73a..bb1f56400f 100644 --- a/layouts/partials/shortcodes/badge.html +++ b/layouts/partials/shortcodes/badge.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'badge' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $color := .color | default "" }} {{- $content := .content }} {{- $style := .style | default "default" }} @@ -15,6 +19,6 @@ {{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }} {{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- end }} -{{- with $context -}} +{{- 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 }}</span></span> {{- end }} \ No newline at end of file diff --git a/layouts/partials/shortcodes/button.html b/layouts/partials/shortcodes/button.html index 7f4a345c7d..d14ed42f8d 100644 --- a/layouts/partials/shortcodes/button.html +++ b/layouts/partials/shortcodes/button.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'button' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $color := .color | default "" }} {{- $content := .content }} {{- $href := (trim .href " ") | default "" }} @@ -17,8 +21,8 @@ {{- end }} {{- else if and (eq (len $target) 0) (or (strings.HasPrefix $href "http://") (strings.HasPrefix $href "https://") ) }} {{- $target = "_blank" }} - {{- if isset $context.Site.Params "externallinktarget" }} - {{- $target = $context.Site.Params.externalLinkTarget }} + {{- if isset $page.Site.Params "externallinktarget" }} + {{- $target = $page.Site.Params.externalLinkTarget }} {{- end }} {{- end }} {{- $title := .title | default ($content) | default ($style | T) }} @@ -35,7 +39,7 @@ {{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- end }} {{- $iconposition := .iconposition | default "left" }} -{{- with $context }} +{{- with $page }} <span class="btn cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}> {{- if $isButton }} <button{{ if $href }} onclick="{{ $href | safeJS }}"{{ end }}{{ if gt (len $type) 0 }} type="{{ $type }}"{{ end }}> diff --git a/layouts/partials/shortcodes/children.html b/layouts/partials/shortcodes/children.html index 384ccd6017..1f09c4753b 100644 --- a/layouts/partials/shortcodes/children.html +++ b/layouts/partials/shortcodes/children.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'children' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $showhidden := .showhidden | default false }} {{- if eq (printf "%T" $showhidden) "string" }} {{- $showhidden = (eq $showhidden "true") }} @@ -15,30 +19,30 @@ {{- $containerstyle = "div" }} {{- end }} -{{- with $context }} +{{- with $page }} {{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }} {{- $pages := .Pages }} {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $currentOrdersectionsby := $sortTerm | default (.Params.ordersectionsby | default $defaultOrdersectionsby) }} {{- if eq $currentOrdersectionsby "weight" }} - {{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- else if or (eq $currentOrdersectionsby "name") (eq $currentOrdersectionsby "title") }} - {{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- else if eq $currentOrdersectionsby "publishdate" }} - {{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- else if eq $currentOrdersectionsby "date" }} - {{- template "childs" dict "menu" $pages.ByDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages.ByDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- else if eq $currentOrdersectionsby "length" }} - {{- template "childs" dict "menu" $pages.ByLength "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages.ByLength "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- else }} - {{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- end }} {{ (printf "</%s>" $containerstyle)|safeHTML }} {{- end }} {{- define "childs" }} - {{ $context := .context }} + {{ $page := .page }} {{- range .menu }} {{- $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }} {{- if not $hidden }} @@ -88,17 +92,17 @@ {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $currentOrdersectionsby := $.sortTerm | default (.Params.ordersectionsby | default $defaultOrdersectionsby) }} {{- if eq $currentOrdersectionsby "weight" }} - {{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- else if or (eq $.currentOrdersectionsby "name") (eq $.currentOrdersectionsby "title") }} - {{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- else if eq $.currentOrdersectionsby "publishdate" }} - {{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- else if eq $.currentOrdersectionsby "date" }} - {{- template "childs" dict "menu" $pages.ByDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages.ByDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- else if eq $.currentOrdersectionsby "length" }} - {{- template "childs" dict "menu" $pages.ByLength "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages.ByLength "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- else }} - {{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- 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 }} {{- end }} {{- if eq $.style "li" }} diff --git a/layouts/partials/shortcodes/expand.html b/layouts/partials/shortcodes/expand.html index d5f5f379dc..9e60974077 100644 --- a/layouts/partials/shortcodes/expand.html +++ b/layouts/partials/shortcodes/expand.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'expand' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $content := .content }} {{- $title := .title | default (T "Expand-title") }} {{- $title = trim $title " " }} @@ -6,8 +10,8 @@ {{- if eq (printf "%T" $expanded) "string" }} {{- $expanded = (eq $expanded "true") }} {{- end }} -{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $context) .id }} -{{- with $context }} +{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }} +{{- with $page }} <div class="expand"> <input type="checkbox" id="expand-{{ $id }}" aria-controls="expandcontent-{{ $id }}" {{ if $expanded }} checked{{ end }}> <label class="expand-label" for="expand-{{ $id }}" > diff --git a/layouts/partials/shortcodes/highlight.html b/layouts/partials/shortcodes/highlight.html index 9ba5f9a403..67a963c73b 100644 --- a/layouts/partials/shortcodes/highlight.html +++ b/layouts/partials/shortcodes/highlight.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'highlight' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $attributes := dict }} {{- $otherAttributes := dict }} {{- $content := "" }} @@ -45,11 +49,11 @@ {{- end }} {{- $params = delimit $params ", " }} {{- $wrap := true }} -{{- if isset $context.Site.Params "highlightwrap" }} - {{- $wrap = $context.Site.Params.highlightWrap }} +{{- if isset $page.Site.Params "highlightwrap" }} + {{- $wrap = $page.Site.Params.highlightWrap }} {{- end }} -{{- if isset $context.Params "highlightwrap" }} - {{- $wrap = $context.Params.highlightWrap }} +{{- if isset $page.Params "highlightwrap" }} + {{- $wrap = $page.Params.highlightWrap }} {{- end }} {{- range $k, $v := $attributes }} {{- if eq $k "wrap" }} diff --git a/layouts/partials/shortcodes/icon.html b/layouts/partials/shortcodes/icon.html index 564896119f..6b1ff33c47 100644 --- a/layouts/partials/shortcodes/icon.html +++ b/layouts/partials/shortcodes/icon.html @@ -1,10 +1,14 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'icon' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- 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 $context }} +{{- with $page }} {{- if $icon -}} <i class="{{ $icon }}"></i> {{- end }} diff --git a/layouts/partials/shortcodes/image.html b/layouts/partials/shortcodes/image.html index 09a7971508..f0fecc1eab 100644 --- a/layouts/partials/shortcodes/image.html +++ b/layouts/partials/shortcodes/image.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'image' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $url := .url }} {{- $title := .title }} {{- $alt := .alt }} @@ -8,7 +12,7 @@ {{- $width := "auto" }} {{- $dest_url := urls.Parse $url }} {{- $dest_path := $dest_url.Path }} -{{- $image := $context.Resources.GetMatch $dest_path }} +{{- $image := $page.Resources.GetMatch $dest_path }} {{- if not $image }} {{- $image = .Resources.GetMatch $dest_path }} {{- end }} @@ -26,7 +30,7 @@ {{- $classes = $classes | append (split ($dest_url.Query.Get "classes") ",") }} {{- end }} {{- if $dest_url.Query.Has "featherlight" }} - {{- warnf "%q: DEPRECATED usage of 'featherlight' image CSS class found, use 'lightbox' instead; see http://localhost:1313/basics/migration/#5110-2023-02-07" $context.File.Path }} + {{- warnf "%q: DEPRECATED usage of 'featherlight' image CSS class found, use 'lightbox' instead; see http://localhost:1313/basics/migration/#5110-2023-02-07" $page.File.Path }} {{- end }} {{- $lightbox = and (ne ($dest_url.Query.Get "lightbox") "false") (ne ($dest_url.Query.Get "featherlight") "false") }} {{- with $dest_url.Query.Get "height" }} @@ -36,7 +40,7 @@ {{ $width = . }} {{- end }} {{- end }} -{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $context) .id }} +{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }} {{- if $lightbox }} <a href="#image-{{ $id }}" class="lightbox-link"> {{- end }} diff --git a/layouts/partials/shortcodes/include.html b/layouts/partials/shortcodes/include.html index b62997cfe6..8c94f650e2 100644 --- a/layouts/partials/shortcodes/include.html +++ b/layouts/partials/shortcodes/include.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'include' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $file := .file }} {{- $hideFirstHeading := .hidefirstheading | default false }} {{- if eq (printf "%T" $hideFirstHeading) "string" }} @@ -6,7 +10,7 @@ {{- end }} {{- if and (gt (len (trim $file " ")) 0) (fileExists $file) }} {{- if $hideFirstHeading }}<div class="include hide-first-heading">{{ end }} - {{- with $context }} + {{- with $page }} {{ $file | readFile | safeHTML }} diff --git a/layouts/partials/shortcodes/link.html b/layouts/partials/shortcodes/link.html index 3776dc9593..e0b1179a97 100644 --- a/layouts/partials/shortcodes/link.html +++ b/layouts/partials/shortcodes/link.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'link' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $url := .url }} {{- $title := .title | default "" }} {{- $title = trim $title " " }} @@ -6,8 +10,8 @@ {{- $target := .target | default "" }} {{- if and (eq (len $target) 0) (or (strings.HasPrefix $url "http://") (strings.HasPrefix $url "https://") ) }} {{- $target = "_blank" }} - {{- if isset $context.Site.Params "externallinktarget" }} - {{- $target = $context.Site.Params.externalLinkTarget }} + {{- if isset $page.Site.Params "externallinktarget" }} + {{- $target = $page.Site.Params.externalLinkTarget }} {{- end }} {{- end -}} <a href="{{ $url | safeURL }}"{{ if $title }} title="{{ $title }}"{{ end }}{{ if gt (len $target) 0 }} target="{{ $target }}"{{ end }}>{{ $content | safeHTML }}</a> \ No newline at end of file diff --git a/layouts/partials/shortcodes/math.html b/layouts/partials/shortcodes/math.html index ec36ae1946..ed1d19e096 100644 --- a/layouts/partials/shortcodes/math.html +++ b/layouts/partials/shortcodes/math.html @@ -1,7 +1,11 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'math' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $content := .content }} {{- $align := .align | default "center" }} -{{- with $context }} +{{- with $page }} <span class="math align-{{ $align }}"> {{- $content | safeHTML -}} </span> diff --git a/layouts/partials/shortcodes/mermaid.html b/layouts/partials/shortcodes/mermaid.html index c67410e6b6..8f170f9a08 100644 --- a/layouts/partials/shortcodes/mermaid.html +++ b/layouts/partials/shortcodes/mermaid.html @@ -1,8 +1,12 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'mermaid' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $content := .content }} {{- $align := .align | default "center" }} -{{- $zoom := $context.Site.Params.mermaidZoom | default false }} -{{- with $context.Params.mermaidZoom }} +{{- $zoom := $page.Site.Params.mermaidZoom | default false }} +{{- with $page.Params.mermaidZoom }} {{- $zoom = . }} {{- if eq (printf "%T" .) "string" }} {{- $zoom = (eq . "true") }} @@ -14,7 +18,7 @@ {{- $zoom = (eq . "true") }} {{- end }} {{- end }} -{{- with $context }} +{{- with $page }} <div class="mermaid align-{{ $align }}{{ if $zoom }} zoom{{ end }}"> {{- replaceRE "'" "'" ( replaceRE """ "\"" ( $content | safeHTML ) ) -}} </div> diff --git a/layouts/partials/shortcodes/notice.html b/layouts/partials/shortcodes/notice.html index 8f82b1f36a..df76f7c7f2 100644 --- a/layouts/partials/shortcodes/notice.html +++ b/layouts/partials/shortcodes/notice.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'notice' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $color := .color | default "" }} {{- $content := .content }} {{- $style := .style | default "default" }} @@ -15,7 +19,7 @@ {{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }} {{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- end }} -{{- with $context }} +{{- with $page }} <div class="box notices 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> <div class="box-content"> diff --git a/layouts/partials/shortcodes/openapi.html b/layouts/partials/shortcodes/openapi.html index 7fc7edd4cd..7d10a8d108 100644 --- a/layouts/partials/shortcodes/openapi.html +++ b/layouts/partials/shortcodes/openapi.html @@ -1,7 +1,11 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'openapi' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $src := .src }} -{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $context) .id }} -{{- with $context }} +{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }} +{{- with $page }} {{- with .Resources.Match $src }} {{- range . }} {{- $src = .RelPermalink }} diff --git a/layouts/partials/shortcodes/siteparam.html b/layouts/partials/shortcodes/siteparam.html index fb78381b3a..51b2599750 100644 --- a/layouts/partials/shortcodes/siteparam.html +++ b/layouts/partials/shortcodes/siteparam.html @@ -1,6 +1,10 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'siteparam' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $paramNames := split .name "." }} -{{- with $context }} +{{- with $page }} {{- $params := .Site.Params }} {{- range $paramName := $paramNames }} {{- with $params }} diff --git a/layouts/partials/shortcodes/swagger.html b/layouts/partials/shortcodes/swagger.html index fb33e17abc..8696d8c929 100644 --- a/layouts/partials/shortcodes/swagger.html +++ b/layouts/partials/shortcodes/swagger.html @@ -1,6 +1,11 @@ {{ warnf "%q: DEPRECATED shortcode `swagger`found, use `openapi` instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5130-2023-05-17" .context.File.Path }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'swagger' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- partial "shortcodes/openapi.html" (dict - "context" .context + "page" $page "src" .src "id" .id ) }} \ No newline at end of file diff --git a/layouts/partials/shortcodes/tab.html b/layouts/partials/shortcodes/tab.html index 20d4b334e9..e6959e2c2c 100644 --- a/layouts/partials/shortcodes/tab.html +++ b/layouts/partials/shortcodes/tab.html @@ -1,3 +1,8 @@ +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'tab' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $tabs := (slice | append (dict "color" .color "content" .content @@ -7,7 +12,7 @@ "title" .title )) }} {{- partial "shortcodes/tabs.html" (dict - "context" .context + "page" $page "color" "" "content" $tabs "groupid" "" diff --git a/layouts/partials/shortcodes/tabs.html b/layouts/partials/shortcodes/tabs.html index f607976aa3..7ac6efd855 100644 --- a/layouts/partials/shortcodes/tabs.html +++ b/layouts/partials/shortcodes/tabs.html @@ -1,5 +1,9 @@ -{{- $context := .context }} -{{- $groupid := .groupid | default (partial "make-random-md5.hugo" $context) }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'tabs' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} +{{- $groupid := .groupid | default (partial "make-random-md5.hugo" $page) }} {{- $color := .color }} {{- $style := .style }} {{- $title := .title }} @@ -7,7 +11,7 @@ {{- $tabs := slice }} {{- range $tab := (.content | default slice) }} {{- if and (not $tab.title) $tab.name }} - {{- warnf "%q: DEPRECATED parameter 'name' for shortcode 'tab' found, use 'title' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5160-2023-06-08" $context.File.Path }} + {{- warnf "%q: DEPRECATED parameter 'name' for shortcode 'tab' found, use 'title' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5160-2023-06-08" $page.File.Path }} {{- $tab = merge $tab (dict "title" .name) }} {{- end }} {{- with $tab }} @@ -30,7 +34,7 @@ "color" $color "content" .content "icon" $icon - "itemid" (printf "%s%s" ($title | $context.RenderString | plainify) ($icon | plainify)) + "itemid" (printf "%s%s" ($title | $page.RenderString | plainify) ($icon | plainify)) "style" $style "title" $title ) }} @@ -51,10 +55,10 @@ {{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }} {{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- end }} -{{- with $context }} +{{- with $page }} <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 | $context.RenderString }}{{ if (not $title) }}​{{ end }}</div> + <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 }}" @@ -62,8 +66,8 @@ onclick="switchTab('{{ $groupid }}','{{ .itemid }}')" > <div> - <div class="tab-nav-hidden">{{ if .icon }}<i class="{{ .icon }}"></i>{{ end }}{{ if and .icon .title }} {{ end }}{{ .title | $context.RenderString }}{{ if (not .title) }}​{{ end }}</div> - <div class="tab-nav-text">{{ if .icon }}<i class="{{ .icon }}"></i>{{ end }}{{ if and .icon .title }} {{ end }}{{ .title | $context.RenderString }}{{ if (not .title) }}​{{ end }}</div> + <div class="tab-nav-hidden">{{ if .icon }}<i class="{{ .icon }}"></i>{{ end }}{{ if and .icon .title }} {{ end }}{{ .title | $page.RenderString }}{{ if (not .title) }}​{{ end }}</div> + <div class="tab-nav-text">{{ if .icon }}<i class="{{ .icon }}"></i>{{ end }}{{ if and .icon .title }} {{ end }}{{ .title | $page.RenderString }}{{ if (not .title) }}​{{ end }}</div> </div> </button> {{- end }} diff --git a/layouts/shortcodes/attachments.html b/layouts/shortcodes/attachments.html index 34a7ee7157..d44408b575 100644 --- a/layouts/shortcodes/attachments.html +++ b/layouts/shortcodes/attachments.html @@ -1,6 +1,6 @@ {{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/attachments.html" (dict - "context" .Page + "page" .Page "color" (.Get "color") "content" .Inner "icon" (.Get "icon") diff --git a/layouts/shortcodes/badge.html b/layouts/shortcodes/badge.html index b3c4163c03..939d87ab64 100644 --- a/layouts/shortcodes/badge.html +++ b/layouts/shortcodes/badge.html @@ -1,6 +1,6 @@ {{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/badge.html" (dict - "context" .Page + "page" .Page "color" (.Get "color") "content" .Inner "icon" (.Get "icon") diff --git a/layouts/shortcodes/button.html b/layouts/shortcodes/button.html index 1e9941d1ab..70500aa65a 100644 --- a/layouts/shortcodes/button.html +++ b/layouts/shortcodes/button.html @@ -1,6 +1,6 @@ {{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/button.html" (dict - "context" .Page + "page" .Page "color" (.Get "color") "content" .Inner "href" (.Get "href") diff --git a/layouts/shortcodes/children.html b/layouts/shortcodes/children.html index d000514859..cd52aebe91 100644 --- a/layouts/shortcodes/children.html +++ b/layouts/shortcodes/children.html @@ -1,6 +1,6 @@ {{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/children.html" (dict - "context" .Page + "page" .Page "containerstyle" (.Get "containerstyle") "description" (.Get "description") "depth" (.Get "depth") diff --git a/layouts/shortcodes/expand.html b/layouts/shortcodes/expand.html index caa3d9561f..9dd972e58d 100644 --- a/layouts/shortcodes/expand.html +++ b/layouts/shortcodes/expand.html @@ -7,7 +7,7 @@ {{- $id = "" }} {{- end }} {{- partial "shortcodes/expand.html" (dict - "context" .Page + "page" .Page "content" .Inner "open" (.Get "open" | default (.Get 1)) "title" (.Get "title" | default (.Get 0)) diff --git a/layouts/shortcodes/highlight.html b/layouts/shortcodes/highlight.html index 2b10b91214..b46f1181d1 100644 --- a/layouts/shortcodes/highlight.html +++ b/layouts/shortcodes/highlight.html @@ -24,7 +24,7 @@ {{- end }} {{- end }} {{- partial "shortcodes/highlight.html" (dict - "context" .Page + "page" .Page "attributes" $attributes "content" $content "options" $options diff --git a/layouts/shortcodes/icon.html b/layouts/shortcodes/icon.html index 80e60fd99a..a0e422addc 100644 --- a/layouts/shortcodes/icon.html +++ b/layouts/shortcodes/icon.html @@ -1,5 +1,5 @@ {{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/icon.html" (dict - "context" .Page + "page" .Page "icon" (.Get "icon" | default (.Get 0)) ) }} \ No newline at end of file diff --git a/layouts/shortcodes/include.html b/layouts/shortcodes/include.html index c9901a5cd6..9782b54346 100644 --- a/layouts/shortcodes/include.html +++ b/layouts/shortcodes/include.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/include.html" (dict - "context" .Page + "page" .Page "file" (.Get "file" | default (.Get 0)) "hidefirstheading" (.Get "hidefirstheading" | default (.Get 1)) ) }} \ No newline at end of file diff --git a/layouts/shortcodes/math.html b/layouts/shortcodes/math.html index 1e037bac43..5c7ae6d9d2 100644 --- a/layouts/shortcodes/math.html +++ b/layouts/shortcodes/math.html @@ -1,6 +1,6 @@ {{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/math.html" (dict - "context" .Page + "page" .Page "content" .Inner "align" (.Get "align") ) }} \ No newline at end of file diff --git a/layouts/shortcodes/mermaid.html b/layouts/shortcodes/mermaid.html index 1ff05523e3..e0c8820578 100644 --- a/layouts/shortcodes/mermaid.html +++ b/layouts/shortcodes/mermaid.html @@ -1,6 +1,6 @@ {{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/mermaid.html" (dict - "context" .Page + "page" .Page "content" .Inner "align" (.Get "align") "zoom" (.Get "zoom") diff --git a/layouts/shortcodes/notice.html b/layouts/shortcodes/notice.html index e65d9be16f..83c4decd23 100644 --- a/layouts/shortcodes/notice.html +++ b/layouts/shortcodes/notice.html @@ -1,6 +1,6 @@ {{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/notice.html" (dict - "context" .Page + "page" .Page "color" (.Get "color") "content" .Inner "icon" (.Get "icon" | default (.Get 2)) diff --git a/layouts/shortcodes/openapi.html b/layouts/shortcodes/openapi.html index 69a529bef4..82f03ac231 100644 --- a/layouts/shortcodes/openapi.html +++ b/layouts/shortcodes/openapi.html @@ -6,7 +6,7 @@ {{- $id = "" }} {{- end }} {{- partial "shortcodes/openapi.html" (dict - "context" .Page + "page" .Page "src" (.Get "src") "id" $id ) }} \ No newline at end of file diff --git a/layouts/shortcodes/siteparam.html b/layouts/shortcodes/siteparam.html index 8aa20b1fe2..3e48ba34a3 100644 --- a/layouts/shortcodes/siteparam.html +++ b/layouts/shortcodes/siteparam.html @@ -1,4 +1,4 @@ {{- partial "shortcodes/siteparam.html" (dict - "context" .Page + "page" .Page "name" (.Get "name" | default (.Get 0)) ) }} \ No newline at end of file diff --git a/layouts/shortcodes/swagger.html b/layouts/shortcodes/swagger.html index 7d06c9065e..38ca409a42 100644 --- a/layouts/shortcodes/swagger.html +++ b/layouts/shortcodes/swagger.html @@ -6,7 +6,7 @@ {{- $id = "" }} {{- end }} {{- partial "shortcodes/swagger.html" (dict - "context" .Page + "page" .Page "src" (.Get "src") "id" $id ) }} \ No newline at end of file diff --git a/layouts/shortcodes/tab.html b/layouts/shortcodes/tab.html index 89c3f296e9..1f8dcc0690 100644 --- a/layouts/shortcodes/tab.html +++ b/layouts/shortcodes/tab.html @@ -22,7 +22,7 @@ {{- else }} {{- $c:=""}}{{/* if no containing tabs shortcode is present, we display this tab as single */}} {{- partial "shortcodes/tabs.html" (dict - "context" .Page + "page" .Page "color" "" "content" $tabs "groupid" "" diff --git a/layouts/shortcodes/tabs.html b/layouts/shortcodes/tabs.html index a6770dedab..5a64f099df 100644 --- a/layouts/shortcodes/tabs.html +++ b/layouts/shortcodes/tabs.html @@ -9,7 +9,7 @@ {{- $title := (.Get "title") }} {{- $tabs := (.Scratch.Get "tabs") }} {{- partial "shortcodes/tabs.html" (dict - "context" .Page + "page" .Page "color" $color "content" $tabs "groupid" $groupid