diff options
| author | Arne Rief <riearn@proton.me> | 2025-09-22 18:04:09 +0200 |
|---|---|---|
| committer | Arne Rief <riearn@proton.me> | 2025-09-22 18:04:09 +0200 |
| commit | 6b5ac43b0eb9f799220783e98b5961192666b755 (patch) | |
| tree | ea39cc2c610ee033613efe3500866494c4bd0778 /layouts/_shortcodes/descrlist.html | |
| parent | a57a8f991a2a5960fc886aa8bfcfca9719cecfda (diff) | |
Diffstat (limited to 'layouts/_shortcodes/descrlist.html')
| -rw-r--r-- | layouts/_shortcodes/descrlist.html | 20 |
1 files changed, 20 insertions, 0 deletions
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" >}} +*/ -}} +<dl{{ with .Get "class" }} class="{{ . }}" {{ end }}> +{{- $pairs := split (.Get "entries") ";" -}} + {{- range $pairs -}} + {{- $currentPairSplit := split . "=" -}} + <dt> + {{ index $currentPairSplit 0 }} + </dt> + <dd> + {{ index $currentPairSplit 1 }} + </dd> + {{- end -}} +</dl> |
