shortcodes: fix whitespace issues #907

This commit is contained in:
Sören Weber 2024-09-05 20:02:38 +02:00
parent 50165ddc93
commit 33f9cb6e78
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
15 changed files with 95 additions and 97 deletions

View file

@ -15,8 +15,7 @@
"title" $alerttitle "title" $alerttitle
"expanded" (cond (eq $alertsign "+") true (cond (eq $alertsign "-") false "")) "expanded" (cond (eq $alertsign "+") true (cond (eq $alertsign "-") false ""))
) }} ) }}
{{- else }} {{ else -}}
<blockquote> <blockquote>
{{- $text | safeHTML }} {{ $text | safeHTML }}</blockquote>
</blockquote> {{ end }}
{{- end }}

View file

@ -5,7 +5,6 @@
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'attachments' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }} {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'attachments' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }}
{{- end }} {{- end }}
{{- $color := .color | default "" }} {{- $color := .color | default "" }}
{{- $content := .content }}
{{- $style := .style | default "default" }} {{- $style := .style | default "default" }}
{{- if and (not $color) (eq (len $color) 0) }} {{- if and (not $color) (eq (len $color) 0) }}
{{- $style = .style | default "transparent" }} {{- $style = .style | default "transparent" }}
@ -46,7 +45,7 @@
{{- with $page }} {{- with $page }}
{{- if ne .BundleType "leaf" }} {{- 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" $page.File.Filename }} {{- 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.Filename }}
{{- end }} {{- end -}}
<div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ 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> <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"> <ul class="box-content attachments-files">
@ -82,6 +81,5 @@
{{- end }} {{- end }}
{{- end }} {{- end }}
</ul> </ul>
{{- $content }}
</div> </div>
{{- end }} {{- end }}

View file

@ -5,80 +5,63 @@
{{- end }} {{- end }}
{{- $showhidden := .showhidden | default false }} {{- $showhidden := .showhidden | default false }}
{{- if eq (printf "%T" $showhidden) "string" }} {{- if eq (printf "%T" $showhidden) "string" }}
{{- $showhidden = (eq $showhidden "true") }} {{- $showhidden = (eq $showhidden "true") }}
{{- end }} {{- end }}
{{- $style := .style | default "li" }} {{- $style := .style | default "li" }}
{{- $depth := .depth | default 1 }} {{- $depth := .depth | default 1 }}
{{- $withDescription := .description | default false }} {{- $withDescription := .description | default false }}
{{- if eq (printf "%T" $withDescription) "string" }} {{- if eq (printf "%T" $withDescription) "string" }}
{{- $withDescription = (eq $withDescription "true") }} {{- $withDescription = (eq $withDescription "true") }}
{{- end }} {{- end }}
{{- $sortTerm := .sort | lower }} {{- $sortTerm := .sort | lower }}
{{- $containerstyle := .containerstyle | default "ul" }} {{- $containerstyle := .containerstyle | default "ul" }}
{{- if( and (not (eq $style "li") ) (eq $containerstyle "ul" ) ) }} {{- if( and (not (eq $style "li") ) (eq $containerstyle "ul" ) ) }}
{{- $containerstyle = "div" }} {{- $containerstyle = "div" }}
{{- end }} {{- end }}
{{- with $page }} {{- with $page -}}
{{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }} {{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "by" $sortTerm) }} {{- $pages := partial "pageHelper/pagesBy.html" (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" . }} {{- 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 }} {{ (printf "</%s>" $containerstyle)|safeHTML }}
{{- end }} {{- end }}
{{- define "childs" }} {{- define "childs" }}
{{ $page := .page }} {{- $page := .page }}
{{- range .menu }} {{- range .menu }}
{{- $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }} {{- $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
{{- if not $hidden }} {{- if not $hidden }}
{{- if not .IsHome }} {{- if not .IsHome }}
{{- if hasPrefix $.style "h" }} {{- if hasPrefix $.style "h" }}
{{- $num := sub ( int (trim $.style "h") ) 1 }} {{- $num := sub ( int (trim $.style "h") ) 1 }}
{{- $numn := add $num $.count }} {{- $numn := add $num $.count }}
{{ (printf "<h%d>" $numn)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}{{ (printf "</h%d>" $numn)|safeHTML }} {{ (printf " <h%d>" $numn)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}{{ (printf "</h%d>" $numn)|safeHTML }}
{{- if $.description }} {{- else if eq $.style "li" }}
{{- with or .Description .Summary -}} {{ (printf " <%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}
{{- else }}
{{ (printf " <%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}{{ (printf "</%s>" $.style)|safeHTML }}
{{- end }}
{{- if $.description }}
{{- with or .Description .Summary -}}
<p>{{ . }}</p> <p>{{ . }}</p>
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}
{{- else if eq $.style "li" }} {{- if lt $.count $.depth }}
{{ (printf "<%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }} {{- if eq $.style "li" }}
{{- if $.description }}
{{- with or .Description .Summary -}}
<p>{{ . }}</p>
{{- end }}
{{- end }}
{{- else }}
{{ (printf "<%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}{{ (printf "</%s>" $.style)|safeHTML }}
{{- if $.description }}
{{- with or .Description .Summary -}}
<p>{{ . }}</p>
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if lt $.count $.depth }}
{{- if eq $.style "li" }}
{{- (printf "<%s>" $.containerstyle)|safeHTML }} {{- (printf "<%s>" $.containerstyle)|safeHTML }}
{{- end }} {{- end }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "by" $.sortTerm) }}
{{- $pages := partial "pageHelper/pagesBy.html" (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 }}
{{- 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" }}
{{- if eq $.style "li" }}
{{- (printf "</%s>" $.containerstyle)|safeHTML }} {{- (printf "</%s>" $.containerstyle)|safeHTML }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if not .IsHome }}
{{- if not .IsHome }} {{- if eq $.style "li" }}
{{- if eq $.style "li" }}
{{- (printf "</%s>" $.style)|safeHTML -}} {{- (printf "</%s>" $.style)|safeHTML -}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -3,7 +3,11 @@
{{- $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" $page.File.Filename }} {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'expand' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }}
{{- end }} {{- end }}
{{- $content := .content }} {{- $content := trim .content "\n\r\t " }}
{{- $hasContent := ne (strings.TrimLeft "<p>" $content) "" }}
{{- if not (hasPrefix $content "<") }}
{{- $content = printf "<p>\n%s" $content }}
{{- end }}
{{- $title := .title | default (T "Expand-title") }} {{- $title := .title | default (T "Expand-title") }}
{{- $title = trim $title " " }} {{- $title = trim $title " " }}
{{- $expanded := .expanded | default false }} {{- $expanded := .expanded | default false }}
@ -16,14 +20,16 @@
{{- end }} {{- end }}
{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }} {{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }}
{{- with $page }} {{- with $page }}
{{- if $hasContent -}}
<div class="expand"> <div class="expand">
<input type="checkbox" id="R-expand-{{ $id }}" aria-controls="R-expandcontent-{{ $id }}" {{ if $expanded }} checked{{ end }}> <input type="checkbox" id="R-expand-{{ $id }}" aria-controls="R-expandcontent-{{ $id }}"{{ if $expanded }} checked{{ end }}>
<label class="expand-label" for="R-expand-{{ $id }}"> <label class="expand-label" for="R-expand-{{ $id }}">
<i class="expander-icon fa-fw fas fa-chevron-down"></i> <i class="expander-icon fa-fw fas fa-chevron-down"></i>
<i class="expander-icon fa-fw fas fa-chevron-right"></i> {{ $title | .RenderString }} <i class="expander-icon fa-fw fas fa-chevron-right"></i> {{ $title | .RenderString }}
</label> </label>
<div id="R-expandcontent-{{ $id }}" class="expand-content"> <div id="R-expandcontent-{{ $id }}" class="expand-content">
{{ if ne "<" (substr (strings.TrimLeft "\n\r\t " $content) 0 1) }}<p>{{ end }}<!-- we add a DOM element here if there is none to make collapsing marings work --> {{ $content | safeHTML }}
{{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? --> </div>
</div> </div>
{{- end }}
{{- end }} {{- end }}

View file

@ -106,4 +106,6 @@
)}} )}}
{{- else }} {{- else }}
{{- $content | safeHTML }} {{- $content | safeHTML }}
{{- if and (not $hl_inline) (not (hasSuffix $content "\n")) }}
{{ end }}
{{- end }} {{- end }}

View file

@ -21,7 +21,7 @@
{{- $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) "math" 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 "align-%s" $align) slice) " ")) }}
{{- with $page }} {{- with $page -}}
<span <span
{{- range $k, $v := $attributes }} {{- range $k, $v := $attributes }}
{{- if $v }} {{- if $v }}

View file

@ -36,7 +36,7 @@
{{- $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 "align-%s" $align) slice) " ")) }}
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) (printf "%s" (cond $zoom "zoomable" "")) slice) " ")) }} {{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) (printf "%s" (cond $zoom "zoomable" "")) slice) " ")) }}
{{- with $page }} {{- with $page -}}
<pre <pre
{{- range $k, $v := $attributes }} {{- range $k, $v := $attributes }}
{{- if $v }} {{- if $v }}

