initial commit
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'attachments' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED shortcode `attachments` found, use `resources` instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments#migration" $filepath }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $style := .style | default "default" }}
|
||||
{{- if and (not $color) (eq (len $color) 0) }}
|
||||
{{- $style = .style | default "transparent" }}
|
||||
{{- end }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title | default ("Attachments-label" | T)) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon | default "paperclip") " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- $sort := .sort | default "asc" }}
|
||||
{{- $pattern := .pattern | default "" }}
|
||||
{{- $defaultUrlPrefix := strings.TrimRight "/" $page.RelPermalink }}
|
||||
{{- if .IsTranslated -}}
|
||||
{{- $defaultLanguage := (index $page.Site.Home.AllTranslations 0).Language.Lang }}
|
||||
{{- $defaultLanguagePage := index (where $page.AllTranslations "Language.Lang" $defaultLanguage) 0 }}
|
||||
{{- $defaultUrlPrefix = strings.TrimRight "/" $defaultLanguagePage.RelPermalink }}
|
||||
{{- end }}
|
||||
{{- $urlPrefix := strings.TrimRight "/" $page.RelPermalink }}
|
||||
{{- with $page }}
|
||||
{{- if ne .BundleType "leaf" }}
|
||||
{{- warnf "%q: UNSUPPORTED usage of 'attachments' shortcode found while using Hugo >= 0.112.0, use a leaf bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments/index.html#single-language" $filepath }}
|
||||
{{- end -}}
|
||||
<div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
|
||||
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}</div>
|
||||
<ul class="box-content attachments-files">
|
||||
{{- $fileDir := path.Dir (strings.TrimPrefix (path.Clean hugo.WorkingDir) (path.Clean .File.Filename)) }}
|
||||
{{- $fileDir = printf "%s/" (path.Clean (strings.TrimPrefix "/" $fileDir)) }}
|
||||
{{- $fileLink := $fileDir }}
|
||||
{{- $fileLink = strings.TrimPrefix "content/" $fileLink }}
|
||||
{{- $filesName := printf "%s.files" .File.BaseFileName }}
|
||||
{{- if and (eq .File.BaseFileName "index") (fileExists (printf "%sfiles" $fileDir)) }}
|
||||
{{- /* backward compat to < 5.9.0 behavior */}}
|
||||
{{- $filesName = "files" }}
|
||||
{{- end }}
|
||||
{{- $dir := printf "%s%s" $fileDir $filesName }}
|
||||
{{- if fileExists $dir }}
|
||||
{{- range sort (readDir $dir) "Name" $sort }}
|
||||
{{- if findRE $pattern .Name}}
|
||||
{{- $size := .Size }}
|
||||
{{- $unit := "Byte-symbol" }}
|
||||
{{- if ge $size 1024 }}
|
||||
{{- $size = div $size 1024 }}
|
||||
{{- $unit = "Kilobyte-symbol" }}
|
||||
{{- end }}
|
||||
{{- if ge $size 1024 }}
|
||||
{{- $size = div $size 1024 }}
|
||||
{{- $unit = "Megabyte-symbol" }}
|
||||
{{- end }}
|
||||
{{- $unitsymbol := $unit | T }}
|
||||
{{- $link := (printf "%s%s/%s" $fileLink $filesName .Name) | relLangURL }}
|
||||
{{- /* Hugo stores the attachments always in the default language subdirectory */}}
|
||||
{{- $link = replace $link $urlPrefix $defaultUrlPrefix 1 }}
|
||||
<li><a href="{{ $link }}">{{.Name}}</a> ({{$size}} {{$unitsymbol}})</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'badge' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $content := .content }}
|
||||
{{- $style := .style | default "default" }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon) " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- with $page -}}
|
||||
<span class="badge cstyle {{ $style }}{{ if or $icon $title }} badge-with-title{{ end }}">{{ if or $icon $title }}<span class="badge-title">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title | .RenderString }}{{ end }}</span>{{ end }}<span class="badge-content"{{ if $color }} style="background-color: {{ $color }};"{{ end }}>{{ $content | safeHTML }}</span></span>
|
||||
{{- end }}
|
||||
@@ -0,0 +1,84 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'button' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $content := .content }}
|
||||
{{- $href := (trim .href " ") | default "" }}
|
||||
{{- $style := .style | default "default" }}
|
||||
{{- if and (not $color) (eq (len $color) 0) }}
|
||||
{{- $style = .style | default "transparent" }}
|
||||
{{- end }}
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $type := .type | default "" }}
|
||||
{{- $isButton := false }}
|
||||
{{- $isLink := false }}
|
||||
{{- if or $type (strings.HasPrefix $href "javascript:") }}
|
||||
{{- $isButton = true }}
|
||||
{{- $href = substr $href (len "javascript:") }}
|
||||
{{- if not $type }}
|
||||
{{- $type = "button" }}
|
||||
{{- end }}
|
||||
{{- else if not $href }}
|
||||
{{- else }}
|
||||
{{- $isLink = true }}
|
||||
{{- $u := urls.Parse .href }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" .href "page" $page "type" "link") $u.String }}
|
||||
{{- else }}
|
||||
{{- $linkObject := partial "_relearn/linkObject.gotmpl" (dict "url" .href "page" $page) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $href = partial "_relearn/decoratedLink.gotmpl" (dict "url" .href "page" $page "linkObject" $linkObject "param" "link") }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: link '%s' is not a page or a resource" $filepath .href }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .href "page" $page "param" "link" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (isset . "target") (or (ne (printf "%T" .target) "string") (ne (trim .target " " ) "")) }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'target' for shortcode 'button' found, use link effects instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-4-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $attributes = merge $attributes (partial "_relearn/linkAttributes.gotmpl" (dict "url" $href "page" $page "target" .target)) -}}
|
||||
{{- end }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" (or .title $content) "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon) " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- $iconposition := .iconposition | default "left" }}
|
||||
{{- with $page -}}
|
||||
<span class="btn cstyle {{ if or $isButton $isLink }}interactive {{ end }}{{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
|
||||
{{- if $isButton -}}
|
||||
<button onclick="{{ $href | safeJS }}"{{ if gt (len $type) 0 }} type="{{ $type }}"{{ end }}>
|
||||
{{- else if $isLink -}}
|
||||
<a
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- printf " %s" $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
{{- else -}}
|
||||
<span>
|
||||
{{- end }}
|
||||
{{- if and $icon (eq $iconposition "left") }}<i class="{{ $icon }}"></i>{{ end }}
|
||||
{{- if and $icon (eq $iconposition "left") $title }} {{ end }}
|
||||
{{- if $title }}<span class="title">{{- $title | safeHTML }}</span>{{ end }}
|
||||
{{- if and $icon (eq $iconposition "right") $title }} {{ end }}
|
||||
{{- if and $icon (eq $iconposition "right") }}<i class="{{ $icon }}"></i>{{ end }}
|
||||
{{- if $isButton -}}
|
||||
</button>
|
||||
{{- else if $isLink -}}
|
||||
</a>
|
||||
{{- else -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</span>
|
||||
{{- end }}
|
||||
@@ -0,0 +1,68 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'children' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $showhidden := .showhidden | default false }}
|
||||
{{- if eq (printf "%T" $showhidden) "string" }}
|
||||
{{- $showhidden = (eq $showhidden "true") }}
|
||||
{{- end }}
|
||||
{{- $style := .style | default "li" }}
|
||||
{{- $depth := .depth | default 1 }}
|
||||
{{- $withDescription := .description | default false }}
|
||||
{{- if eq (printf "%T" $withDescription) "string" }}
|
||||
{{- $withDescription = (eq $withDescription "true") }}
|
||||
{{- end }}
|
||||
{{- $sortTerm := .sort | lower }}
|
||||
{{- $containerstyle := .containerstyle | default "ul" }}
|
||||
{{- if( and (not (eq $style "li") ) (eq $containerstyle "ul" ) ) }}
|
||||
{{- $containerstyle = "div" }}
|
||||
{{- end }}
|
||||
|
||||
{{- with $page -}}
|
||||
{{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }}
|
||||
{{- $pages := partial "_relearn/pages.gotmpl" (dict "page" . "by" $sortTerm) }}
|
||||
{{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }}
|
||||
{{ (printf "</%s>" $containerstyle)|safeHTML }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "childs" }}
|
||||
{{- $page := .page }}
|
||||
{{- range .menu }}
|
||||
{{- $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
||||
{{- if not $hidden }}
|
||||
{{- if not .IsHome }}
|
||||
{{- if hasPrefix $.style "h" }}
|
||||
{{- $num := sub ( int (trim $.style "h") ) 1 }}
|
||||
{{- $numn := add $num $.count }}
|
||||
{{ (printf ` <h%d class="children-title" id="%s">` $numn (.LinkTitle | plainify | anchorize))|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}{{ (printf "</h%d>" $numn)|safeHTML }}
|
||||
{{- else if eq $.style "li" }}
|
||||
{{ (printf ` <%s class="children-title">` $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}
|
||||
{{- else }}
|
||||
{{ (printf ` <%s class="children-title">` $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "permalink.gotmpl" (dict "to" .) }}">{{ .LinkTitle }}</a>{{ else }}<span>{{ .LinkTitle }}</span>{{ end }}{{ (printf "</%s>" $.style)|safeHTML }}
|
||||
{{- end }}
|
||||
{{- if $.description }}
|
||||
{{- with or .Description .Summary -}}
|
||||
<p>{{ . }}</p>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if lt $.count $.depth }}
|
||||
{{- if eq $.style "li" }}
|
||||
{{- (printf "<%s>" $.containerstyle)|safeHTML }}
|
||||
{{- end }}
|
||||
{{- $pages := partial "_relearn/pages.gotmpl" (dict "page" . "by" $.sortTerm) }}
|
||||
{{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }}
|
||||
{{- if eq $.style "li" }}
|
||||
{{- (printf "</%s>" $.containerstyle)|safeHTML }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not .IsHome }}
|
||||
{{- if eq $.style "li" }}
|
||||
{{- (printf "</%s>" $.style)|safeHTML -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'expand' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $title := .title | default (T "Expand-title") }}
|
||||
{{- $title = trim $title " " }}
|
||||
{{- $expanded := .expanded | default false }}
|
||||
{{- if and (isset . "open") (or (ne (printf "%T" .open) "string") (ne (trim .open " " ) "")) }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'open' for shortcode 'expand' found, use 'expanded' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-3-0" $filepath }}
|
||||
{{- $expanded = .open }}
|
||||
{{- end }}
|
||||
{{- if eq (printf "%T" $expanded) "string" }}
|
||||
{{- $expanded = (eq $expanded "true") }}
|
||||
{{- end }}
|
||||
{{- partial "shortcodes/notice.html" (dict
|
||||
"page" .page
|
||||
"content" .content
|
||||
"expanded" $expanded
|
||||
"style" "transparent"
|
||||
"title" $title
|
||||
) }}
|
||||
@@ -0,0 +1,112 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'highlight' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $attributes := dict }}
|
||||
{{- $otherAttributes := dict }}
|
||||
{{- $content := "" }}
|
||||
{{- $options := dict }}
|
||||
{{- $otherOptions := dict }}
|
||||
{{- $type := "" }}
|
||||
{{- range $k, $v := . }}
|
||||
{{- if eq $k "context" }}
|
||||
{{- else if eq $k "page" }}
|
||||
{{- else if eq $k "attributes" }}
|
||||
{{- $attributes = $v }}
|
||||
{{- else if eq $k "content" }}
|
||||
{{- $content = trim $v "\n\r" }}
|
||||
{{- else if eq $k "options" }}
|
||||
{{- if eq (printf "%T" $v) "string" }}
|
||||
{{- range (split $v ",") }}
|
||||
{{- $pair := split . "=" }}
|
||||
{{- $options = $options | merge (dict (index $pair 0) (index $pair 1)) }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $options = $v }}
|
||||
{{- end }}
|
||||
{{- else if eq $k "type" }}
|
||||
{{- $type = $v }}
|
||||
{{- else if eq $k "title" }}
|
||||
{{- $otherAttributes = $otherAttributes | merge (dict $k $v) }}
|
||||
{{- else if eq $k "wrap" }}
|
||||
{{- $otherAttributes = $otherAttributes | merge (dict $k $v) }}
|
||||
{{- else }}
|
||||
{{- $otherOptions = $otherOptions | merge (dict $k $v) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* separate attributes from options */}}
|
||||
{{- $hl_inline := false }}
|
||||
{{- if and (isset $page.Params "markup") (isset $page.Params.markup "highlight") (isset $page.Params.markup.highlight "hl_inline") }}
|
||||
{{- $hl_inline = $page.Params.markup.highlight.hl_inline }}
|
||||
{{- end }}
|
||||
{{- $options = $options | merge $otherOptions }}
|
||||
{{- $otherOptions := dict }}
|
||||
{{- range $k, $v := $options }}
|
||||
{{- if eq $k "hl_inline" }}
|
||||
{{- $hl_inline = $v }}
|
||||
{{- $otherOptions = (dict $k $v) | merge $otherOptions }}
|
||||
{{- else if eq $k "title" }}
|
||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||
{{- else if eq $k "wrap" }}
|
||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||
{{- else }}
|
||||
{{- $otherOptions = (dict $k $v) | merge $otherOptions }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $options = $otherOptions }}
|
||||
|
||||
{{- /* separate shortcode attributes from rest */}}
|
||||
{{- $title := "" }}
|
||||
{{- $wrap := true }}
|
||||
{{- if isset $page.Site.Params "highlightwrap" }}
|
||||
{{- $wrap = $page.Site.Params.highlightWrap }}
|
||||
{{- end }}
|
||||
{{- if isset $page.Params "highlightwrap" }}
|
||||
{{- $wrap = $page.Params.highlightWrap }}
|
||||
{{- end }}
|
||||
{{- $attributes = $attributes | merge $otherAttributes }}
|
||||
{{- $otherAttributes := dict }}
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if eq $k "title" }}
|
||||
{{- $title = $v }}
|
||||
{{- else if eq $k "wrap" }}
|
||||
{{- $wrap = $v }}
|
||||
{{- else }}
|
||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $attributes = $otherAttributes }}
|
||||
{{- if eq (printf "%T" $wrap) "string" }}
|
||||
{{- $wrap = (eq $wrap "true") }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* enrich attributes */}}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) "highlight" slice) " ")) }}
|
||||
{{- if and $wrap (not $hl_inline) }}
|
||||
{{- $attributes = merge $options (dict "class" (delimit (append (index $attributes "class" | default slice) "wrap-code" slice) " ")) }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* print da shtuff */}}
|
||||
{{- $div := slice }}
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- $div = $div | append (printf "%s=%q" $k $v | safeHTMLAttr) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $content = highlight $content $type $options }}
|
||||
{{- $content = replaceRE "^([\\s\\n\\r]*)(<pre\\s+?[\\s\\S]*)$" "${1}<div class=\"highlight\">${2}</div>" $content }}
|
||||
{{- $content = replaceRE "(class=\")([^\"]*)\"" (printf "%s" (delimit $div " ")) $content 1 }}
|
||||
{{- if and $title (not $hl_inline) }}
|
||||
{{- partial "shortcodes/tab.html" (dict
|
||||
"page" $page
|
||||
"title" $title
|
||||
"content" $content
|
||||
)}}
|
||||
{{- else }}
|
||||
{{- $content | safeHTML }}
|
||||
{{- if and (not $hl_inline) (not (hasSuffix $content "\n")) }}
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'icon' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $icon := .icon | default "" }}
|
||||
{{- $icon = trim $icon " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- with $page }}
|
||||
{{- if $icon -}}
|
||||
<i class="{{ $icon }}"></i>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,73 @@
|
||||
{{- /* based on Hugo 0.125.5 render-image.html */}}
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'image' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $title := .title }}
|
||||
{{- $alt := .alt }}
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $linkObject := "" }}
|
||||
{{- $u := urls.Parse .url }}
|
||||
{{- $src := $u.String }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" .url "page" $page "type" "image") $u.String }}
|
||||
{{- else }}
|
||||
{{- $linkObject = partial "_relearn/linkObject.gotmpl" (dict "url" .url "page" $page "searchPage" false) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $src = partial "_relearn/decoratedLink.gotmpl" (dict "url" .url "page" $page "linkObject" $linkObject "param" "image") }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: image '%s' is not a resource" $filepath .url }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .url "page" $page "param" "image" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "_relearn/makeRandomMd5.gotmpl" $page) .id }}
|
||||
{{- $attributes = merge $attributes (partial "_relearn/imageAttributes.gotmpl" (dict "url" $src "page" $page "linkObject" $linkObject)) }}
|
||||
{{- $attributes = merge $attributes (dict "alt" $alt "title" ($title | transform.HTMLEscape)) }}
|
||||
{{- $classes := split $attributes.class " " }}
|
||||
{{- $isLightbox := in $classes "lightbox" }}
|
||||
{{- if $isLightbox -}}
|
||||
<a href="#R-image-{{ $id }}" class="lightbox-link">
|
||||
{{- end }}
|
||||
{{- $attributes_figure := $attributes }}
|
||||
{{- $attributes_figure = merge $attributes_figure (dict "class" (delimit ((split $attributes_figure.class " ") | append "figure-image") " ")) }}
|
||||
{{- $attributes_figure = merge $attributes_figure (dict "style" (index $attributes_figure "style")) -}}
|
||||
{{- partial "partials/inline/img" (dict "attributes" $attributes_figure) }}
|
||||
{{- if $isLightbox -}}
|
||||
</a>
|
||||
<a href="javascript:history.back();" class="lightbox-back" id="R-image-{{ $id }}">
|
||||
{{- $attributes_lightbox := $attributes }}
|
||||
{{- $attributes_lightbox = merge $attributes_lightbox (dict "class" (delimit ((split $attributes_lightbox.class " ") | append "lightbox-image") " ")) }}
|
||||
{{- $attributes_lightbox = merge $attributes_lightbox (dict "style" "") -}}
|
||||
{{- partial "partials/inline/img" (dict "attributes" $attributes_lightbox) }}</a>
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/img" }}
|
||||
{{- if .attributes.content }}
|
||||
{{- $attrs := ""}}
|
||||
{{- range $k, $v := .attributes }}
|
||||
{{- if eq $k "content" }}
|
||||
{{- else if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- $attrs = printf "%s %s" $attrs $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- $attrs = printf "%s %s=%q" $attrs $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- printf (.attributes.content | replaceRE "^<svg" (printf "<svg%s" $attrs)) | safeHTML }}
|
||||
{{- else -}}
|
||||
<img
|
||||
{{- range $k, $v := .attributes }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- printf " %s" $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,34 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'include' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $content := "" }}
|
||||
{{- $linkObject := or
|
||||
(partial "_relearn/linkObject.gotmpl" (dict "url" .file "page" $page "searchGlobal" false "searchResource" false))
|
||||
(partial "_relearn/linkObject.gotmpl" (dict "url" .file "page" $page "searchPage" false)) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $content = $linkObject.Content }}
|
||||
{{- else }}
|
||||
{{- if (fileExists .file) }}
|
||||
{{- $content = .file | readFile }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: include '%s' is not a page, a resource or a file" $filepath .file }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .file "page" $page "param" "include" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $hideFirstHeading := .hidefirstheading | default false }}
|
||||
{{- if eq (printf "%T" $hideFirstHeading) "string" }}
|
||||
{{- $hideFirstHeading = (eq $hideFirstHeading "true") }}
|
||||
{{- end }}
|
||||
{{- if $content }}
|
||||
{{- if $hideFirstHeading }}<div class="include hide-first-heading">
|
||||
|
||||
{{ end }}
|
||||
{{- with $page }}
|
||||
{{- $content | safeHTML }}
|
||||
{{- end }}
|
||||
{{- if $hideFirstHeading }}</div>{{ end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,44 @@
|
||||
{{- /* based on Hugo 0.125.5 render-link.html */}}
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'link' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- if strings.HasPrefix .url "HAHAHUGOSHORTCODE" }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: WARNING you must call the ref / relref shortcode with '%% %%' instead of '< >' to work correctly for the anchor target attribute" $filepath }}
|
||||
{{- end }}
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $title := .title | default "" }}
|
||||
{{- $title = trim $title " " }}
|
||||
{{- $attributes = merge $attributes (dict "title" ($title | transform.HTMLEscape)) }}
|
||||
{{- $content := .content }}
|
||||
{{- /* target will be boolean false if no user defined value was set and effect default should be applied */}}
|
||||
{{- $target := false }}
|
||||
{{- $linkObject := "" }}
|
||||
{{- $u := urls.Parse .url }}
|
||||
{{- $href := $u.String }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" .url "page" $page "type" "link") $u.String }}
|
||||
{{- else }}
|
||||
{{- $linkObject = partial "_relearn/linkObject.gotmpl" (dict "url" .url "page" $page) }}
|
||||
{{- if $linkObject }}
|
||||
{{- $href = partial "_relearn/decoratedLink.gotmpl" (dict "url" .url "page" $page "linkObject" $linkObject "param" "link") }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: link '%s' is not a page or a resource" $filepath .url }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .url "page" $page "param" "link" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $attributes = merge $attributes (partial "_relearn/linkAttributes.gotmpl" (dict "url" $href "page" $page "linkObject" $linkObject "target" .target)) -}}
|
||||
<a
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- if eq (printf "%T" $v) "bool" }}
|
||||
{{- printf " %s" $k | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}>{{ $content | safeHTML }}</a>
|
||||
@@ -0,0 +1,33 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'math' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $content := .content }}
|
||||
{{- $align := .align | default "center" }}
|
||||
|
||||
{{- /* separate shortcode attributes from rest */}}
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $otherAttributes := dict }}
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if eq $k "align" }}
|
||||
{{- else }}
|
||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $attributes = $otherAttributes }}
|
||||
|
||||
{{- /* enrich attributes */}}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) "math" slice) " ")) }}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) (printf "align-%s" $align) slice) " ")) }}
|
||||
|
||||
{{- with $page -}}
|
||||
<span
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}>{{ $content | safeHTML }}</span>
|
||||
{{- .Store.Set "hasMath" true }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,48 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'mermaid' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $content := .content }}
|
||||
{{- $align := .align | default "center" }}
|
||||
{{- $zoom := $page.Site.Params.mermaidZoom | default false }}
|
||||
{{- with $page.Params.mermaidZoom }}
|
||||
{{- $zoom = . }}
|
||||
{{- if eq (printf "%T" .) "string" }}
|
||||
{{- $zoom = (eq . "true") }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .zoom }}
|
||||
{{- $zoom = . }}
|
||||
{{- if eq (printf "%T" .) "string" }}
|
||||
{{- $zoom = (eq . "true") }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* separate shortcode attributes from rest */}}
|
||||
{{- $attributes := .attributes | default dict }}
|
||||
{{- $otherAttributes := dict }}
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if eq $k "align" }}
|
||||
{{- else if eq $k "zoom" }}
|
||||
{{- else }}
|
||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $attributes = $otherAttributes }}
|
||||
|
||||
{{- /* enrich attributes */}}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) "mermaid" slice) " ")) }}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) (printf "align-%s" $align) slice) " ")) }}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) (printf "%s" (cond $zoom "zoomable" "")) slice) " ")) }}
|
||||
|
||||
{{- with $page -}}
|
||||
<pre
|
||||
{{- range $k, $v := $attributes }}
|
||||
{{- if $v }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}>{{ $content | htmlEscape | safeHTML }}</pre>
|
||||
{{- .Store.Set "hasMermaid" true }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,78 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'notice' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $class := .class | default "notices" }}
|
||||
{{- $containerstyle := .containerstyle | default "div" }}
|
||||
{{- $containerclass := .containerclass | default slice | append "box-content" }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $content := trim .content "\n\r\t " }}
|
||||
{{- $hasContent := ne (strings.TrimPrefix "<p>" $content) "" }}
|
||||
{{- if not (hasPrefix $content "<") }}
|
||||
{{- $content = printf "<p>\n%s" $content }}
|
||||
{{- end }}
|
||||
{{- $groupid := .groupid }}
|
||||
{{- $style := .style | default "default" }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon) " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- $expander := false }}
|
||||
{{- $expanded := .expanded | default "" }}
|
||||
{{- if $hasContent }}
|
||||
{{- if eq (printf "%T" $expanded) "string" }}
|
||||
{{- if ne (trim $expanded " ") "" }}
|
||||
{{- $expander = true }}
|
||||
{{- $expanded = (eq $expanded "true") }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $expander = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $params := .params | default dict }}
|
||||
{{- $classes := split (index $params "class" | default "") " " }}
|
||||
{{- $classes = $classes | append "box" }}
|
||||
{{- $classes = $classes | append "cstyle" }}
|
||||
{{- $classes = $classes | append $class }}
|
||||
{{- $classes = $classes | append $style }}
|
||||
{{- if $expander }}
|
||||
{{- $classes = $classes | append "expand" }}
|
||||
{{- else }}
|
||||
{{- $expanded = true }}
|
||||
{{- end }}
|
||||
{{- $params = dict "class" (delimit $classes " ") | merge $params }}
|
||||
{{- if $color }}
|
||||
{{- $styles := split (index $params "style" | default "") ";" }}
|
||||
{{- $styles = $styles | append (printf "--VARIABLE-BOX-color: %s" $color) }}
|
||||
{{- $params = dict "style" (delimit $styles ";") | merge $params }}
|
||||
{{- end }}
|
||||
{{ if $groupid }}
|
||||
{{- $params = dict "name" $groupid | merge $params }}
|
||||
{{- end }}
|
||||
{{- with $page }}
|
||||
{{- if or $icon $title $hasContent -}}
|
||||
<details
|
||||
{{- if $expanded }} open{{ end }}
|
||||
{{- range $k, $v := $params }}
|
||||
{{- if not (or (in (slice "open" "summary") $k) (strings.HasPrefix $k "on")) }}
|
||||
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
<summary class="box-label{{ if and (not $expander) (not $icon) (not $title) }} a11y-only{{ end }}"{{ if not $expander }} tabindex="-1"{{ end }}>{{ if $expander }}
|
||||
<i class="expander-icon fa-fw fas fa-chevron-right"></i> {{ end }}{{ if $icon }}
|
||||
<i class="{{ $icon }}"></i> {{ end }}{{ if $title }}
|
||||
{{ $title | .RenderString }}{{ else }}
|
||||
<span class="a11y-only">{{ T "Details" }}</span>{{ end }}
|
||||
</summary>
|
||||
{{- if $hasContent }}
|
||||
{{ printf " <%s class=\"%s\">" $containerstyle (delimit $containerclass " ") | safeHTML }}
|
||||
{{ $content | safeHTML }}
|
||||
{{ printf " </%s>" $containerstyle | safeHTML }}
|
||||
{{- end }}
|
||||
</details>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,37 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'openapi' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $u := urls.Parse .src }}
|
||||
{{- $src := $u.String }}
|
||||
{{- $spec := "" }}
|
||||
{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "_relearn/makeRandomMd5.gotmpl" $page) .id }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- partialCached "_relearn/urlExists.gotmpl" (dict "url" .src "page" $page "type" "OpenAPI spec link") $u.String }}
|
||||
{{- else }}
|
||||
{{- $path := strings.TrimPrefix "./" $u.Path }}
|
||||
{{- with or
|
||||
($page.Resources.Get $path)
|
||||
(resources.Get $path)
|
||||
}}
|
||||
{{- $src = "" }}
|
||||
{{- $spec = .Content }}
|
||||
{{- else }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- $msg := printf "%q: OpenAPI spec '%s' is not a resource" $filepath .src }}
|
||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .src "page" $page "param" "openapi" "msg" $msg) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $page -}}
|
||||
<div class="sc-openapi-wrapper is-loading helper-loading-container">
|
||||
<div
|
||||
class="sc-openapi-container"
|
||||
id="R-openapi-{{ $id }}"
|
||||
data-openapi-url="{{ $src }}"
|
||||
data-openapi-spec="{{ $spec | safeHTMLAttr }}"
|
||||
></div>
|
||||
</div>
|
||||
{{- .Store.Set "hasOpenApi" true }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,69 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'resources' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $color := .color | default "" }}
|
||||
{{- $style := .style | default "default" }}
|
||||
{{- if and (not $color) (eq (len $color) 0) }}
|
||||
{{- $style = .style | default "transparent" }}
|
||||
{{- end }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title | default ("Attachments-label" | T)) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon | default "paperclip") " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- $expanded := .expanded | default "" }}
|
||||
{{- if eq (printf "%T" $expanded) "string" }}
|
||||
{{- if ne (trim $expanded " ") "" }}
|
||||
{{- $expanded = (eq $expanded "true") }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $sort := .sort | default "asc" }}
|
||||
{{- $pattern := .pattern | default "" }}
|
||||
{{- if eq $page.BundleType "" }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: UNSUPPORTED usage of 'resources' shortcode found, use a page bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/resources" $filepath }}
|
||||
{{- end }}
|
||||
{{- $content := partial "inline/resource-list" (dict
|
||||
"page" $page
|
||||
"sort" $sort
|
||||
"pattern" $pattern
|
||||
) }}
|
||||
{{- partial "shortcodes/notice.html" (dict
|
||||
"page" $page
|
||||
"class" "attachments"
|
||||
"containerstyle" "ul"
|
||||
"containerclass" (slice "attachments-files")
|
||||
"color" $color
|
||||
"content" $content
|
||||
"expanded" $expanded
|
||||
"icon" $icon
|
||||
"style" $style
|
||||
"title" $title
|
||||
) }}
|
||||
|
||||
{{- define "partials/inline/resource-list" }}
|
||||
{{- $sort := .sort }}
|
||||
{{- $pattern := .pattern }}
|
||||
{{- with .page }}
|
||||
{{- range sort .Resources "Name" $sort }}
|
||||
{{- if findRE $pattern .Name }}
|
||||
{{- $size := len .Content }}
|
||||
{{- $unit := "Byte-symbol" }}
|
||||
{{- if ge $size 1024 }}
|
||||
{{- $size = div $size 1024 }}
|
||||
{{- $unit = "Kilobyte-symbol" }}
|
||||
{{- end }}
|
||||
{{- if ge $size 1024 }}
|
||||
{{- $size = div $size 1024 }}
|
||||
{{- $unit = "Megabyte-symbol" }}
|
||||
{{- end }}
|
||||
{{- $unitsymbol := $unit | T }}
|
||||
<li><a href="{{ .RelPermalink }}">{{.Name}}</a> ({{$size}} {{$unitsymbol}})</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'siteparam' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $paramNames := split .name "." }}
|
||||
{{- with $page }}
|
||||
{{- $params := .Site.Params }}
|
||||
{{- range $paramName := $paramNames }}
|
||||
{{- with $params }}
|
||||
{{- $params = index . (lower $paramName) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $params }}
|
||||
{{- . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'tab' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $tabs := (slice | append (dict
|
||||
"color" .color
|
||||
"content" .content
|
||||
"icon" .icon
|
||||
"name" .name
|
||||
"style" .style
|
||||
"title" .title
|
||||
)) }}
|
||||
{{- partial "shortcodes/tabs.html" (dict
|
||||
"page" $page
|
||||
"color" ""
|
||||
"content" $tabs
|
||||
"groupid" ""
|
||||
"icon" ""
|
||||
"style" ""
|
||||
"title" ""
|
||||
) }}
|
||||
@@ -0,0 +1,81 @@
|
||||
{{- $page := .page }}
|
||||
{{- if and (not $page) .context }}
|
||||
{{- $page = .context }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'tabs' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
||||
{{- end }}
|
||||
{{- $groupid := .groupid | default (partial "_relearn/makeRandomMd5.gotmpl" $page) | plainify | anchorize }}
|
||||
{{- $color := .color }}
|
||||
{{- $style := .style }}
|
||||
{{- $title := .title }}
|
||||
{{- $icon := .icon }}
|
||||
{{- $tabs := slice }}
|
||||
{{- range $tab := (.content | default slice) }}
|
||||
{{- if and (not $tab.title) $tab.name }}
|
||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||
{{- warnf "%q: DEPRECATED parameter 'name' for shortcode 'tab' found, use 'title' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-16-0" $filepath }}
|
||||
{{- $tab = merge $tab (dict "title" .name) }}
|
||||
{{- end }}
|
||||
{{- with $tab }}
|
||||
{{- $color := .color | default $color | default "" }}
|
||||
{{- $content := trim .content "\n\r\t " }}
|
||||
{{- $hasContent := ne (strings.TrimPrefix "<p>" $content) "" }}
|
||||
{{- if not (hasPrefix $content "<") }}
|
||||
{{- $content = printf "<p>\n%s" $content }}
|
||||
{{- end }}
|
||||
{{- $style := .style | default $style | default (cond (ne $color "") "filled" "initial") }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon) " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- if $hasContent }}
|
||||
{{- $tabs = $tabs | append (dict
|
||||
"color" $color
|
||||
"content" $content
|
||||
"icon" $icon
|
||||
"itemid" (printf "%s%s" ($title | $page.RenderString | plainify | anchorize) ($icon | plainify | anchorize))
|
||||
"style" $style
|
||||
"title" $title
|
||||
) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $color = .color | default "" }}
|
||||
{{- $style = .style | default (cond (ne $color "") "filled" "initial") }}
|
||||
{{- $boxStyle := partial "_relearn/boxStyle.gotmpl" (dict "style" $style "title" .title "icon" .icon) }}
|
||||
{{- $title := trim ($boxStyle.title) " " }}
|
||||
{{- $icon := trim ($boxStyle.icon) " " }}
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
{{- with $page }}
|
||||
{{- if len $tabs -}}
|
||||
<div class="tab-panel" data-tab-group="{{ $groupid }}">
|
||||
<div class="tab-nav">
|
||||
<div class="tab-nav-title">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | $page.RenderString }}{{ if (not $title) }}​{{ end }}</div>
|
||||
{{- range $idx, $tab := $tabs }}
|
||||
<button
|
||||
data-tab-item="{{ .itemid }}"
|
||||
class="tab-nav-button tab-panel-style cstyle {{ .style }}{{ cond (eq $idx 0) " active" ""}}"{{ if .color }} style="--VARIABLE-BOX-color: {{ .color }};"{{ end }}{{ if eq $idx 0 }} tabindex="-1"{{ end }}
|
||||
onclick="switchTab('{{ $groupid }}','{{ .itemid }}')"
|
||||
>
|
||||
<span class="tab-nav-text">{{ if .icon }}<i class="{{ .icon }}"></i>{{ end }}{{ if and .icon .title }} {{ end }}{{ .title | $page.RenderString }}{{ if (not .title) }}​{{ end }}</span>
|
||||
</button>
|
||||
{{- end }}
|
||||
</div>
|
||||
<div class="tab-content-container">
|
||||
{{- range $idx, $tab := $tabs }}
|
||||
<div
|
||||
data-tab-item="{{ .itemid }}"
|
||||
class="tab-content tab-panel-style cstyle {{ .style }}{{ cond (eq $idx 0) " active" ""}}"{{ if .color }} style="--VARIABLE-BOX-color: {{ .color }};"{{ end }}>
|
||||
<div class="tab-content-text">
|
||||
{{ .content | safeHTML }}
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,26 @@
|
||||
{{- $taxonomy := .taxonomy }}
|
||||
{{- if eq "string" (printf "%T" $taxonomy) }}
|
||||
{{- $taxonomy = .page.GetPage $taxonomy }}
|
||||
{{- end }}
|
||||
{{- $headingstyle := .headingstyle | default "h2" }}
|
||||
{{- with $taxonomy }}
|
||||
{{- .Content }}
|
||||
{{- $lastCapital := "" }}
|
||||
{{- $pages := partialCached "partials/_relearn/pagesTaxonomy.gotmpl" . .Path }}
|
||||
{{- range $pages }}
|
||||
{{- $capital := substr .Title 0 1 | upper }}
|
||||
{{- if ne $lastCapital $capital }}
|
||||
{{- if ne $lastCapital "" }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{ (printf `<%s id="%s">%s</%s>` $headingstyle ($capital | plainify | anchorize) $capital $headingstyle) | safeHTML }}
|
||||
<ul class="columnize">
|
||||
{{- end }}
|
||||
{{- /* display terms of a taxonomy */}}
|
||||
<li><a href="{{ partial "permalink.gotmpl" (dict "to" .Page) }}">{{ .Title }}</a> ({{ .Count }})</li>
|
||||
{{- $lastCapital = $capital }}
|
||||
{{- end }}
|
||||
{{- if ne $lastCapital "" }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,30 @@
|
||||
{{- $term := .term }}
|
||||
{{- if eq "string" (printf "%T" $term) }}
|
||||
{{- $term = .page.GetPage $term }}
|
||||
{{- end }}
|
||||
{{- $headingstyle := .headingstyle | default "h2" }}
|
||||
{{- with $term }}
|
||||
{{- .Content }}
|
||||
{{- $lastCapital := "" }}
|
||||
{{- $pages := partialCached "partials/_relearn/pagesTerm.gotmpl" . .Path }}
|
||||
{{- range $pages }}
|
||||
{{- $capital := substr .Title 0 1 | upper }}
|
||||
{{- if ne $lastCapital $capital }}
|
||||
{{- if ne $lastCapital "" }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{ (printf `<%s id="%s">%s</%s>` $headingstyle ($capital | plainify | anchorize) $capital $headingstyle) | safeHTML }}
|
||||
<ul class="columnize">
|
||||
{{- end }}
|
||||
{{- /* display pages of a term */}}
|
||||
{{- $breadcrumb := "" }}
|
||||
{{- if (ne .Page.Site.Params.disableTermBreadcrumbs true) }}
|
||||
{{- $breadcrumb = trim (partial "breadcrumbs.html" (dict "page" .Page "dirOnly" true) | plainify | htmlUnescape) "\n\r\t " }}
|
||||
{{- end }}
|
||||
<li><a href="{{ partial "permalink.gotmpl" (dict "to" .Page) }}">{{ .Title }}</a>{{ with $breadcrumb }}<div class="breadcrumbs highlightable" title="{{ . }}">{{ . }}</div>{{ end }}</li>
|
||||
{{- $lastCapital = $capital }}
|
||||
{{- end }}
|
||||
{{- if ne $lastCapital "" }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user