LoveIt/layouts/shortcodes/admonition.html

42 lines
2.1 KiB
HTML
Raw Normal View History

2020-02-18 09:22:24 +01:00
{{- $inner := .Inner | .Page.RenderString -}}
2020-04-27 19:38:22 +02:00
{{- $iconMap := dict "note" "fas fa-pencil-alt fa-fw" -}}
{{- $iconMap = dict "abstract" "fas fa-list-ul fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "info" "fas fa-info-circle fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "tip" "fas fa-lightbulb fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "success" "fas fa-check-circle fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "question" "fas fa-question-circle fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "warning" "fas fa-exclamation-triangle fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "failure" "fas fa-times-circle fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "danger" "fas fa-skull-crossbones fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "bug" "fas fa-bug fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "example" "fas fa-list-ol fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "quote" "fas fa-quote-right fa-fw" | merge $iconMap -}}
{{- $iconDetails := "fas fa-angle-right fa-fw" -}}
2020-01-31 15:53:04 +01:00
{{- if .IsNamedParams -}}
2020-02-02 14:07:38 +01:00
{{- $type := .Get "type" | default "note" -}}
2020-04-27 19:38:22 +02:00
<div class="details admonition {{ $type }}{{ if .Get `open` | ne false }} open{{ end }}">
<div class="details-summary admonition-title">
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get "title" | default (T $type) }}<i class="details-icon {{ $iconDetails }}"></i>
</div>
2020-04-27 19:38:22 +02:00
<div class="details-content">
2020-02-21 16:42:35 +01:00
<div class="admonition-content">
{{- $inner -}}
</div>
2019-08-11 19:36:19 +02:00
</div>
2020-04-27 19:38:22 +02:00
</div>
2020-01-31 15:53:04 +01:00
{{- else -}}
{{- $type := .Get 0 | default "note" -}}
2020-04-27 19:38:22 +02:00
<div class="details admonition {{ $type }}{{ if .Get 2 | ne false }} open{{ end }}">
<div class="details-summary admonition-title">
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get 1 | default (T $type) }}<i class="details-icon {{ $iconDetails }}"></i>
</div>
2020-04-27 19:38:22 +02:00
<div class="details-content">
2020-02-21 16:42:35 +01:00
<div class="admonition-content">
{{- $inner -}}
</div>
2019-08-11 19:36:19 +02:00
</div>
2020-04-27 19:38:22 +02:00
</div>
2020-02-06 17:10:00 +01:00
{{- end -}}