summaryrefslogtreecommitdiff
path: root/layouts/_shortcodes/descrlist.html
blob: 99517c3d328a576f76d77d73f3cd4092630a9177 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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>