View file

@ -4,8 +4,11 @@
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'notice' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }} {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'notice' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }}
{{- end }} {{- end }}
{{- $color := .color | default "" }} {{- $color := .color | default "" }}
{{- $content := .content }} {{- $content := trim .content "\n\r\t " }}
{{- $hasContent := ne (strings.TrimLeft "<p>" (trim $content "\n\r\t ")) "" }} {{- $hasContent := ne (strings.TrimLeft "<p>" $content) "" }}
{{- if not (hasPrefix $content "<") }}
{{- $content = printf "<p>\n%s" $content }}
{{- end }}
{{- $style := .style | default "default" }} {{- $style := .style | default "default" }}
{{- $title := .title }} {{- $title := .title }}
{{- if not $title }} {{- if not $title }}
@ -44,10 +47,10 @@
{{- end }} {{- end }}
{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }} {{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }}
{{- with $page }} {{- with $page }}
{{- if or $icon $title $hasContent }} {{- if or $icon $title $hasContent -}}
<div class="{{ if $expander }}expand {{ end }}box notices cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}> <div class="{{ if $expander }}expand {{ end }}box notices cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
{{- if $expander }} {{- if $expander }}
<input type="checkbox" id="R-expand-{{ $id }}" aria-controls="R-expandcontent-{{ $id }}" {{ if $expanded }} checked{{ end }}> <input type="checkbox" id="R-expand-{{ $id }}" aria-controls="R-expandcontent-{{ $id }}"{{ if $expanded }} checked{{ end }}>
<label class="expand-label box-label" for="R-expand-{{ $id }}"> <label class="expand-label box-label" for="R-expand-{{ $id }}">
<i class="expander-icon fa-fw fas fa-chevron-down"></i> <i class="expander-icon fa-fw fas fa-chevron-down"></i>
<i class="expander-icon fa-fw fas fa-chevron-right"></i> {{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }} <i class="expander-icon fa-fw fas fa-chevron-right"></i> {{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}
@ -60,8 +63,8 @@
{{- end }} {{- end }}
{{- if $hasContent }} {{- if $hasContent }}
<div{{ if $expander }} id="R-expandcontent-{{ $id }}"{{ end }} class="{{ if $expander }}expand-content {{ end }}box-content"> <div{{ if $expander }} id="R-expandcontent-{{ $id }}"{{ end }} class="{{ if $expander }}expand-content {{ end }}box-content">
{{ if ne "<" (substr (strings.TrimLeft "\n\r\t " $content) 0 1) }}<p>{{ end }}<!-- we add a DOM element here if there is none to make collapsing marings work --> {{ $content | safeHTML }}
{{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? --> </div>
{{- end }} {{- end }}
</div> </div>
{{- end }} {{- end }}

View file

@ -24,7 +24,7 @@
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- with $page }} {{- with $page -}}
<div class="sc-openapi-wrapper is-loading helper-loading-container"> <div class="sc-openapi-wrapper is-loading helper-loading-container">
<div <div
class="sc-openapi-container" class="sc-openapi-container"

View file

@ -4,7 +4,6 @@
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'resources' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }} {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'resources' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }}
{{- end }} {{- end }}
{{- $color := .color | default "" }} {{- $color := .color | default "" }}
{{- $content := .content }}
{{- $style := .style | default "default" }} {{- $style := .style | default "default" }}
{{- if and (not $color) (eq (len $color) 0) }} {{- if and (not $color) (eq (len $color) 0) }}
{{- $style = .style | default "transparent" }} {{- $style = .style | default "transparent" }}
@ -38,7 +37,7 @@
{{- with $page }} {{- with $page }}
{{- if eq .BundleType "" }} {{- if eq .BundleType "" }}
{{- warnf "%q: UNSUPPORTED usage of 'resources' shortcode found, use a page bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/resources" $page.File.Filename }} {{- warnf "%q: UNSUPPORTED usage of 'resources' shortcode found, use a page bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/resources" $page.File.Filename }}
{{- end }} {{- end -}}
<div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ 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> <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"> <ul class="box-content attachments-files">
@ -59,6 +58,5 @@
{{- end }} {{- end }}
{{- end }} {{- end }}
</ul> </ul>
{{- $content }}
</div> </div>
{{- end }} {{- end }}

