+ {{/* things are getting complicated when search tries to open the expand box while jquery sets the display CSS on the element */}}{{ "" -}}
+
+
+
+ {{ $title }}
+
+
+{{ $content | safeHTML }}
+
+
+{{- end }}
\ No newline at end of file
diff --git a/layouts/partials/shortcodes/include.html b/layouts/partials/shortcodes/include.html
new file mode 100644
index 0000000000..11c78ca9ce
--- /dev/null
+++ b/layouts/partials/shortcodes/include.html
@@ -0,0 +1,13 @@
+{{- $context := .context }}
+{{- $file := .file }}
+{{- $showFirstHeading := .showfirstheading | default true }}
+{{- if eq (printf "%T" $showFirstHeading) "string" }}
+ {{- $showFirstHeading = (eq $showFirstHeading "true") }}
+{{- end }}
+{{- if not $showFirstHeading }}
{{ end }}
+{{- with $context }}
+
+{{ $file | readFile | safeHTML }}
+
+{{- if not $showFirstHeading }}
{{ end }}
+{{- end }}
\ No newline at end of file
diff --git a/layouts/partials/shortcodes/mermaid.html b/layouts/partials/shortcodes/mermaid.html
new file mode 100644
index 0000000000..cef7f3d9a7
--- /dev/null
+++ b/layouts/partials/shortcodes/mermaid.html
@@ -0,0 +1,9 @@
+{{- $context := .context }}
+{{- $content := .content }}
+{{- $align := .align | default "center" }}
+{{- with $context }}
+
+ {{- safeHTML $content -}}
+
+{{- .Page.Store.Set "htmlHasMermaid" true }}
+{{- end }}
\ No newline at end of file
diff --git a/layouts/partials/shortcodes/notice.html b/layouts/partials/shortcodes/notice.html
new file mode 100644
index 0000000000..4ddc716df3
--- /dev/null
+++ b/layouts/partials/shortcodes/notice.html
@@ -0,0 +1,22 @@
+{{- $context := .context }}
+{{- $content := .content }}
+{{- $style := .style | default "default" }}
+{{- $title := .title | default ($style | T) }}
+{{- $icon := .icon | default "" }}
+{{- if and (not $icon) (eq (len $icon) 0) }}
+ {{- if eq $style "info" }}{{ $icon = default "info-circle" }}{{ end }}
+ {{- if eq $style "warning" }}{{ $icon = default "exclamation-triangle" }}{{ end }}
+ {{- if eq $style "note" }}{{ $icon = default "exclamation-circle" }}{{ end }}
+ {{- if eq $style "tip" }}{{ $icon = default "lightbulb" }}{{ end }}
+{{- end }}
+{{- $icon = trim $icon " " }}
+{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
+ {{- $icon = printf "fa-fw fas fa-%s" $icon }}
+{{- end }}
+{{- with $context }}
+
+
{{ if $icon }} {{ end }}{{ $title }}
+
+{{ $content | safeHTML }}
+
+{{- end }}
\ No newline at end of file
diff --git a/layouts/partials/shortcodes/siteparam.html b/layouts/partials/shortcodes/siteparam.html
new file mode 100644
index 0000000000..edfa288ed8
--- /dev/null
+++ b/layouts/partials/shortcodes/siteparam.html
@@ -0,0 +1,10 @@
+{{- $context := .context }}
+{{- $paramName := .name }}
+{{- with $context }}
+{{- $siteParams := .Site.Params }}
+{{- with $paramName }}
+ {{- with $siteParams }}
+ {{- index . (lower $paramName) }}
+ {{- end }}
+{{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/layouts/partials/shortcodes/swagger.html b/layouts/partials/shortcodes/swagger.html
new file mode 100644
index 0000000000..c135499935
--- /dev/null
+++ b/layouts/partials/shortcodes/swagger.html
@@ -0,0 +1,28 @@
+{{- $context := .context }}
+{{- $src := .src }}
+{{- with $context }}
+{{- with .Page.Resources.Match $src }}
+ {{- range . }}
+ {{- $src = .RelPermalink }}
+ {{- end }}
+{{- end }}
+
+
+{{- .Page.Store.Set "htmlHasSwagger" true }}
+{{- end }}
\ No newline at end of file
diff --git a/layouts/partials/shortcodes/tabs.html b/layouts/partials/shortcodes/tabs.html
new file mode 100644
index 0000000000..c13c9c969c
--- /dev/null
+++ b/layouts/partials/shortcodes/tabs.html
@@ -0,0 +1,24 @@
+{{- $context := .context }}
+{{- $tabs := .tabs | default slice }}
+{{- $groupId := .groupId | default "default" }}
+{{- with $context }}
+
+
+ {{- range $idx, $tab := $tabs }}
+
+ {{- end }}
+
+
+ {{- range $idx, $tab := $tabs }}
+
+{{ .content | safeHTML }}
+
+ {{- end }}
+
+
+{{- end }}
\ No newline at end of file
diff --git a/layouts/shortcodes/attachments.html b/layouts/shortcodes/attachments.html
index 358c4f8881..4bf4494066 100644
--- a/layouts/shortcodes/attachments.html
+++ b/layouts/shortcodes/attachments.html
@@ -1,47 +1,10 @@
{{- $_hugo_config := `{ "version": 1 }` }}
-{{- $style := .Get "style" | default "transparent" }}
-{{- $title := .Get "title" | default ($style | T) | default ("Attachments-label" | T) }}
-{{- $icon := .Get "icon" | default "" }}
-{{- if and (not $icon) (eq (len $icon) 0) }}
- {{- $icon = "paperclip" }}
- {{- if eq $style "info" }}{{ $icon = default "info-circle" }}{{ end }}
- {{- if eq $style "warning" }}{{ $icon = default "exclamation-triangle" }}{{ end }}
- {{- if eq $style "note" }}{{ $icon = default "exclamation-circle" }}{{ end }}
- {{- if eq $style "tip" }}{{ $icon = default "lightbulb" }}{{ end }}
-{{- end }}
-{{- $icon = trim $icon " " }}
-{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
- {{- $icon = printf "fa-fw fas fa-%s" $icon }}
-{{- end }}
-{{- $sort := .Get "sort" | default "asc" }}
-{{- $pattern := .Get "pattern" | default "" }}
-
- {{/* things are getting complicated when search tries to open the expand box while jquery sets the display CSS on the element */}}{{ "" -}}
-
-
-
- {{ $title }}
-
-
-{{ $content }}
-
-
\ No newline at end of file
+{{- partial "shortcodes/expand.html" (dict
+ "context" .
+ "content" .Inner
+ "open" (.Get "open" | default (.Get 1))
+ "title" (.Get "title" | default (.Get 0))
+) }}
\ No newline at end of file
diff --git a/layouts/shortcodes/include.html b/layouts/shortcodes/include.html
index 5f357bf576..d316b40a0f 100644
--- a/layouts/shortcodes/include.html
+++ b/layouts/shortcodes/include.html
@@ -1,10 +1,5 @@
-{{- $file := .Get "file" | default (.Get 0) }}
-{{- $showFirstHeading := .Get "showfirstheading" | default (.Get 1) | default true }}
-{{- if eq (printf "%T" $showFirstHeading) "string" }}
- {{- $showFirstHeading = (eq $showFirstHeading "true") }}
-{{- end }}
-{{- if not $showFirstHeading }}
{{ end }}
-
-{{ $file | readFile | safeHTML }}
-
-{{- if not $showFirstHeading }}
{{ end }}
\ No newline at end of file
+{{- partial "shortcodes/include.html" (dict
+ "context" .
+ "file" (.Get "align" | default (.Get 0))
+ "showFirstHeading" (.Get "showfirstheading" | default (.Get 1))
+) }}
\ No newline at end of file
diff --git a/layouts/shortcodes/mermaid.html b/layouts/shortcodes/mermaid.html
index c7af39c62c..bc52efc732 100644
--- a/layouts/shortcodes/mermaid.html
+++ b/layouts/shortcodes/mermaid.html
@@ -1,6 +1,6 @@
{{- $_hugo_config := `{ "version": 1 }` }}
-{{- $align := .Get "align" | default "center" }}
-
- {{- safeHTML .Inner -}}
-
-{{- .Page.Store.Set "htmlHasMermaid" true }}
\ No newline at end of file
+{{- partial "shortcodes/mermaid.html" (dict
+ "context" .
+ "content" .Inner
+ "align" (.Get "align")
+) }}
\ No newline at end of file
diff --git a/layouts/shortcodes/notice.html b/layouts/shortcodes/notice.html
index 88e0120ab2..f3cb4fa2a3 100644
--- a/layouts/shortcodes/notice.html
+++ b/layouts/shortcodes/notice.html
@@ -1,19 +1,8 @@
{{- $_hugo_config := `{ "version": 1 }` }}
-{{- $style := .Get "style" | default (.Get 0) | default "default" }}
-{{- $title := .Get "title" | default (.Get 1) | default ($style | T) }}
-{{- $icon := .Get "icon" | default (.Get 2) | default "" }}
-{{- if and (not $icon) (eq (len $icon) 0) }}
- {{- if eq $style "info" }}{{ $icon = default "info-circle" }}{{ end }}
- {{- if eq $style "warning" }}{{ $icon = default "exclamation-triangle" }}{{ end }}
- {{- if eq $style "note" }}{{ $icon = default "exclamation-circle" }}{{ end }}
- {{- if eq $style "tip" }}{{ $icon = default "lightbulb" }}{{ end }}
-{{- end }}
-{{- $icon = trim $icon " " }}
-{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
- {{- $icon = printf "fa-fw fas fa-%s" $icon }}
-{{- end }}
-
-
{{ if $icon }} {{ end }}{{ $title }}
-
-{{ .Inner }}
-
\ No newline at end of file
+{{- partial "shortcodes/notice.html" (dict
+ "context" .
+ "content" .Inner
+ "icon" (.Get "icon" | default (.Get 2))
+ "style" (.Get "style" | default (.Get 0))
+ "title" (.Get "title" | default (.Get 1))
+) }}
\ No newline at end of file
diff --git a/layouts/shortcodes/siteparam.html b/layouts/shortcodes/siteparam.html
index d4cbd07da9..3f8e226496 100644
--- a/layouts/shortcodes/siteparam.html
+++ b/layouts/shortcodes/siteparam.html
@@ -1,7 +1,4 @@
-{{- $paramName := .Get "name" | default (.Get 0) -}}
-{{- $siteParams := .Site.Params -}}
-{{- with $paramName -}}
- {{- with $siteParams -}}
- {{- index . (lower $paramName) -}}
- {{- end -}}
-{{- end -}}
\ No newline at end of file
+{{- partial "shortcodes/siteparam.html" (dict
+ "context" .
+ "name" (.Get "name" | default (.Get 0))
+) }}
\ No newline at end of file
diff --git a/layouts/shortcodes/swagger.html b/layouts/shortcodes/swagger.html
index ba360bedc4..54bcf98a57 100644
--- a/layouts/shortcodes/swagger.html
+++ b/layouts/shortcodes/swagger.html
@@ -1,25 +1,4 @@
-{{- $original := .Get "src" }}
-{{- with .Page.Resources.Match $original }}
- {{- range . }}
- {{- $original = .RelPermalink }}
- {{- end }}
-{{- end }}
-
-
-{{- .Page.Store.Set "htmlHasSwagger" true }}
\ No newline at end of file
+{{- partial "shortcodes/swagger.html" (dict
+ "context" .
+ "src" (.Get "src")
+) }}
\ No newline at end of file
diff --git a/layouts/shortcodes/tab.html b/layouts/shortcodes/tab.html
index 661af3615c..3283b5d30e 100644
--- a/layouts/shortcodes/tab.html
+++ b/layouts/shortcodes/tab.html
@@ -1,11 +1,10 @@
-{{ if .Parent }}
- {{ $name := trim (.Get "name") " " }}
- {{ if not (.Parent.Scratch.Get "tabs") }}
- {{ .Parent.Scratch.Set "tabs" slice }}
- {{ end }}
- {{ with .Inner }}
- {{ $.Parent.Scratch.Add "tabs" (dict "name" $name "content" . ) }}
- {{ end }}
-{{ else }}
+{{- $content := .Inner }}
+{{- $name := (.Get "name") }}
+{{- if .Parent }}
+ {{- if not (.Parent.Scratch.Get "tabs") }}
+ {{- .Parent.Scratch.Set "tabs" slice }}
+ {{- end }}
+ {{- $.Parent.Scratch.Add "tabs" (dict "name" (trim $name " ") "content" $content ) }}
+{{- else }}
{{- errorf "[%s] %q: tab shortcode missing its parent" site.Language.Lang .Page.Path -}}
-{{ end}}
+{{- end}}
\ No newline at end of file
diff --git a/layouts/shortcodes/tabs.html b/layouts/shortcodes/tabs.html
index bc4c56158f..3f2a312383 100644
--- a/layouts/shortcodes/tabs.html
+++ b/layouts/shortcodes/tabs.html
@@ -1,21 +1,6 @@
-{{- with .Inner }}{{/* don't do anything, just call it */}}{{ end }}
-{{- $groupId := .Get "groupId" | default "default" }}
-
-
- {{- range $idx, $tab := .Scratch.Get "tabs" }}
-
- {{- end }}
-
-
- {{- range $idx, $tab := .Scratch.Get "tabs" }}
-
-{{ .content }}
-
- {{- end }}
-
-
+{{- partial "shortcodes/tabs.html" (dict
+ "context" .
+ "content" .Inner
+ "groupId" (.Get "groupId")
+ "tabs" (.Scratch.Get "tabs")
+) }}
\ No newline at end of file