mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
33
docs/layouts/_default/_markup/render-blockquote.html
Normal file
33
docs/layouts/_default/_markup/render-blockquote.html
Normal 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 }}
|
Reference in New Issue
Block a user