{{- 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" . -}}
{{- 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 and (not .dictionary) (not .pos) -}} {{- $.Scratch.Get "html" | safeHTML -}} {{- else -}} {{- $.Scratch.Get "html" | safeHTML -}} {{- end -}} {{- end -}}
{{- end -}} {{- end -}}{{- $.RenderString . -}}
{{- end -}}{{- range. -}} {{- if eq (printf "%T" .text) "string" -}} {{- .text -}} {{- else -}} {{- range.text -}} {{- if reflect.IsMap . -}} {{- range $kanji, $furigana := . -}} {{- $kanji -}} {{- end -}} {{- else -}} {{- . -}} {{- end -}} {{- end -}} {{- end -}} {{- end -}}
{{- end -}} {{- end -}}