From 6b5ac43b0eb9f799220783e98b5961192666b755 Mon Sep 17 00:00:00 2001 From: Arne Rief Date: Mon, 22 Sep 2025 18:04:09 +0200 Subject: Descrlist shortcode --- layouts/_shortcodes/descrlist.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 layouts/_shortcodes/descrlist.html (limited to 'layouts/_shortcodes/descrlist.html') diff --git a/layouts/_shortcodes/descrlist.html b/layouts/_shortcodes/descrlist.html new file mode 100644 index 0000000..99517c3 --- /dev/null +++ b/layouts/_shortcodes/descrlist.html @@ -0,0 +1,20 @@ +{{- /* + Description list for a dynamic number of term-details pairs + + @context {string} class: CSS class name + @context {string} entries: semicolon-separated pairs of "title=description" + + @example: {{< descrlist class="dl-borders-centered" entries="Author=William Shakespeare;Title=Macbeth;Year of Publication=1606" >}} +*/ -}} + +{{- $pairs := split (.Get "entries") ";" -}} + {{- range $pairs -}} + {{- $currentPairSplit := split . "=" -}} +
+ {{ index $currentPairSplit 0 }} +
+
+ {{ index $currentPairSplit 1 }} +
+ {{- end -}} + -- cgit v1.2.3