{{ $error := false }} {{ if partial "utilities/IsInvalidArgs.html" (dict "structure" "alert" "args" .Params) }} {{ errorf "Invalid arguments: %s" .Position -}} {{ $error = true }} {{ end }} {{ $color := .Get "color" | default "danger" -}} {{ $icon := .Get "icon" | default "" }} {{ $type := .Get "type" | default "" -}} {{ if eq $type "danger" }} {{ $icon = "fas triangle-exclamation" }} {{ $color = "danger" }} {{ else if eq $type "info" }} {{ $icon = "fa lightbulb" }} {{ $color = "info" }} {{ end }} {{ with $icon }} {{ $icon = partial "assets/icon.html" (dict "icon" (printf "%s fa-2x fa-fw" .)) }} {{ end }} {{ $dismissible := false -}} {{ with .Get "dismissible" }}{{ $dismissible = partial "utilities/CastBool.html" . }}{{ end -}} {{- $class := .Get "class" | default "" -}} {{ $body := trim .Inner " \r\n" -}} {{ if not $body -}} {{ errorf "Missing inner element text: %s" .Position -}} {{ $error = true }} {{ end -}} {{- if not $error -}}