View file

@ -16,6 +16,11 @@
{{- end }} {{- end }}
{{- with $tab }} {{- with $tab }}
{{- $color := .color | default $color | default "" }} {{- $color := .color | default $color | default "" }}
{{- $content := trim .content "\n\r\t " }}
{{- $hasContent := ne (strings.TrimLeft "<p>" $content) "" }}
{{- if not (hasPrefix $content "<") }}
{{- $content = printf "<p>\n%s" $content }}
{{- end }}
{{- $style := .style | default $style | default (cond (ne $color "") "filled" "initial") }} {{- $style := .style | default $style | default (cond (ne $color "") "filled" "initial") }}
{{- $title := .title }} {{- $title := .title }}
{{- if not $title }} {{- if not $title }}
@ -40,14 +45,16 @@
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }} {{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
{{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- $icon = printf "fa-fw fas fa-%s" $icon }}
{{- end }} {{- end }}
{{- $tabs = $tabs | append (dict {{- if $hasContent }}
"color" $color {{- $tabs = $tabs | append (dict
"content" .content "color" $color
"icon" $icon "content" $content
"itemid" (printf "%s%s" ($title | $page.RenderString | plainify | anchorize) ($icon | plainify | anchorize)) "icon" $icon
"style" $style "itemid" (printf "%s%s" ($title | $page.RenderString | plainify | anchorize) ($icon | plainify | anchorize))
"title" $title "style" $style
) }} "title" $title
) }}
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- $color = .color | default "" }} {{- $color = .color | default "" }}
@ -76,10 +83,11 @@
{{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- $icon = printf "fa-fw fas fa-%s" $icon }}
{{- end }} {{- end }}
{{- with $page }} {{- with $page }}
{{- if len $tabs -}}
<div class="tab-panel" data-tab-group="{{ $groupid }}"> <div class="tab-panel" data-tab-group="{{ $groupid }}">
<div class="tab-nav"> <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) }}&#8203;{{ 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) }}&#8203;{{ end }}</div>
{{- range $idx, $tab := $tabs }} {{- range $idx, $tab := $tabs }}
<button <button
data-tab-item="{{ .itemid }}" 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 }} 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 }}
@ -87,18 +95,19 @@
> >
<span class="tab-nav-text">{{ if .icon }}<i class="{{ .icon }}"></i>{{ end }}{{ if and .icon .title }} {{ end }}{{ .title | $page.RenderString }}{{ if (not .title) }}&#8203;{{ end }}</span> <span class="tab-nav-text">{{ if .icon }}<i class="{{ .icon }}"></i>{{ end }}{{ if and .icon .title }} {{ end }}{{ .title | $page.RenderString }}{{ if (not .title) }}&#8203;{{ end }}</span>
</button> </button>
{{- end }} {{- end }}
</div> </div>
<div class="tab-content-container"> <div class="tab-content-container">
{{- range $idx, $tab := $tabs }} {{- range $idx, $tab := $tabs }}
<div <div
data-tab-item="{{ .itemid }}" 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 }}> 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"> <div class="tab-content-text">
{{ if ne "<" (substr (strings.TrimLeft "\n\r\t " .content) 0 1) }}<p>{{ end }}<!-- we add a DOM element here if there is none to make collapsing marings work --> {{ .content | safeHTML }}
{{ .content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? --> </div>
</div> </div>
{{- end }} {{- end }}
</div> </div>
</div> </div>
{{- end }}
{{- end }} {{- end }}

View file

@ -1,8 +1,8 @@
{{- $_hugo_config := `{ "version": 1 }` }} {{- $_hugo_config := `{ "version": 1 }` }}
{{- $unused := .Inner }}
{{- partial "shortcodes/attachments.html" (dict {{- partial "shortcodes/attachments.html" (dict
"page" .Page "page" .Page
"color" (.Get "color") "color" (.Get "color")
"content" .Inner
"icon" (.Get "icon") "icon" (.Get "icon")
"pattern" (.Get "pattern") "pattern" (.Get "pattern")
"style" (.Get "style") "style" (.Get "style")

View file

@ -1,8 +1,8 @@
{{- $_hugo_config := `{ "version": 1 }` }} {{- $_hugo_config := `{ "version": 1 }` }}
{{- $unused := .Inner }}
{{- partial "shortcodes/resources.html" (dict {{- partial "shortcodes/resources.html" (dict
"page" .Page "page" .Page
"color" (.Get "color") "color" (.Get "color")
"content" .Inner
"icon" (.Get "icon") "icon" (.Get "icon")
"pattern" (.Get "pattern") "pattern" (.Get "pattern")
"style" (.Get "style") "style" (.Get "style")