blob: 9c5e59af41f8911166d52c7fe6b7d80dc9e71ffc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
{{- $text := default "This is a spoiler." (.Get "text" | default (.Get 0)) -}}
{{- $title := default "Click to show/hide text." (.Get "title" | default (.Get 1)) -}}
{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $text)) .Ordinal -}}
{{- if gt (len .Inner) 1 -}}
{{- $text = .Inner -}}
{{- end -}}
<input hidden="" type="checkbox" id="spoiler-text-{{ $hash }}" />
<s title="{{ $title }}">
<label for="spoiler-text-{{ $hash }}">{{ $text | markdownify }}</label>
</s>
|