blob: 5a9462dfb2037e251b10b5bf83b9a5fe7357b429 (
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 8 "" (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>
|