/
githubmirror
/
hugo
Обзор
Документация
Войти
/
githubmirror
/
hugo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/layouts/_markup/render-blockquote.html
33 строки
1 KB
Bjørn Erik Pedersen
Merge commit 'c23d97904fd31ef745bece57133aa1b9275ec20c'
21 май 2026, 13:22
21 май 2026, 13:22
5f01b06
Код
Авторство
О чём код?
{{- 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 }}