aboutsummaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-11-18 17:33:34 -0500
committertdro <tdro@noreply.example.com>2022-11-18 17:33:34 -0500
commitd7df1c7a2850c0cff38f309882564782b49186f1 (patch)
tree45bfd493bfeadbda7d1e044b605bc18b0284c4ed /themes
parentd3e45e2a19fd66f6c807368ee9abc59b975fe4fb (diff)
downloadcanory-d7df1c7a2850c0cff38f309882564782b49186f1.tar.gz
canory-d7df1c7a2850c0cff38f309882564782b49186f1.tar.bz2
canory-d7df1c7a2850c0cff38f309882564782b49186f1.zip
themes/default/layouts/shortcodes: Generalize content warnings with disclose short code
Diffstat (limited to 'themes')
-rw-r--r--themes/default/layouts/_default/summary.html22
-rw-r--r--themes/default/layouts/partials/card-unsafe.html19
-rw-r--r--themes/default/layouts/shortcodes/disclose.html6
3 files changed, 7 insertions, 40 deletions
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 -}}
- <input hidden type="checkbox" id="expand-{{ partial "card-id.html" . }}" />
-{{- end -}}
<micro-card
id="{{ partial "card-id.html" . }}"
{{ if .Weight }}pinned{{ end }}
- {{ if $limit }}limit{{ end }}
{{ if .Draft }}draft{{ end }}
{{ if .ExpiryDate }}data-expires{{ end }}
>
@@ -19,23 +12,10 @@
{{ partial "profile-picture.html" . }}
</micro-thumbnail>
<micro-content>
- {{ if $limit }}
- <micro-overlay>
- <micro-expand>
- <label for="expand-{{ partial "card-id.html" . }}">Click to Show</label>
- </micro-expand>
- </micro-overlay>
- {{ end }}
<micro-metadata>
{{ partial "card-meta-header.html" . }}
</micro-metadata>
- {{ if .Params.unsafe }}
- {{ partial "card-unsafe.html" "begin" }}
- {{- $content -}}
- {{ partial "card-unsafe.html" "end" }}
- {{ else }}
- {{- $content -}}
- {{ end }}
+ {{- $content -}}
<micro-tags>{{ partial "meta-tags.html" . }}</micro-tags>
</micro-content>
</micro-summary>
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" }}
-<micro-unsafe>
-<details>
- <summary>
- <h1>
- {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/alert-circle.svg")) }}
- <span>Danger: Unsafe Content. <b><u>Click here</u></b> to show/hide</span>
- </h1>
- </summary>
-</details>
- <micro-unsafe-content>
-{{ end }}
-
-{{ if eq $section "end" }}
- </micro-unsafe-content>
-</micro-unsafe>
-{{ 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)) -}}
+
+<details data-disclosure>
+ <summary>{{ (or $.Page.Params.title $text) | markdownify }}</summary>
+</details>
+{{- /* This comment removes trailing newlines and white spaces. */ -}}