theme: wildspace

in shortcodes and shortcode output
This commit is contained in:
Sören Weber 2021-09-12 09:44:34 +02:00
parent a62c1ee500
commit fe7eb1d432
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
9 changed files with 153 additions and 153 deletions

View file

@ -5,33 +5,32 @@
<section class="attachments {{ $style }}"> <section class="attachments {{ $style }}">
<div class="label">{{ $title }}</div> <div class="label">{{ $title }}</div>
<div class="attachments-files"> <div class="attachments-files">
{{- $filesName := "files" }} {{- $filesName := "files" }}
{{- if ne .Page.File.BaseFileName "index" }} {{- if ne .Page.File.BaseFileName "index" }}
{{- $filesName = printf "%s.files" .Page.File.BaseFileName }} {{- $filesName = printf "%s.files" .Page.File.BaseFileName }}
{{- end}} {{- end}}
{{- $fileDir := replace .Page.File.Dir "\\" "/" }} {{- $fileDir := replace .Page.File.Dir "\\" "/" }}
{{- $pattern := .Get "pattern" | default "" }} {{- $pattern := .Get "pattern" | default "" }}
{{- range sort (readDir (printf "content/%s%s" .Page.File.Dir $filesName) ) "Name" $sort }} {{- range sort (readDir (printf "content/%s%s" .Page.File.Dir $filesName) ) "Name" $sort }}
{{- if findRE $pattern .Name}} {{- if findRE $pattern .Name}}
{{- $size := .Size }} {{- $size := .Size }}
{{- $unit := "Byte-symbol" }} {{- $unit := "Byte-symbol" }}
{{- if ge $size 1024 }} {{- if ge $size 1024 }}
{{- $size = div $size 1024 }} {{- $size = div $size 1024 }}
{{- $unit = "Kilobyte-symbol" }} {{- $unit = "Kilobyte-symbol" }}
{{- end }}
{{- if ge $size 1024 }}
{{- $size = div $size 1024 }}
{{- $unit = "Megabyte-symbol" }}
{{- end }}
{{- $unitsymbol := $unit | T }}
<li>
<a href="{{ (printf "%s%s/%s" $fileDir $filesName .Name) | relLangURL }}">{{.Name}}</a>
({{$size}} {{$unitsymbol}})
</li>
{{- end }} {{- end }}
{{- if ge $size 1024 }}
{{- $size = div $size 1024 }}
{{- $unit = "Megabyte-symbol" }}
{{- end }}
{{- $unitsymbol := $unit | T }}
<li>
<a href="{{ (printf "%s%s/%s" $fileDir $filesName .Name) | relLangURL }}">{{.Name}}</a>
({{$size}} {{$unitsymbol}})
</li>
{{- end }} {{- end }}
{{- end }}
</div> </div>
{{- .Inner }} {{- .Inner }}
</section> </section>

View file

@ -1,14 +1,14 @@
{{ $_hugo_config := `{ "version": 1 }` }} {{- $_hugo_config := `{ "version": 1 }` }}
<a {{ with .Get "href"}} href="{{.}}" target="_blank" {{ end }} class="btn btn-default"> <a{{ with .Get "href"}} href="{{ . }}" target="_blank"{{ end }} class="btn btn-default">
{{ $icon := .Get "icon" }} {{- $icon := .Get "icon" }}
{{ $iconposition := .Get "icon-position" }} {{- $iconposition := .Get "icon-position" }}
{{ if ($icon) }} {{- if ($icon) }}
{{ if or (not ($iconposition)) (eq $iconposition "left") }} {{- if or (not ($iconposition)) (eq $iconposition "left") }}
<i class="{{$icon}}"></i> <i class="{{ $icon }}"></i>
{{ end }} {{- end }}
{{ end }} {{- end }}
{{ .Inner }} {{ .Inner }}
{{ if and ($icon) (eq $iconposition "right")}} {{- if and ($icon) (eq $iconposition "right")}}
<i class="{{$icon}}"></i> <i class="{{$icon}}"></i>
{{ end }} {{- end }}
</a> </a>

View file

