From 5b51384e61bfdc544b9d582313d6e48758800a73 Mon Sep 17 00:00:00 2001 From: WfKe9vLwSvv7rN <96372288+WfKe9vLwSvv7rN@users.noreply.github.com> Date: Thu, 25 Aug 2022 00:37:44 +0000 Subject: [PATCH] Add `abbr` shortcode --- layouts/shortcodes/abbr.html | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 layouts/shortcodes/abbr.html diff --git a/layouts/shortcodes/abbr.html b/layouts/shortcodes/abbr.html new file mode 100644 index 0000000..4ff6adf --- /dev/null +++ b/layouts/shortcodes/abbr.html @@ -0,0 +1,48 @@ +{{/* + + HTML abbreviation element + https://developer.mozilla.org/en-US/docs/Web/HTML/Element/abbr + + Output: + Abbreviation + Abbreviation + + Syntax: + {{< abbr "Abbreviation" />}} + {{< abbr abbr="Abbreviation" />}} + {{< abbr >}}Abbreviation{{< /abbr >}} + + {{< abbr "Abbreviation" "Expansion" />}} + {{< abbr abbr="Abbreviation" title="Expansion" />}} + {{< abbr "Expansion" >}}Abbreviation{{< /abbr >}} + {{< abbr title="Expansion" >}}Abbreviation{{< /abbr >}} + + This file and its contents are licensed under the Blue Oak Model License 1.0.0. + https://blueoakcouncil.org/license/1.0.0 + (c) 2022 WfKe9vLwSvv7rN + +*/}} + +{{- $abbr := "" -}} +{{- $title := "" -}} + +{{- with .Get "title" -}} + {{- $title = . -}} +{{- end -}} +{{- with .Inner -}} + {{- $abbr = $.Page.RenderString . -}} + {{- with $.Get 0 -}} + {{- $title = . -}} + {{- end -}} +{{- else -}} + {{- if .IsNamedParams -}} + {{- $abbr = .Get "abbr" -}} + {{- else -}} + {{- $abbr = .Get 0 -}} + {{- with .Get 1 -}} + {{- $title = . -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{ $abbr }} \ No newline at end of file