LoveIt/layouts/shortcodes/admonition.html

56 lines
2.6 KiB
HTML
Raw Normal View History

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