github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/shortcodes/badge.html (about) 1 {{- $page := .page }} 2 {{- if and (not $page) .context }} 3 {{- $page = .context }} 4 {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'badge' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }} 5 {{- end }} 6 {{- $color := .color | default "" }} 7 {{- $content := .content }} 8 {{- $style := .style | default "default" }} 9 {{- $title := .title }} 10 {{- if not $title }} 11 {{- if eq $style "info" }}{{ $title = $style | T }}{{ end }} 12 {{- if eq $style "warning" }}{{ $title = $style | T }}{{ end }} 13 {{- if eq $style "note" }}{{ $title = $style | T }}{{ end }} 14 {{- if eq $style "tip" }}{{ $title = $style | T }}{{ end }} 15 {{- end }} 16 {{- $title = trim $title " " }} 17 {{- $icon := .icon | default "" }} 18 {{- if and (not $icon) (eq (len $icon) 0) }} 19 {{- if eq $style "info" }}{{ $icon = default "info-circle" }}{{ end }} 20 {{- if eq $style "warning" }}{{ $icon = default "exclamation-triangle" }}{{ end }} 21 {{- if eq $style "note" }}{{ $icon = default "exclamation-circle" }}{{ end }} 22 {{- if eq $style "tip" }}{{ $icon = default "lightbulb" }}{{ end }} 23 {{- end }} 24 {{- $icon = trim $icon " " }} 25 {{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }} 26 {{- $icon = printf "fa-fw fas fa-%s" $icon }} 27 {{- end }} 28 {{- with $page -}} 29 <span class="badge cstyle {{ $style }}{{ if or $icon $title }} badge-with-title{{ end }}">{{ if or $icon $title }}<span class="badge-title">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title | .RenderString }}{{ end }}</span>{{ end }}<span class="badge-content"{{ if $color }} style="background-color: {{ $color }};"{{ end }}>{{ $content }}</span></span> 30 {{- end }}