From ba25ee88f45ae703a0bcfcc235d7ece82695f70f Mon Sep 17 00:00:00 2001
From: Luiz F. A. de PrĂ¡ <rawarkanis@gmail.com>
Date: Mon, 22 Mar 2021 15:56:59 +0000
Subject: [PATCH] Fix notice HTML
---
layouts/shortcodes/notice.html | 42 ++++++++++--------------------------------
1 files changed, 10 insertions(+), 32 deletions(-)
diff --git a/layouts/shortcodes/notice.html b/layouts/shortcodes/notice.html
index e7ee58b..c347dbc 100644
--- a/layouts/shortcodes/notice.html
+++ b/layouts/shortcodes/notice.html
@@ -1,35 +1,13 @@
-{{ $noticeType := .Get 0 }}
+{{ $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 }}
-<div class="notice {{ $noticeType }}">
- <p class="notice-title">
- <span class="icon-notice baseline">
- {{ if eq $noticeType "note" }}
- <i class="fa fa-info-circle" aria-hidden="true"></i>
- {{ end}}
- {{ if eq $noticeType "warning" }}
- <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
- {{ end}}
- {{ if eq $noticeType "tip" }}
- <i class="fa fa-check" aria-hidden="true"></i>
- {{ end}}
- {{ if eq $noticeType "info" }}
- <i class="fa fa-info" aria-hidden="true"></i>
- {{ end}}
- </span>
-
- {{ if eq $noticeType "note" }}
- {{ i18n "notice_note" }}
- {{ end}}
- {{ if eq $noticeType "warning" }}
- {{ i18n "notice_warning" }}
- {{ end}}
- {{ if eq $noticeType "tip" }}
- {{ i18n "notice_tip" }}
- {{ end}}
- {{ if eq $noticeType "info" }}
- {{ i18n "notice_info" }}
- {{ end}}
- </p>
- {{- if or $block (not $raw) }}{{ $raw }}{{ else }}<p>{{ $raw }}</p>{{ end -}}
+{{ $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>
--
Gitblit v1.10.0