Format challenge #59

rust
Elnu 3 years ago
parent 7a449bb3f8
commit ed930eb714

@ -0,0 +1,7 @@
---
date: 2022-04-12
---
This week's challenge is open-ended! **Write down your favorite thing about spring** and submit it; it can be as short or long as you like. (If you're feeling adventurous, draw it as well, perhaps? :cherry_blossom:)
Depending on how this goes, we me have more open-ended challenges in the future, we'll see...

@ -14,10 +14,60 @@
<h3>Tegaki Tuesday #{{- $current -}}</h3> <h3>Tegaki Tuesday #{{- $current -}}</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> <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> </header>
<div id="challenge-container"> {{ if or (.Params.japanese) (.Params.english) }}
<div id="challenge-horizontal"> <div id="challenge-container">
<div id="challenge-vocab" lang="ja"> <div id="challenge-horizontal">
<!-- Vocab view --> <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 and (not .dictionary) (not .pos) -}}
{{- $.Scratch.Get "html" | safeHTML -}}
{{- else -}}
<a href="https://jisho.org/word/{{- $.Scratch.Get "dictionary" -}}" class="{{- .pos -}}" title="{{- .pos -}}" target="_blank">{{- $.Scratch.Get "html" | safeHTML -}}</a>
{{- end -}}
{{- end -}}</p>
{{- end -}}
{{- end -}}
</div>
<div id="challenge-english">
<!-- English view -->
{{- range.Params.english -}}
<p>{{- $.RenderString . -}}</p>
{{- end -}}
</div>
</div>
<div id="challenge-kanji" lang="ja">
<!-- Kanji view -->
<!-- Outer list: lines --> <!-- Outer list: lines -->
{{- range.Params.japanese -}} {{- range.Params.japanese -}}
<!-- Inner list: sublines --> <!-- Inner list: sublines -->
@ -25,72 +75,24 @@
<!-- Innermost list: words --> <!-- Innermost list: words -->
<p>{{- range. -}} <p>{{- range. -}}
{{- if eq (printf "%T" .text) "string" -}} {{- if eq (printf "%T" .text) "string" -}}
{{- $.Scratch.Set "dictionary" .text -}} {{- .text -}}
{{- $.Scratch.Set "html" .text -}}
{{- else -}} {{- else -}}
{{- $.Scratch.Set "dictionary" "" -}}
{{- $.Scratch.Set "html" "" -}}
{{- range.text -}} {{- range.text -}}
{{- if reflect.IsMap . -}} {{- if reflect.IsMap . -}}
{{- range $kanji, $furigana := . -}} {{- range $kanji, $furigana := . -}}
{{- $.Scratch.Add "dictionary" $kanji -}} <a href="https://jisho.org/search/{{- $kanji -}} #kanji" target="_blank"><ruby>{{- $kanji -}}<rp>(</rp><rt>{{- $furigana -}}</rt><rp>)</rp></ruby></a>
{{- $.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 -}} {{- end -}}
{{- else -}} {{- else -}}
{{- $.Scratch.Add "dictionary" . -}} {{- . -}}
{{- $.Scratch.Add "html" . -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- if .dictionary -}}
{{- $.Scratch.Set "dictionary" .dictionary -}}
{{- end -}}
{{- if and (not .dictionary) (not .pos) -}}
{{- $.Scratch.Get "html" | safeHTML -}}
{{- else -}}
<a href="https://jisho.org/word/{{- $.Scratch.Get "dictionary" -}}" class="{{- .pos -}}" title="{{- .pos -}}" target="_blank">{{- $.Scratch.Get "html" | safeHTML -}}</a>
{{- end -}}
{{- end -}}</p> {{- end -}}</p>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
</div> </div>
<div id="challenge-english">
<!-- English view -->
{{- range.Params.english -}}
<p>{{- $.RenderString . -}}</p>
{{- end -}}
</div>
</div>
<div id="challenge-kanji" lang="ja">
<!-- 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 -}} #kanji" target="_blank"><ruby>{{- $kanji -}}<rp>(</rp><rt>{{- $furigana -}}</rt><rp>)</rp></ruby></a>
{{- end -}}
{{- else -}}
{{- . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}</p>
{{- end -}}
{{- end -}}
</div> </div>
</div> {{ end }}
</div> </div>
<div class="content"> <div class="content">
{{- partial "content.html" . -}} {{- partial "content.html" . -}}

Loading…
Cancel
Save