From 72cd00a414f1853a843f4d0844b4f547e9a571ad Mon Sep 17 00:00:00 2001 From: razonyang Date: Tue, 27 Jun 2023 14:26:30 +0800 Subject: [PATCH] feat: add the display shortcode --- layouts/partials/bootstrap/display.html | 12 ++++++++++++ layouts/shortcodes/bootstrap/display.html | 2 ++ layouts/shortcodes/bs/display.html | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 layouts/partials/bootstrap/display.html create mode 100644 layouts/shortcodes/bootstrap/display.html create mode 100644 layouts/shortcodes/bs/display.html diff --git a/layouts/partials/bootstrap/display.html b/layouts/partials/bootstrap/display.html new file mode 100644 index 0000000..a638762 --- /dev/null +++ b/layouts/partials/bootstrap/display.html @@ -0,0 +1,12 @@ +{{- $level := 1 }} +{{- $class := "" }} +{{- if .IsNamedParams }} + {{- with .Get "level" }}{{ $level = . }}{{ end }} + {{- with .Get "class" }}{{ $class = . }}{{ end }} +{{- else }} + {{- with .Get 0 }}{{ $level = . }}{{ end }} + {{- with .Get 1 }}{{ $class = . }}{{ end }} +{{- end }} +{{- $classes := printf "display-%d" $level | slice }} +{{- with $class }}{{ $classes = $classes | append . }}{{ end }} +

{{ .Inner }}

diff --git a/layouts/shortcodes/bootstrap/display.html b/layouts/shortcodes/bootstrap/display.html new file mode 100644 index 0000000..aa63bb9 --- /dev/null +++ b/layouts/shortcodes/bootstrap/display.html @@ -0,0 +1,2 @@ +{{- if .Inner }}{{ end }} +{{- partial "bootstrap/display" . }} diff --git a/layouts/shortcodes/bs/display.html b/layouts/shortcodes/bs/display.html new file mode 100644 index 0000000..aa63bb9 --- /dev/null +++ b/layouts/shortcodes/bs/display.html @@ -0,0 +1,2 @@ +{{- if .Inner }}{{ end }} +{{- partial "bootstrap/display" . }}