@ -1,100 +1,100 @@
{{ $_hugo_config := `{ "version": 1 }` }} {{- $_hugo_config := `{ "version": 1 }` }}
{{ $showhidden := .Get "showhidden"}} {{- $showhidden := .Get "showhidden"}}
{{ $style := .Get "style" | default "li" }} {{- $style := .Get "style" | default "li" }}
{{ $depth := .Get "depth" | default 1 }} {{- $depth := .Get "depth" | default 1 }}
{{ $withDescription := .Get "description" | default false }} {{- $withDescription := .Get "description" | default false }}
{{ $sortTerm := .Get "sort" | default (.Site.Params.ordersectionsby | default "weight") | lower }} {{- $sortTerm := .Get "sort" | default (.Site.Params.ordersectionsby | default "weight") | lower }}
{{ $containerstyle := .Get "containerstyle" | default "ul" }} {{- $containerstyle := .Get "containerstyle" | default "ul" }}
{{(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 }}
{{ .Scratch.Set "pages" .Page.Pages }} {{- .Scratch.Set "pages" .Page.Pages }}
{{if .Page.IsHome}} {{- if .Page.IsHome }}
<!-- Add pages that are in root dir --> <!-- Add pages that are in root dir -->
{{ $rootPage := where .Page.Pages "Dir" "" }} {{- $rootPage := where .Page.Pages "Dir" "" }}
{{ .Scratch.Set "pages" (.Page.Sections | union $rootPage)}} {{- .Scratch.Set "pages" (.Page.Sections | union $rootPage)}}
{{else}} {{- else }}
{{ if .Page.Sections}} {{- if .Page.Sections}}
{{ .Scratch.Set "pages" (.Page.Pages | union .Page.Sections) }} {{- .Scratch.Set "pages" (.Page.Pages | union .Page.Sections) }}
{{end}} {{- end }}
{{end}} {{- end }}
{{ $pages := (.Scratch.Get "pages") }} {{- $pages := (.Scratch.Get "pages") }}
{{if eq $sortTerm "weight"}} {{- if eq $sortTerm "weight" }}
{{template "childs" dict "menu" $pages.ByWeight "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm}} {{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
{{else if or (eq $sortTerm "name") (eq $sortTerm "title")}} {{- else if or (eq $sortTerm "name") (eq $sortTerm "title") }}
{{template "childs" dict "menu" $pages.ByTitle "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm}} {{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
{{else if eq $sortTerm "publishdate"}} {{- else if eq $sortTerm "publishdate" }}
{{template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm}} {{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
{{else if eq $sortTerm "date"}} {{- else if eq $sortTerm "date" }}
{{template "childs" dict "menu" $pages.ByDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm}} {{- template "childs" dict "menu" $pages.ByDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
{{else if eq $sortTerm "length"}} {{- else if eq $sortTerm "length" }}
{{template "childs" dict "menu" $pages.ByLength "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm}} {{- template "childs" dict "menu" $pages.ByLength "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
{{else}} {{- else }}
{{template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm}} {{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
{{end}} {{- end }}
{{(printf "</%s>" $containerstyle)|safeHTML}} {{ (printf "</%s>" $containerstyle)|safeHTML }}
{{ define "childs" }} {{- define "childs" }}
{{ 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}} {{ (printf "<h%d>" $numn)|safeHTML -}}
<a href="{{.RelPermalink}}" >{{ .Title }}</a> <a href="{{ .RelPermalink }}" >{{ .Title }}</a>
{{(printf "</h%d>" $numn)|safeHTML}} {{- (printf "</h%d>" $numn)|safeHTML }}
{{else}} {{- else }}
{{(printf "<%s>" $.style)|safeHTML}} {{ (printf "<%s>" $.style)|safeHTML -}}
<a href="{{.RelPermalink}}" >{{ .Title }}</a> <a href="{{ .RelPermalink }}" >{{ .Title }}</a>
{{(printf "</%s>" $.style)|safeHTML}} {{- (printf "</%s>" $.style)|safeHTML }}
{{end}} {{- end }}
{{if $.description}} {{- if $.description }}
{{if .Description}} {{- if .Description }}
<p>{{.Description}}</p> <p>{{ .Description }}</p>
{{else}} {{else}}
<p>{{.Summary}}</p> <p>{{ .Summary }}</p>
{{end}} {{- end }}
{{end}} {{- end }}
{{end}} {{- end }}
{{ if lt $.count $.depth}} {{- if lt $.count $.depth }}
{{if eq $.style "li"}} {{- if eq $.style "li" }}
{{(printf "<%s>" $.containerstyle)|safeHTML}} {{- (printf "<%s>" $.containerstyle)|safeHTML }}
{{end}} {{- end }}
{{ if .Sections}} {{- if .Sections }}
{{ .Scratch.Set "pages" (.Pages | union .Sections) }} {{- .Scratch.Set "pages" (.Pages | union .Sections) }}
{{else}} {{- else }}
{{ .Scratch.Set "pages" .Pages }} {{- .Scratch.Set "pages" .Pages }}
{{end}} {{- end }}
{{ $pages := (.Scratch.Get "pages") }} {{- $pages := (.Scratch.Get "pages") }}
{{if eq $.sortTerm "weight"}} {{- if eq $.sortTerm "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}} {{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
{{else if or (eq $.sortTerm "name") (eq $.sortTerm "title")}} {{- else if or (eq $.sortTerm "name") (eq $.sortTerm "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}} {{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
{{else if eq $.sortTerm "publishdate"}} {{- else if eq $.sortTerm "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}} {{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
{{else if eq $.sortTerm "date"}} {{- else if eq $.sortTerm "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}} {{- template "childs" dict "menu" $pages.ByDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
{{else if eq $.sortTerm "length"}} {{- else if eq $.sortTerm "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}} {{- template "childs" dict "menu" $pages.ByLength "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
{{else}} {{- else }}
{{template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm}} {{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
{{end}} {{- end }}
{{if eq $.style "li"}} {{- if eq $.style "li" }}
{{(printf "</%s>" $.containerstyle)|safeHTML}} {{- (printf "</%s>" $.containerstyle)|safeHTML }}
{{end}} {{- end }}
{{end}} {{- end }}
{{end}} {{- end }}
{{end}} {{- end }}
{{end}} {{- end }}

View file

@ -1,7 +1,7 @@
{{ $_hugo_config := `{ "version": 1 }` }} {{- $_hugo_config := `{ "version": 1 }` }}
{{ $title := .Get 0 | default (T "Expand-title") }} {{- $title := .Get 0 | default (T "Expand-title") }}
{{ $content := .Inner | safeHTML }} {{- $content := .Inner | safeHTML }}
{{ $expanded := eq (.Get 1) "true" }} {{- $expanded := eq (.Get 1) "true" }}
<div class="expand <div class="expand
{{- if $expanded }} expand-expanded{{ end -}} {{- if $expanded }} expand-expanded{{ end -}}
"> ">

View file

@ -1,6 +1,6 @@
{{ $file := .Get 0 }} {{- $file := .Get 0 }}
{{ $showFirstHeading := .Get 1 | default true }} {{- $showFirstHeading := .Get 1 | default true }}
<div class="include{{if not $showFirstHeading }} hide-first-heading{{end}}"> <div class="include{{ if not $showFirstHeading }} hide-first-heading{{ end }}">
{{ $file | readFile | safeHTML }} {{ $file | readFile | safeHTML }}
</div> </div>

View file

@ -1,2 +1,4 @@
{{ $_hugo_config := `{ "version": 1 }` }} {{- $_hugo_config := `{ "version": 1 }` }}
<div class="mermaid" align="{{ if .Get "align" }}{{ .Get "align" }}{{ else }}center{{ end }}">{{ safeHTML .Inner }}</div> <div class="mermaid" align="{{ if .Get "align" }}{{ .Get "align" }}{{ else }}center{{ end }}">
{{- safeHTML .Inner -}}
</div>

View file

@ -1,7 +1,7 @@
{{ $_hugo_config := `{ "version": 1 }` }} {{- $_hugo_config := `{ "version": 1 }` }}
{{ $style := .Get 0 }} {{- $style := .Get 0 }}
{{ $title := $style | T }} {{- $title := $style | T }}
<div class="notices {{ $style }}"> <div class="notices {{ $style }}">
<div class="label">{{ $title }}</div> <div class="label">{{ $title }}</div>
{{ .Inner }} {{- .Inner }}
</div> </div>

View file

@ -9,4 +9,3 @@
{{ else }} {{ else }}
{{- errorf "[%s] %q: tab shortcode missing its parent" site.Language.Lang .Page.Path -}} {{- errorf "[%s] %q: tab shortcode missing its parent" site.Language.Lang .Page.Path -}}
{{ end}} {{ end}}

View file

@ -1,21 +1,21 @@
{{ with .Inner }}{{/* don't do anything, just call it */}}{{ end }} {{- with .Inner }}{{/* don't do anything, just call it */}}{{ end }}
{{ $groupId := default "default" (.Get "groupId") }} {{- $groupId := default "default" (.Get "groupId") }}
<div class="tab-panel"> <div class="tab-panel">
<div class="tab-nav"> <div class="tab-nav">
{{ range $idx, $tab := .Scratch.Get "tabs" }} {{- range $idx, $tab := .Scratch.Get "tabs" }}
<button <button
data-tab-item="{{ .name }}" data-tab-item="{{ .name }}"
data-tab-group="{{ $groupId }}" data-tab-group="{{ $groupId }}"
class="tab-nav-button btn {{ cond (eq $idx 0) "active" ""}}" class="tab-nav-button btn {{ cond (eq $idx 0) "active" ""}}"
onclick="switchTab('{{ $groupId }}','{{ .name }}')" onclick="switchTab('{{ $groupId }}','{{ .name }}')"
><span>{{ .name }}</span></button> ><span>{{ .name }}</span></button>
{{ end }} {{- end }}
</div> </div>
<div class="tab-content"> <div class="tab-content">
{{ range $idx, $tab := .Scratch.Get "tabs" }} {{- range $idx, $tab := .Scratch.Get "tabs" }}
<div data-tab-item="{{ .name }}" data-tab-group="{{ $groupId }}" class="tab-item {{ cond (eq $idx 0) "active" ""}}"> <div data-tab-item="{{ .name }}" data-tab-group="{{ $groupId }}" class="tab-item {{ cond (eq $idx 0) "active" ""}}">
{{ .content }} {{ .content }}
</div>
{{ end }}
</div> </div>
{{- end }}
</div>
</div> </div>