tegakituesday.com/themes/tegakituesday.com/layouts/challenges/single.html
2023-01-18 01:10:33 -08:00

137 lines
5.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{- 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" . -}}
<div id="challenge">
<div>
{{ if not .Params.override }}
<button id="direction" title="Text direction"></button>
<button lang="ja" id="highlight" title="Vocab/kanji links">漢字</button>
{{ end }}
<button lang="ja" id="kyujitai" title="Shinjitai/kyujitai">旧字体</button>
{{ if .Params.english }}
<button id="english" title="Show/hide translation">Show translation</button>
{{ end }}
<a id="kyujitai-info" target="_blank" class="clickable-icon" href="https://en.wikipedia.org/wiki/Ky%C5%ABjitai"><svg class="svg-inline" aria-hidden="true" focusable="false" data-prefix="fas" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM288 352c0 17.7-14.3 32-32 32s-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32z"></path></svg></a>
<header>
<h3><a href="/">Tegaki Tuesday</a> #{{- $current -}}{{ if .Params.embellishment }} {{ end }}{{ .Params.embellishment | markdownify | emojify }}</h3>
<small><ruby><rp>(</rp><rt></rt><rp>)</rp></ruby><ruby><rp>(</rp><rt></rt><rp>)</rp></ruby>きの<ruby><rp>(</rp><rt></rt><rp>)</rp></ruby><ruby><rp>(</rp><rt>よう</rt><rp>)</rp></ruby><ruby><rp>(</rp><rt></rt><rp>)</rp></ruby>{{- $current -}}・<time datetime="{{- .Date.Format " 2006-01-02T15:04:05Z07:00" -}}">{{- .Date.Format "2006年01月02日" -}}</time></small>
</header>
{{ if .Params.override }}
<div>
{{ .Params.override | safeHTML }}
</div>
{{ else }}
{{ if .Params.english }}
<div id="challenge-english" style="display: none">
<!-- English view -->
{{- range.Params.english -}}
<p>{{- $.RenderString . -}}</p>
{{- end -}}
<br>
</div>
{{ end }}
<div id="challenge-vocab" lang="ja">
<!-- Vocab view -->
<!-- Outer list: lines -->
{{- range.Params.japanese -}}
<!-- Inner list: sublines -->
{{- range. -}}
<!-- Innermost list: words -->
<p>{{- 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" "<ruby>" -}}
{{- $.Scratch.Add "html" $kanji -}}
{{- $.Scratch.Add "html" "<rp>(</rp><rt>" -}}
{{- $.Scratch.Add "html" $furigana -}}
{{- $.Scratch.Add "html" "</rt><rp>)</rp></ruby>" -}}
{{- 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 -}}
<a href="{{- $.Scratch.Get "dictionary" -}}" class="{{- .pos -}}" title="{{- .pos -}}" target="_blank">{{- $.Scratch.Get "html" | safeHTML -}}</a>
{{- end -}}
{{- end -}}</p>
{{- end -}}
{{- end -}}
</div>
<div id="challenge-kanji" lang="ja" style="display: none">
<!-- Kanji view -->
<!-- Outer list: lines -->
{{- range.Params.japanese -}}
<!-- Inner list: sublines -->
{{- range. -}}
<!-- Innermost list: words -->
<p>{{- range. -}}
{{- if eq (printf "%T" .text) "string" -}}
{{- .text -}}
{{- else -}}
{{- range.text -}}
{{- if reflect.IsMap . -}}
{{- range $kanji, $furigana := . -}}
<a href="https://jisho.org/search/{{- $kanji -}} %23kanji" target="_blank"><ruby>{{- $kanji | safeHTML -}}<rp>(</rp><rt>{{- $furigana | safeHTML -}}</rt><rp>)</rp></ruby></a>
{{- end -}}
{{- else -}}
{{- . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}</p>
{{- end -}}
{{- end -}}
</div>
{{ end }}
<script src="/js/toggle.js"></script>
</div>
</div>
<div class="content">
{{- partial "content.html" . -}}
</div>
{{- end -}}
{{- define "secondary" -}}
{{- $current := replaceRE `[^0-9]` "" .File -}}
<div id="submissions">
{{- range index .Site.Data.challenges ($current) -}}
{{- $submission := . -}}
{{- range.images -}}
{{- $path := printf "%s" . | printf "%s%s" "/" | printf "%s%s" $current | printf "%s" -}}
{{- $image := resources.Get $path -}}
{{- partial "submission.html" (dict "submission" $submission "challenge" $current "image" $image) -}}
{{- end -}}
{{- end -}}
</div>
{{- end -}}
{{- define "secondaryFooter" -}}
{{- partial "footer.html" (partial "footers/submissions.html" .) -}}
{{- end -}}