43 lines
1.6 KiB
HTML
43 lines
1.6 KiB
HTML
![]() |
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
|
||
|
|
||
|
{{- define "content" -}}
|
||
|
{{- $params := .Scratch.Get "params" -}}
|
||
|
<article class="page single special">
|
||
|
<div class="header">
|
||
|
{{- /* Title */ -}}
|
||
|
<h1 class="single-title animate__animated animate__pulse animate__faster">{{- .Title -}}</h1>
|
||
|
|
||
|
{{- /* Subtitle */ -}}
|
||
|
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . }}</p>{{- end -}}
|
||
|
</div>
|
||
|
|
||
|
{{- /* Content */ -}}
|
||
|
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||
|
{{- if $params.password -}}
|
||
|
{{- $saltLen := strings.RuneCount (trim $params.password "") -}}
|
||
|
{{- $saltLen = cond (eq (mod $saltLen 2) 0) (add $saltLen 1) $saltLen -}}
|
||
|
{{- $base64EncodeContent := $content | base64Encode -}}
|
||
|
{{- $content = printf "%v%v%v"
|
||
|
(substr $base64EncodeContent 0 $saltLen)
|
||
|
(substr (sha256 $params.password) $saltLen)
|
||
|
(substr $base64EncodeContent $saltLen)
|
||
|
-}}
|
||
|
{{- end -}}
|
||
|
<div
|
||
|
class="content"
|
||
|
id="content"
|
||
|
{{ with $params.password }}data-password="{{ md5 $params.password }}"{{ end }}
|
||
|
{{ with $params.password }}data-content="{{ $content }}"{{ end }}
|
||
|
>
|
||
|
{{- if not $params.password -}}
|
||
|
{{- $content -}}
|
||
|
{{- else -}}
|
||
|
{{- partial "single/fixit-decryptor.html" . -}}
|
||
|
{{- end -}}
|
||
|
</div>
|
||
|
|
||
|
{{- /* Comment */ -}}
|
||
|
{{- partial "single/comment.html" . -}}
|
||
|
</article>
|
||
|
{{- end -}}
|