Merge commit 'b3d87dd0fd746f07f9afa6e6a2969aea41da6a38'

This commit is contained in:
Bjørn Erik Pedersen
2025-04-24 10:23:16 +02:00
101 changed files with 503 additions and 164 deletions

View File

@@ -0,0 +1,33 @@
{{- if eq .Type "alert" }}
{{- $alerts := dict
"caution" (dict "color" "red" "icon" "exclamation-triangle")
"important" (dict "color" "blue" "icon" "exclamation-circle")
"note" (dict "color" "blue" "icon" "information-circle")
"tip" (dict "color" "green" "icon" "light-bulb")
"warning" (dict "color" "orange" "icon" "exclamation-triangle")
}}
{{- $alertTypes := slice }}
{{- range $k, $_ := $alerts }}
{{- $alertTypes = $alertTypes | append $k }}
{{- end }}
{{- $alertTypes = $alertTypes | sort }}
{{- $alertType := strings.ToLower .AlertType }}
{{- if in $alertTypes $alertType }}
{{- partial "layouts/blocks/alert.html" (dict
"color" (or ((index $alerts $alertType).color) "blue")
"icon" (or ((index $alerts $alertType).icon) "information-circle")
"text" .Text
"title" .AlertTitle
"class" .Attributes.class
)
}}
{{- else }}
{{- errorf `Invalid blockquote alert type. Received %s. Expected one of %s (case-insensitive). See %s.` .AlertType (delimit $alertTypes ", " ", or ") .Page.String }}
{{- end }}
{{- else }}
<blockquote {{- with .Attributes.class }}class="{{ . }}"{{- end }}>
{{ .Text }}
</blockquote>
{{- end }}