mirror of https://github.com/luizdepra/hugo-coder.git

Luiz F. A. de Prá
22.56.2021 ba25ee88f45ae703a0bcfcc235d7ece82695f70f
1
2
3
4
5
6
7
8
9
10
11
12
13
{{ $type := .Get 0 }}
{{ $title := default ( .Get 1 ) $type }}
{{ $raw := (markdownify .Inner | chomp) }}
{{ $block := findRE "(?is)^<(?:address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h(?:1|2|3|4|5|6)|header|hgroup|hr|li|main|nav|noscript|ol|output|p|pre|section|table|tfoot|ul|video)\\b" $raw 1 }}
{{ $icon := dict "note" "fa-sticky-note" "tip" "fa-lightbulb-o" "example" "fa-file-text" "question" "fa-question" "info" "fa-exclamation-circle" "warning" "fa-exclamation-triangle" "error" "fa-times-circle" }}
<div class="notice {{ $type }}">
  <div class="title">
    <i class="fa {{ index $icon $type }}" aria-hidden="true"></i>{{ i18n $title | default $title | title }}
  </div>
  <div class="content">
    {{- if or $block (not $raw) }}{{ $raw }}{{ else }}<p>{{ $raw }}</p>{{ end -}}
  </div>
</div>