mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
shortcodes: change context parameter to page if called as partial #595
This commit is contained in:
parent
09ffd597a1
commit
5e71d61c46
60 changed files with 214 additions and 135 deletions
|
@ -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"
|
||||
)}}
|
||||
````
|
||||
|
|
|
@ -31,28 +31,28 @@ 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"
|
||||
"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"
|
||||
"content" "Awesome"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
)}}
|
||||
````
|
||||
|
|
|
@ -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!"
|
||||
)}}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
)}}
|
||||
````
|
||||
|
|
|
@ -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"
|
||||
)}}
|
||||
````
|
||||
|
|
|
@ -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"
|
||||
)}}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -25,7 +25,7 @@ While the examples are using shortcodes with named parameter you are free to als
|
|||
|
||||
````go
|
||||
{{ partial "shortcodes/openapi.html" (dict
|
||||
"context" .
|
||||
"page" .
|
||||
"src" "https://petstore3.openapi.io/api/v3/openapi.json"
|
||||
)}}
|
||||
````
|
||||
|
|
|
@ -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"
|
||||
)}}
|
||||
````
|
||||
|
|
|
@ -37,7 +37,7 @@ printf("Hello World!");
|
|||
|
||||
````go
|
||||
{{ partial "shortcodes/tab.html" (dict
|
||||
"context" .
|
||||
"page" .
|
||||
"title" "c"
|
||||
"content" ("```c\nprintf(\"Hello World!\")\n```" | .RenderString)
|
||||
)}}
|
||||
|
|
|
@ -67,7 +67,7 @@ printf"Hello World!");
|
|||
|
||||
````go
|
||||
{{ partial "shortcodes/tabs.html" (dict
|
||||
"context" .
|
||||
"page" .
|
||||
"title" "hello."
|
||||
"content" (slice
|
||||
(dict
|
||||
|
|
|
@ -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 }}
|
|
@ -15,7 +15,7 @@
|
|||
</nav>
|
||||
{{- else }}
|
||||
{{- partial "shortcodes/piratify.html" (dict
|
||||
"context" .
|
||||
"page" .
|
||||
"pagefield" "TableOfContents"
|
||||
) }}
|
||||
{{- end }}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{- partial "shortcodes/piratify.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"pagefield" "Content"
|
||||
"writenotice" (.Get "writenotice" | default (.Get 0))
|
||||
) }}
|
|
@ -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>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{- partial "shortcodes/math.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"content" .Inner
|
||||
"align" (index .Attributes "align")
|
||||
) }}
|
|
@ -1,5 +1,5 @@
|
|||
{{- partial "shortcodes/mermaid.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"content" .Inner
|
||||
"align" (index .Attributes "align")
|
||||
) }}
|
|
@ -1,5 +1,5 @@
|
|||
{{- partial "shortcodes/highlight.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"attributes" .Attributes
|
||||
"content" .Inner
|
||||
"options" .Options
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{{- $id = "" }}
|
||||
{{- end }}
|
||||
{{- partial "shortcodes/image.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"url" .Destination
|
||||
"title" .Title
|
||||
"alt" .Text
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{- partial "shortcodes/link.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"url" .Destination
|
||||
"title" .Title
|
||||
"content" .Text
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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) }}
|
||||
|
|
|
@ -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 }}>
|
||||
|
|
|
@ -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 }}
|
|
@ -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 }}>
|
||||
|
|
|
@ -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" }}
|
||||
|
|
|
@ -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 }}" >
|
||||
|
|
|
@ -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" }}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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 }}
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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
|
||||
) }}
|
|
@ -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" ""
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
{{- end }}
|
||||
{{- end }}
|
||||
{{- partial "shortcodes/highlight.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"attributes" $attributes
|
||||
"content" $content
|
||||
"options" $options
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{- $_hugo_config := `{ "version": 1 }` }}
|
||||
{{- partial "shortcodes/icon.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"icon" (.Get "icon" | default (.Get 0))
|
||||
) }}
|
|
@ -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))
|
||||
) }}
|
|
@ -1,6 +1,6 @@
|
|||
{{- $_hugo_config := `{ "version": 1 }` }}
|
||||
{{- partial "shortcodes/math.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"content" .Inner
|
||||
"align" (.Get "align")
|
||||
) }}
|
|
@ -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")
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{{- $id = "" }}
|
||||
{{- end }}
|
||||
{{- partial "shortcodes/openapi.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"src" (.Get "src")
|
||||
"id" $id
|
||||
) }}
|
|
@ -1,4 +1,4 @@
|
|||
{{- partial "shortcodes/siteparam.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"name" (.Get "name" | default (.Get 0))
|
||||
) }}
|
|
@ -6,7 +6,7 @@
|
|||
{{- $id = "" }}
|
||||
{{- end }}
|
||||
{{- partial "shortcodes/swagger.html" (dict
|
||||
"context" .Page
|
||||
"page" .Page
|
||||
"src" (.Get "src")
|
||||
"id" $id
|
||||
) }}
|
|
@ -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" ""
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue