Japanese flashcards!

This commit is contained in:
Eryn Wells 2023-03-13 21:06:45 -07:00
parent 533bc1138c
commit 78bd1e4a4e
13 changed files with 315 additions and 38 deletions

View file

@ -3,30 +3,9 @@
{{ end }}
{{ define "styles" }}
{{- range .Resources.Match "*.css" -}}
{{- $stylesheet := . | fingerprint "md5" }}
<link rel="stylesheet" href="{{ $stylesheet.RelPermalink }}"></script>
{{- end -}}
{{ partial "single_styles.html" . }}
{{ end }}
{{ define "scripts" }}
{{- if .HasShortcode "figures/railroad" -}}
{{- with partial "resources/railroad_utils.html" . -}}
<script defer type="module" src="{{ .RelPermalink }}"></script>
{{- end -}}
{{- end -}}
{{- if .HasShortcode "figures/p5" -}}
{{- with partial "secure_asset.html" "scripts/lib/p5-1.5.0.js" -}}
<script defer src="{{ .Secure.RelPermalink }}"></script>
{{- end -}}
{{- with partial "secure_asset.html" "scripts/sketch-utils.js" -}}
<script defer src="{{ .Secure.RelPermalink }}"></script>
{{- end -}}
{{- end -}}
{{- range $script := .Resources.Match "*.js" -}}
{{- $isModule := default true $script.Params.is_module -}}
<script defer {{ if $isModule }}type="module"{{ end }} src="{{ $script.Permalink | relURL }}"></script>
{{- end -}}
{{ partial "single_scripts.html" . }}
{{ end }}

View file

@ -0,0 +1,25 @@
{{ define "main" }}
{{ partial "content_header.html" . }}
<nav class="languages">
{{ range .AllTranslations }}
<a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
{{ end }}
</nav>
<section class="flashcards">
<div class="shadow left"></div>
<div class="shadow right"></div>
<ul></ul>
</section>
{{ end }}
{{ define "styles" }}
{{ partial "single_styles.html" . }}
{{ end }}
{{ define "scripts" }}
{{- $flashcards := index $.Site.Data.nihongo.flashcards "all" -}}
<script>
const flashcards = {{ $flashcards | jsonify | safeJS }};
</script>
{{ partial "single_scripts.html" . }}
{{ end }}

View file

@ -2,7 +2,7 @@
{{ partial "development/draft_tag.html" . }}
<div class="post-title">
<h1>{{ .Title }}</h1>
{{ if not (eq .Section "about") }}
{{ if and (not (eq .Section "about")) .Date }}
<div class="post-date"><time>{{ .Date | time.Format "January 2, 2006" }}</time></div>
{{ end }}
</div>

View file

@ -1,12 +1,19 @@
{{ if .Page.Scratch.Get "includes_railroad_diagram" }}
<script defer type="module" src="{{ `scripts/railroad.js` | absURL }}"></script>
<script defer type="module" src="{{ `scripts/railroad-utils.js` | absURL }}"></script>
{{ end }}
{{ if .Page.Scratch.Get "includes_p5_sketch" }}
<script defer src="{{ `scripts/p5-1.4.1.min.js` | absURL }}"></script>
<script defer src="{{ `scripts/sketch-utils.js` | absURL }}"></script>
{{ end }}
{{ range $script := .Resources.Match "*.js" }}
{{ $isModule := default true $script.Params.is_module }}
<script defer {{ if $isModule }}type="module"{{ end }} src="{{ $script.Permalink | relURL }}"></script>
{{ end }}
{{- if .HasShortcode "figures/railroad" -}}
{{- with partial "resources/railroad_utils.html" . -}}
<script defer type="module" src="{{ .RelPermalink }}"></script>
{{- end -}}
{{- end -}}
{{- if .HasShortcode "figures/p5" -}}
{{- with partial "secure_asset.html" "scripts/lib/p5-1.5.0.js" -}}
<script defer src="{{ .Secure.RelPermalink }}"></script>
{{- end -}}
{{- with partial "secure_asset.html" "scripts/sketch-utils.js" -}}
<script defer src="{{ .Secure.RelPermalink }}"></script>
{{- end -}}
{{- end -}}
{{- range $script := .Resources.Match "*.js" -}}
{{- $isModule := default true $script.Params.is_module -}}
<script defer {{ if $isModule }}type="module"{{ end }} src="{{ $script.Permalink | relURL }}"></script>
{{- end -}}

View file

@ -0,0 +1,4 @@
{{- range .Resources.Match "*.css" -}}
{{- $stylesheet := . | fingerprint "md5" }}
<link rel="stylesheet" href="{{ $stylesheet.RelPermalink }}"></script>
{{- end -}}