From d7df1c7a2850c0cff38f309882564782b49186f1 Mon Sep 17 00:00:00 2001 From: tdro Date: Fri, 18 Nov 2022 17:33:34 -0500 Subject: themes/default/layouts/shortcodes: Generalize content warnings with disclose short code --- themes/default/layouts/_default/summary.html | 22 +--------------------- themes/default/layouts/partials/card-unsafe.html | 19 ------------------- themes/default/layouts/shortcodes/disclose.html | 6 ++++++ 3 files changed, 7 insertions(+), 40 deletions(-) delete mode 100644 themes/default/layouts/partials/card-unsafe.html create mode 100644 themes/default/layouts/shortcodes/disclose.html (limited to 'themes') diff --git a/themes/default/layouts/_default/summary.html b/themes/default/layouts/_default/summary.html index 356d0d9..0bf77a8 100644 --- a/themes/default/layouts/_default/summary.html +++ b/themes/default/layouts/_default/summary.html @@ -1,16 +1,9 @@ -{{- $wordLimit := gt .WordCount 75 -}} {{- $content := partial "function-content.html" . | safeHTML -}} {{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}} -{{- $limit := and $wordLimit (not $expired) -}} - -{{- if $limit -}} - -{{- end -}} @@ -19,23 +12,10 @@ {{ partial "profile-picture.html" . }} - {{ if $limit }} - - - - - - {{ end }} {{ partial "card-meta-header.html" . }} - {{ if .Params.unsafe }} - {{ partial "card-unsafe.html" "begin" }} - {{- $content -}} - {{ partial "card-unsafe.html" "end" }} - {{ else }} - {{- $content -}} - {{ end }} + {{- $content -}} {{ partial "meta-tags.html" . }} diff --git a/themes/default/layouts/partials/card-unsafe.html b/themes/default/layouts/partials/card-unsafe.html deleted file mode 100644 index 1afbd2a..0000000 --- a/themes/default/layouts/partials/card-unsafe.html +++ /dev/null @@ -1,19 +0,0 @@ -{{- $section := . -}} - -{{ if eq $section "begin" }} - -
- -

- {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/alert-circle.svg")) }} - Danger: Unsafe Content. Click here to show/hide -

-
-
- -{{ end }} - -{{ if eq $section "end" }} - -
-{{ end }} diff --git a/themes/default/layouts/shortcodes/disclose.html b/themes/default/layouts/shortcodes/disclose.html new file mode 100644 index 0000000..fdbcc6a --- /dev/null +++ b/themes/default/layouts/shortcodes/disclose.html @@ -0,0 +1,6 @@ +{{- $text := default "Content Warning: " (.Get "text" | default (.Get 0)) -}} + +
+ {{ (or $.Page.Params.title $text) | markdownify }} +
+{{- /* This comment removes trailing newlines and white spaces. */ -}} -- cgit v1.2.3