LoveIt/layouts/shortcodes/admonition.html

54 lines
2.4 KiB
HTML
Raw Normal View History

2020-01-31 15:53:04 +01:00
{{- $_hugo_config := `{ "version": 1 }` -}}
{{- $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 -}}
{{- $iconMap = dict "details" "fas fa-angle-down" | merge $iconMap -}}
2020-01-31 15:53:04 +01:00
{{- if .IsNamedParams -}}
{{- $type := .Get "type" -}}
{{- if eq (.Get "details") "true" -}}
<details class="admonition {{ $type }}">
2020-01-31 15:53:04 +01:00
{{- with .Get "title" -}}
<summary class="admonition-title">
<i class="icon {{ index $iconMap $type }}"></i>{{ . }}<i class="details {{ index $iconMap "details" }}"></i>
</summary>
{{- end -}}
{{- .Inner -}}
2019-08-11 19:36:19 +02:00
</details>
{{- else -}}
<div class="admonition {{ $type }}">
2020-01-31 15:53:04 +01:00
{{- with .Get "title" -}}
<p class="admonition-title"><i class="icon {{ index $iconMap $type }}"></i>{{ . }}</p>
{{- end -}}
{{- .Inner -}}
2019-08-11 19:36:19 +02:00
</div>
{{- end -}}
2020-01-31 15:53:04 +01:00
{{- else -}}
{{- $type := .Get 0 -}}
{{- if eq (.Get 2) "true" -}}
<details class="admonition {{ $type }}">
2020-01-31 15:53:04 +01:00
{{- with .Get 1 -}}
<summary class="admonition-title">
<i class="icon {{ index $iconMap $type }}"></i>{{ . }}<i class="details {{ index $iconMap "details" }}"></i>
</summary>
{{- end -}}
{{- .Inner -}}
2019-08-11 19:36:19 +02:00
</details>
{{- else -}}
<div class="admonition {{ $type }}">
2020-01-31 15:53:04 +01:00
{{- with .Get 1 -}}
<p class="admonition-title"><i class="icon {{ index $iconMap $type }}"></i>{{ . }}</p>
{{- end -}}
{{- .Inner -}}
2019-08-11 19:36:19 +02:00
</div>
{{- end -}}
2020-01-31 15:53:04 +01:00
{{- end -}}