{{- define "head" -}} {{- $current := replaceRE `[^0-9]` "" .File -}} {{- .Scratch.Set "title" .Site.Title -}} {{- .Scratch.Add "title" " #" -}} {{- .Scratch.Add "title" (replaceRE `[^0-9]` "" .File) -}} {{- partial "head.html" . -}} {{- end -}} {{- define "primary" -}} {{- $current := replaceRE `[^0-9]` "" .File -}} {{- partial "nav.html" . -}}
{{- $.RenderString . -}}
{{- end -}}{{- range. -}} {{- if eq (printf "%T" .text) "string" -}} {{- $.Scratch.Set "dictionary" .text -}} {{- $.Scratch.Set "html" .text -}} {{- else -}} {{- $.Scratch.Set "dictionary" "" -}} {{- $.Scratch.Set "html" "" -}} {{- range.text -}} {{- if reflect.IsMap . -}} {{- range $kanji, $furigana := . -}} {{- $.Scratch.Add "dictionary" $kanji -}} {{- $.Scratch.Add "html" "" -}} {{- $.Scratch.Add "html" $kanji -}} {{- $.Scratch.Add "html" "" -}} {{- end -}} {{- else -}} {{- $.Scratch.Add "dictionary" . -}} {{- $.Scratch.Add "html" . -}} {{- end -}} {{- end -}} {{- end -}} {{ if .dictionary }} {{- $.Scratch.Set "dictionary" .dictionary -}} {{ end }} {{- if not (and .dictionary (hasPrefix .dictionary "http")) -}} {{- $.Scratch.Set "dictionary" (printf "%s" ($.Scratch.Get "dictionary") | printf "%s%s" "https://jisho.org/word/" | printf "%s") -}} {{- end -}} {{- if and (not .dictionary) (not .pos) -}} {{- $.Scratch.Get "html" | safeHTML -}} {{- else -}} {{- $.Scratch.Get "html" | safeHTML -}} {{- end -}} {{- end -}}
{{- end -}} {{- end -}}