@taekwondo-db/web-app 0.0.0-stage → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +297 -2
  3. package/assets/css/abstracts/base.css +54 -0
  4. package/assets/css/abstracts/variables.css +125 -0
  5. package/assets/css/components/breadcrumb.css +14 -0
  6. package/assets/css/components/card.css +35 -0
  7. package/assets/css/components/categories.css +200 -0
  8. package/assets/css/components/detail.css +591 -0
  9. package/assets/css/components/grade.css +79 -0
  10. package/assets/css/components/header.css +131 -0
  11. package/assets/css/components/language.css +38 -0
  12. package/assets/css/components/layout.css +151 -0
  13. package/assets/css/components/link.css +26 -0
  14. package/assets/css/components/result.css +123 -0
  15. package/assets/css/components/search.css +193 -0
  16. package/assets/css/components/tag.css +137 -0
  17. package/assets/css/style.css +17 -0
  18. package/assets/fonts/noto-serif-kr.css +28 -0
  19. package/assets/js/email.js +11 -0
  20. package/assets/js/gallery.js +30 -0
  21. package/assets/js/language.js +11 -0
  22. package/assets/js/main.js +17 -0
  23. package/assets/js/pwa.js +48 -0
  24. package/assets/js/search.js +276 -0
  25. package/assets/js/sorting.js +26 -0
  26. package/bin/taekwondo-db.js +145 -0
  27. package/content/_content.gotmpl +27 -0
  28. package/hugo.toml +32 -0
  29. package/i18n/de.json +107 -0
  30. package/i18n/en.json +107 -0
  31. package/i18n/ko.json +107 -0
  32. package/layouts/404.html +23 -0
  33. package/layouts/_partials/breadcrumb.html +11 -0
  34. package/layouts/_partials/categories.html +17 -0
  35. package/layouts/_partials/category-cards.html +36 -0
  36. package/layouts/_partials/category-group.html +7 -0
  37. package/layouts/_partials/category-section.html +15 -0
  38. package/layouts/_partials/category-tile.html +4 -0
  39. package/layouts/_partials/description.html +10 -0
  40. package/layouts/_partials/email.html +6 -0
  41. package/layouts/_partials/favicons.html +42 -0
  42. package/layouts/_partials/fonts.html +33 -0
  43. package/layouts/_partials/grade-badge.html +11 -0
  44. package/layouts/_partials/grade-name.html +14 -0
  45. package/layouts/_partials/head.html +17 -0
  46. package/layouts/_partials/header.html +38 -0
  47. package/layouts/_partials/historic.html +23 -0
  48. package/layouts/_partials/icon.html +13 -0
  49. package/layouts/_partials/language-label.html +3 -0
  50. package/layouts/_partials/language.html +13 -0
  51. package/layouts/_partials/page-title.html +13 -0
  52. package/layouts/_partials/scripts.html +25 -0
  53. package/layouts/_partials/search-form.html +11 -0
  54. package/layouts/_partials/search-index.html +40 -0
  55. package/layouts/_partials/source-entry.html +13 -0
  56. package/layouts/_partials/t.html +2 -0
  57. package/layouts/_partials/technique/photo.html +45 -0
  58. package/layouts/_partials/technique/word-meaning.html +33 -0
  59. package/layouts/_partials/technique-name.html +5 -0
  60. package/layouts/_partials/technique-row.html +17 -0
  61. package/layouts/_partials/term/list.html +24 -0
  62. package/layouts/_partials/term-name.html +4 -0
  63. package/layouts/_partials/url.html +11 -0
  64. package/layouts/_shortcodes/email.html +2 -0
  65. package/layouts/_shortcodes/operator.html +18 -0
  66. package/layouts/baseof.html +39 -0
  67. package/layouts/group/page.html +24 -0
  68. package/layouts/groups.html +48 -0
  69. package/layouts/home.html +19 -0
  70. package/layouts/page.html +17 -0
  71. package/layouts/source/page.html +67 -0
  72. package/layouts/technique/page.html +160 -0
  73. package/layouts/term/page.html +97 -0
  74. package/lib/database.js +33 -0
  75. package/lib/export.js +423 -0
  76. package/lib/service-worker.js +167 -0
  77. package/lib/validate.js +179 -0
  78. package/package.json +42 -5
@@ -0,0 +1,6 @@
1
+ {{- /*
2
+ An email address kept from simple harvesters: the page holds it Base64-
3
+ encoded and assets/js/email.js turns it into a link; without JavaScript it
4
+ reads "name [at] domain". Entities would not do: the minifier decodes them.
5
+ */ -}}
6
+ <a data-email="{{ base64Encode . }}">{{ replace . "@" " [at] " }}</a>
@@ -0,0 +1,42 @@
1
+ {{- /*
2
+ The icon set in the site's assets/<params.favicon>/ — the file names favicon
3
+ generators produce. Copied to the root unhashed, since browsers request
4
+ /favicon.ico on their own. The android-chrome-* files go into the manifest.
5
+ */ -}}
6
+ {{- $links := slice
7
+ (dict "name" "favicon.ico" "rel" "icon" "sizes" "any")
8
+ (dict "name" "favicon-32x32.png" "rel" "icon" "sizes" "32x32" "type" "image/png")
9
+ (dict "name" "favicon-16x16.png" "rel" "icon" "sizes" "16x16" "type" "image/png")
10
+ (dict "name" "favicon.svg" "rel" "icon" "type" "image/svg+xml")
11
+ (dict "name" "apple-touch-icon.png" "rel" "apple-touch-icon" "sizes" "180x180")
12
+ -}}
13
+ {{- $manifestIcons := slice -}}
14
+ {{- with site.Params.favicon -}}
15
+ {{- $dir := . -}}
16
+ {{- range $link := $links -}}
17
+ {{- with resources.Get (printf "%s/%s" $dir $link.name) -}}
18
+ {{- $icon := resources.Copy $link.name . }}
19
+ <link rel="{{ $link.rel }}" href="{{ $icon.RelPermalink }}"{{ with $link.sizes }} sizes="{{ . }}"{{ end }}{{ with $link.type }} type="{{ . }}"{{ end }}>
20
+ {{- end -}}
21
+ {{- end -}}
22
+ {{- range slice "192x192" "512x512" -}}
23
+ {{- $size := . -}}
24
+ {{- with resources.Get (printf "%s/android-chrome-%s.png" $dir $size) -}}
25
+ {{- $icon := resources.Copy (printf "android-chrome-%s.png" $size) . -}}
26
+ {{- $manifestIcons = $manifestIcons | append (dict "sizes" $size "src" (strings.TrimPrefix "/" $icon.RelPermalink) "type" "image/png") -}}
27
+ {{- end -}}
28
+ {{- end -}}
29
+ {{- end -}}
30
+
31
+ {{- $manifest := dict
32
+ "background_color" "#f5f5f2"
33
+ "display" "standalone"
34
+ "icons" $manifestIcons
35
+ "lang" site.Language.Lang
36
+ "name" site.Title
37
+ "short_name" site.Title
38
+ "start_url" (relLangURL "")
39
+ -}}
40
+ {{- with resources.FromString (printf "manifest.%s.webmanifest" site.Language.Lang) (jsonify $manifest) }}
41
+ <link rel="manifest" href="{{ .RelPermalink }}" crossorigin="use-credentials">
42
+ {{- end }}
@@ -0,0 +1,33 @@
1
+ {{- /*
2
+ Fonts under stable URLs in /fonts/, apart from the CSS bundle, so the head
3
+ can preload them. With the preload they are there before the first paint,
4
+ and `font-display: optional` keeps the browser from swapping fonts after it —
5
+ each page is a document of its own, and a swap would flicker on every
6
+ navigation. The Hangeul font only where Hangeul is shown, see noto-serif-kr.css.
7
+ */ -}}
8
+ {{- range resources.Match "fonts/*.woff2" }}{{ .Publish }}{{ end -}}
9
+
10
+ {{- $preload := slice
11
+ "fonts/ibm-plex-sans-latin-400-normal.woff2"
12
+ "fonts/ibm-plex-sans-latin-500-normal.woff2"
13
+ "fonts/ibm-plex-sans-latin-600-normal.woff2"
14
+ "fonts/ibm-plex-sans-latin-700-normal.woff2"
15
+ -}}
16
+ {{- /* 1 MB — only where Hangeul is shown. */ -}}
17
+ {{- if or (eq site.Language.Lang "ko") (in (slice "technique" "term") .Section) (eq .Kind "404") -}}
18
+ {{- $preload = $preload | append "fonts/noto-serif-kr-korean-500-normal.woff2" -}}
19
+ {{- end -}}
20
+ {{- if eq site.Language.Lang "ko" -}}
21
+ {{- $preload = $preload | append "fonts/noto-serif-kr-korean-700-normal.woff2" -}}
22
+ {{- end -}}
23
+ {{- range $preload }}{{ with resources.Get . }}
24
+ <link rel="preload" href="{{ .RelPermalink }}" as="font" type="font/woff2" crossorigin>
25
+ {{- end }}{{ end }}
26
+
27
+ {{- $sheets := slice -}}
28
+ {{- range slice "fonts/ibm-plex-sans-400.css" "fonts/ibm-plex-sans-500.css" "fonts/ibm-plex-sans-600.css" "fonts/ibm-plex-sans-700.css" "fonts/noto-serif-kr.css" -}}
29
+ {{- with resources.Get . }}{{ $sheets = $sheets | append . }}{{ end -}}
30
+ {{- end -}}
31
+ {{- with resources.Concat "fonts/fonts.css" $sheets | minify | fingerprint }}
32
+ <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}">
33
+ {{- end }}
@@ -0,0 +1,11 @@
1
+ {{- /*
2
+ "from 9th Kup" with the belt colour, for a technique key; nothing when the
3
+ site assigns the technique to no grade. The colours live in
4
+ assets/css/components/grade.css, keyed by `data-grade`.
5
+ */ -}}
6
+ {{- with (index hugo.Data.taekwondo.techniques .).grade -}}
7
+ <span class="grade-badge" data-grade="{{ . }}">
8
+ <span class="grade-badge__belt" aria-hidden="true"></span>
9
+ {{- T "from grade" (dict "Grade" (partial "grade-name.html" .)) -}}
10
+ </span>
11
+ {{- end -}}
@@ -0,0 +1,14 @@
1
+ {{- /*
2
+ The name of a grade key ("9-kup") in the current language — "9. Kup",
3
+ "9th Kup", "9급". The i18n strings get the level as a number and as an
4
+ English ordinal, so each language picks what it needs.
5
+ */ -}}
6
+ {{- $grade := index (where hugo.Data.taekwondo.grades "key" .) 0 -}}
7
+ {{- $level := int $grade.level -}}
8
+ {{- $suffix := "th" -}}
9
+ {{- $tens := mod $level 100 -}}
10
+ {{- if or (lt $tens 11) (gt $tens 13) -}}
11
+ {{- $ones := mod $level 10 -}}
12
+ {{- if eq $ones 1 }}{{ $suffix = "st" }}{{ else if eq $ones 2 }}{{ $suffix = "nd" }}{{ else if eq $ones 3 }}{{ $suffix = "rd" }}{{ end -}}
13
+ {{- end -}}
14
+ {{- return T (printf "grade %s" $grade.kind) (dict "Level" $level "Ordinal" (printf "%d%s" $level $suffix)) -}}
@@ -0,0 +1,17 @@
1
+ <meta charset="UTF-8">
2
+ <meta name="viewport" content="width=device-width, initial-scale=1">
3
+ <title>{{ with partial "page-title.html" . }}{{ . }} · {{ end }}{{ site.Title }}</title>
4
+
5
+ {{- if gt (len hugo.Sites) 1 }}
6
+ {{- range .Rotate "language" }}
7
+ <link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}">
8
+ {{- end }}
9
+ {{- end }}
10
+
11
+ {{- partial "fonts.html" . }}
12
+
13
+ {{- with resources.Get "css/style.css" | css.Build (dict "minify" hugo.IsProduction) | fingerprint }}
14
+ <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}">
15
+ {{- end }}
16
+
17
+ {{- partial "favicons.html" . }}
@@ -0,0 +1,38 @@
1
+ {{- $multilingual := gt (len hugo.Sites) 1 -}}
2
+ {{- /* The home and 404 pages carry the large search field themselves. */ -}}
3
+ {{- $compactSearch := not (or .IsHome (eq .Kind "404")) -}}
4
+ <header class="site-header">
5
+ <div class="site-header__inner">
6
+ <a class="site-brand" href="{{ relLangURL "" }}">
7
+ {{- with site.Params.logo }}{{ with resources.Get . }}
8
+ <img src="{{ .RelPermalink }}" alt="{{ site.Params.logoAlt | default site.Title }}" class="app-logo">
9
+ {{- end }}{{ end }}
10
+ <span>{{ site.Title }}</span>
11
+ </a>
12
+
13
+ {{- if or $compactSearch $multilingual }}
14
+ <div class="site-header__end">
15
+ {{- if $compactSearch }}
16
+ <button type="button" class="search-field search-field--compact search-trigger" aria-haspopup="dialog" data-search-open hidden>
17
+ {{ partial "icon.html" (dict "name" "search" "size" 18) }}
18
+ <span>{{ T "search placeholder short" }}</span>
19
+ </button>
20
+ <dialog class="search-dialog" aria-label="{{ T "search" }}">
21
+ <div class="search-dialog__panel stack" data-search>
22
+ <div class="search-dialog__bar">
23
+ {{ partial "search-form.html" (dict "id" "app-search-dialog-input") }}
24
+ <button type="button" class="search-dialog__close" aria-label="{{ T "close" }}" data-search-close>
25
+ {{- partial "icon.html" (dict "name" "clear" "size" 22) -}}
26
+ </button>
27
+ </div>
28
+ <div class="search-results" data-search-results hidden></div>
29
+ </div>
30
+ </dialog>
31
+ {{- end }}
32
+ {{- if $multilingual }}
33
+ {{ partial "language.html" . }}
34
+ {{- end }}
35
+ </div>
36
+ {{- end }}
37
+ </div>
38
+ </header>
@@ -0,0 +1,23 @@
1
+ {{- /* A historical name: Hangeul, each romanisation with its system, then where it is recorded. */ -}}
2
+ {{- $sources := hugo.Data.taekwondo.sources -}}
3
+ {{- $known := slice -}}
4
+ {{- range .sources -}}{{- if index $sources .key -}}{{- $known = $known | append . -}}{{- end -}}{{- end -}}
5
+ <div class="historic">
6
+ <div class="historic__names">
7
+ <span><b>{{ .rr }}</b> <span class="romanization">{{ T "revised romanization" }}</span></span>
8
+ <span><b>{{ .name }}</b> <span class="romanization">{{ T "mccune reischauer" }}</span></span>
9
+ <span class="hangeul" lang="ko">{{ .hangeul }}{{ with .hanja }} · {{ . }}{{ end }}</span>
10
+ </div>
11
+ <p class="romanization mb-0">
12
+ {{- if not $known -}}
13
+ {{ T "missing source" }}
14
+ {{- else -}}
15
+ {{- range $i, $citation := $known -}}
16
+ {{- $source := index $sources $citation.key -}}
17
+ {{- if $i }}, {{ end -}}
18
+ <a href="{{ partial "url.html" (dict "kind" "source" "key" $citation.key) }}">{{ $source.author | default $source.title }} {{ $source.year }}</a>
19
+ {{- with $citation.page }}, {{ T "page" }} {{ . }}{{ end -}}
20
+ {{- end -}}
21
+ {{- end -}}
22
+ </p>
23
+ </div>
@@ -0,0 +1,13 @@
1
+ {{- /* Decorative line icons; every one sits next to a text label. dict "name" … "size" … */ -}}
2
+ {{- $size := .size | default 18 -}}
3
+ {{- if eq .name "play" -}}
4
+ <svg class="icon" width="{{ $size }}" height="{{ $size }}" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7z"></path></svg>
5
+ {{- else -}}
6
+ <svg class="icon" width="{{ $size }}" height="{{ $size }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
7
+ {{- if eq .name "chevron" }}<path d="m9 6 6 6-6 6"></path>
8
+ {{- else if eq .name "search" }}<circle cx="11" cy="11" r="7"></circle><path d="m20 20-4-4"></path>
9
+ {{- else if eq .name "clear" }}<path d="M6 6l12 12M18 6 6 18"></path>
10
+ {{- else if eq .name "external" }}<path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"></path>
11
+ {{- end -}}
12
+ </svg>
13
+ {{- end -}}
@@ -0,0 +1,3 @@
1
+ {{- /* The language's own name — "Deutsch", not "de". Set `label` in the language config for others. */ -}}
2
+ {{- $known := dict "de" "Deutsch" "en" "English" "ko" "한국어" -}}
3
+ {{- return (or .Label (index $known .Lang) .Lang) -}}
@@ -0,0 +1,13 @@
1
+ {{- /*
2
+ Language chooser. A select rather than a row of buttons: a site may carry as
3
+ many languages as it cares to configure. Every option leads to the same page
4
+ in the other language.
5
+ */ -}}
6
+ <div class="lang-select">
7
+ <label class="visually-hidden-label" for="app-language">{{ T "language" }}</label>
8
+ <select id="app-language" data-language-select>
9
+ {{- range .Rotate "language" }}
10
+ <option value="{{ .RelPermalink }}"{{ if eq .Language.Lang site.Language.Lang }} selected{{ end }}>{{ partial "language-label.html" .Language }}</option>
11
+ {{- end }}
12
+ </select>
13
+ </div>
@@ -0,0 +1,13 @@
1
+ {{- /* The name of a page in the current language; "" for the home page. */ -}}
2
+ {{- $db := hugo.Data.taekwondo -}}
3
+ {{- $title := "" -}}
4
+ {{- $key := .Params.key -}}
5
+ {{- if eq .Section "technique" -}}{{- $title = partial "technique-name.html" $key -}}
6
+ {{- else if eq .Section "term" -}}{{- $title = partial "term-name.html" $key -}}
7
+ {{- else if eq .Section "source" -}}{{- $title = (index $db.sources $key).title -}}
8
+ {{- else if eq .Section "group" -}}{{- $title = partial "t.html" $key -}}
9
+ {{- else if eq .Kind "404" -}}{{- $title = T "page not found" -}}
10
+ {{- else if eq .Layout "groups" -}}{{- $title = T "techniques" -}}
11
+ {{- else if not .IsHome -}}{{- $title = .Title -}}
12
+ {{- end -}}
13
+ {{- return $title -}}
@@ -0,0 +1,25 @@
1
+ {{- /*
2
+ Every page works without JavaScript. The script adds the search, the image
3
+ gallery, the sorting switch, the language select and offline support.
4
+ */ -}}
5
+ {{- $homes := slice -}}
6
+ {{- range hugo.Sites }}{{ $homes = $homes | append .Home.RelPermalink }}{{ end -}}
7
+ {{- $config := dict
8
+ "home" (relLangURL "")
9
+ "homes" $homes
10
+ "searchIndex" (partialCached "search-index.html" . site.Language.Lang).RelPermalink
11
+ "serviceWorker" (cond hugo.IsProduction (relURL "sw.js") "")
12
+ "t" (dict
13
+ "all" (T "all")
14
+ "filterResults" (T "filter results")
15
+ "noResults" (T "no results")
16
+ "techniques" (T "techniques")
17
+ "term" (T "term")
18
+ "terms" (T "terms")
19
+ "updateAvailable" (T "update available")
20
+ )
21
+ -}}
22
+ <script type="application/json" id="app-config">{{ jsonify $config | safeJS }}</script>
23
+ {{- with resources.Get "js/main.js" | js.Build (dict "minify" hugo.IsProduction "format" "esm" "target" "es2021") | fingerprint }}
24
+ <script type="module" src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}"></script>
25
+ {{- end }}
@@ -0,0 +1,11 @@
1
+ {{- /* dict "id" … — without JavaScript the form still leads to the home page with ?search=. */ -}}
2
+ <form class="search-form" role="search" action="{{ relLangURL "" }}" method="get">
3
+ <label class="visually-hidden-label" for="{{ .id }}">{{ T "search" }}</label>
4
+ <div class="search-field">
5
+ {{ partial "icon.html" (dict "name" "search" "size" 22) }}
6
+ <input id="{{ .id }}" name="search" type="search" autocomplete="off" placeholder="{{ T "search placeholder" }}">
7
+ <button type="button" class="search-clear" aria-label="{{ T "clear input" }}" data-search-clear hidden>
8
+ {{- partial "icon.html" (dict "name" "clear") -}}
9
+ </button>
10
+ </div>
11
+ </form>
@@ -0,0 +1,40 @@
1
+ {{- /*
2
+ The search index of the current language as a fingerprinted JSON resource:
3
+ everything the search matches on and everything a result row shows.
4
+ Cached per language — see scripts.html.
5
+ */ -}}
6
+ {{- $db := hugo.Data.taekwondo -}}
7
+ {{- $lang := site.Language.Lang -}}
8
+ {{- $korean := eq $lang "ko" -}}
9
+ {{- $techniques := slice -}}
10
+ {{- range $key, $t := $db.techniques -}}
11
+ {{- $translation := index $t.translation $lang | default "" -}}
12
+ {{- $grade := "" -}}
13
+ {{- with $t.grade }}{{ $grade = T "from grade" (dict "Grade" (partial "grade-name.html" .)) }}{{ end -}}
14
+ {{- $techniques = $techniques | append (dict
15
+ "name" $key
16
+ "supplementaryName" $t.supplementaryName
17
+ "translation" $translation
18
+ "display" (partial "technique-name.html" $key)
19
+ "subtitle" (cond $korean "" $translation)
20
+ "tag" (partial "t.html" $t.group)
21
+ "group" (partial "category-group.html" $t.group)
22
+ "generic" (cond $t.generic (T "generic") "")
23
+ "grade" $t.grade
24
+ "gradeLabel" $grade
25
+ "url" (partial "url.html" (dict "kind" "technique" "key" $key))
26
+ ) -}}
27
+ {{- end -}}
28
+ {{- $terms := slice -}}
29
+ {{- range $key, $t := $db.terms -}}
30
+ {{- $description := index $t.plain $lang | default "" -}}
31
+ {{- $terms = $terms | append (dict
32
+ "name" $key
33
+ "description" $description
34
+ "display" (partial "term-name.html" $key)
35
+ "subtitle" (cond $korean "" $description)
36
+ "url" (partial "url.html" (dict "kind" "term" "key" $key))
37
+ ) -}}
38
+ {{- end -}}
39
+ {{- $index := dict "techniques" $techniques "terms" $terms -}}
40
+ {{- return (resources.FromString (printf "search/%s.json" $lang) (jsonify $index) | fingerprint) -}}
@@ -0,0 +1,13 @@
1
+ {{- /*
2
+ A source as cited on a technique page: author, year and page on one line.
3
+ The full title is one click away on the source page and rides along as tooltip.
4
+ dict "key" … "page" …
5
+ */ -}}
6
+ {{- with index hugo.Data.taekwondo.sources .key -}}
7
+ <a class="source-entry" href="{{ partial "url.html" (dict "kind" "source" "key" .name) }}" title="{{ .title }}">
8
+ <b>{{ .author | default .title }}{{ with .year }} {{ . }}{{ end }}</b>
9
+ {{- with $.page }}
10
+ <span>{{ T "page" }} {{ . }}</span>
11
+ {{- end }}
12
+ </a>
13
+ {{- end -}}
@@ -0,0 +1,2 @@
1
+ {{- /* UI string; falls back to the key, e.g. for an own group without translation. */ -}}
2
+ {{- return (or (T .) .) -}}
@@ -0,0 +1,45 @@
1
+ {{- /*
2
+ The illustrations of a technique: one large image, thumbnails to switch.
3
+ Without JavaScript the first image stays. dict "technique" … "name" …
4
+ */ -}}
5
+ {{- $lang := site.Language.Lang -}}
6
+ {{- $images := slice -}}
7
+ {{- range $image := .technique.images -}}
8
+ {{- with resources.Get (printf "img/%s" $image.src) -}}
9
+ {{- $large := . -}}
10
+ {{- $thumb := . -}}
11
+ {{- if in (slice "image/jpeg" "image/png" "image/webp") .MediaType.Type -}}
12
+ {{- $large = .Process "fit 1600x1600 webp" -}}
13
+ {{- $thumb = .Process "fill 160x160 webp" -}}
14
+ {{- end -}}
15
+ {{- $images = $images | append (dict "large" $large.RelPermalink "thumb" $thumb.RelPermalink "ai" $image.ai "caption" (index $image.description $lang | default "")) -}}
16
+ {{- end -}}
17
+ {{- end -}}
18
+
19
+ {{- with $images }}
20
+ {{- $active := index . 0 -}}
21
+ <div class="detail__media" data-gallery>
22
+ <figure class="detail__photo">
23
+ <div class="detail__frame">
24
+ <img src="{{ $active.large }}" alt="{{ $.name }}{{ with $active.caption }}: {{ . }}{{ end }}" data-gallery-image>
25
+ <span class="ai-badge" title="{{ T "ai generated" }}" data-gallery-ai{{ if not $active.ai }} hidden{{ end }}>
26
+ <svg class="ai-badge__icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 0Q8.9 7.1 16 8 8.9 8.9 8 16 7.1 8.9 0 8 7.1 7.1 8 0Z" /></svg>
27
+ <span aria-hidden="true">{{ T "ai badge" }}</span>
28
+ <span class="visually-hidden">{{ T "ai generated" }}</span>
29
+ </span>
30
+ </div>
31
+ {{- if gt (len .) 1 }}
32
+ <div class="detail__thumbs" role="group" aria-label="{{ T "images" }}">
33
+ {{- range $index, $image := . }}
34
+ <button type="button" class="detail__thumb" aria-pressed="{{ eq $index 0 }}"
35
+ aria-label="{{ T "image" }} {{ add $index 1 }}{{ with .caption }}: {{ . }}{{ end }}" title="{{ .caption }}"
36
+ data-src="{{ .large }}" data-alt="{{ $.name }}{{ with .caption }}: {{ . }}{{ end }}" data-caption="{{ .caption }}" data-ai="{{ .ai }}">
37
+ <img src="{{ .thumb }}" alt="" loading="lazy">
38
+ </button>
39
+ {{- end }}
40
+ </div>
41
+ {{- end }}
42
+ <figcaption data-gallery-caption{{ if not $active.caption }} hidden{{ end }}>{{ $active.caption }}</figcaption>
43
+ </figure>
44
+ </div>
45
+ {{- end }}
@@ -0,0 +1,33 @@
1
+ {{- /*
2
+ SyllableBreakdown — one tile per syllable group, joined by a `+`. Folded away:
3
+ on a technique page it is a lookup aid, not the main content. In Korean it
4
+ has nothing to add — the title is the Hangeul already.
5
+ */ -}}
6
+ {{- $lang := site.Language.Lang -}}
7
+ {{- $terms := hugo.Data.taekwondo.terms -}}
8
+ {{- if and .syllables (ne $lang "ko") }}
9
+ <details class="card word-meaning">
10
+ <summary class="word-meaning__summary">
11
+ <h2 class="section-title">{{ T "word meaning" }}</h2>
12
+ </summary>
13
+
14
+ <div class="card-body">
15
+ <div class="d-flex justify-content-end mb-3">
16
+ <a class="small" target="_blank" rel="noopener noreferrer"
17
+ href="https://translate.google.com/?sl=ko&tl={{ $lang }}&text={{ .hangeul | urlquery }}&op=translate">{{ T "open in google translate" }}</a>
18
+ </div>
19
+
20
+ <div class="syllables">
21
+ {{- range $index, $key := .syllables }}
22
+ {{- $term := index $terms $key }}
23
+ {{- if $index }}<span class="syllable-plus" aria-hidden="true">+</span>{{ end }}
24
+ <a class="syllable" href="{{ partial "url.html" (dict "kind" "term" "key" $key) }}">
25
+ <span class="hangeul" lang="ko">{{ $term.hangeul }}</span>
26
+ <span class="romanization">{{ $key }}</span>
27
+ <span class="syllable__meaning">{{ index $term.plain $lang }}</span>
28
+ </a>
29
+ {{- end }}
30
+ </div>
31
+ </div>
32
+ </details>
33
+ {{- end }}
@@ -0,0 +1,5 @@
1
+ {{- /* Korean shows the Hangeul of a technique, every other language its romanised name. */ -}}
2
+ {{- $t := index hugo.Data.taekwondo.techniques . -}}
3
+ {{- $name := $t.name -}}
4
+ {{- if and (eq site.Language.Lang "ko") $t.hangeul -}}{{- $name = $t.hangeul -}}{{- end -}}
5
+ {{- return $name -}}
@@ -0,0 +1,17 @@
1
+ {{- /* A technique as a row of a result list. */ -}}
2
+ {{- $t := index hugo.Data.taekwondo.techniques . -}}
3
+ <li>
4
+ <a class="result-row" href="{{ partial "url.html" (dict "kind" "technique" "key" .) }}">
5
+ <span class="result-row__text">
6
+ <span class="result-row__name">{{ partial "technique-name.html" . }}</span>
7
+ {{- if ne site.Language.Lang "ko" }}
8
+ <span class="result-row__translation">{{ index $t.translation site.Language.Lang }}</span>
9
+ {{- end }}
10
+ </span>
11
+ {{- if $t.generic }}
12
+ <span class="tag">{{ T "generic" }}</span>
13
+ {{- end }}
14
+ {{- partial "grade-badge.html" . }}
15
+ {{ partial "icon.html" (dict "name" "chevron") }}
16
+ </a>
17
+ </li>
@@ -0,0 +1,24 @@
1
+ {{- /* dict "title" <translation key> "keys" (slice <term key> …) */ -}}
2
+ {{- $terms := hugo.Data.taekwondo.terms -}}
3
+ {{- with .keys }}
4
+ <section class="card">
5
+ <div class="card-body">
6
+ <h2 class="section-title mb-2">{{ T $.title }}</h2>
7
+ <ul class="link-list">
8
+ {{- range . }}
9
+ {{- $term := index $terms . }}
10
+ <li>
11
+ <a href="{{ partial "url.html" (dict "kind" "term" "key" .) }}">
12
+ <span>{{ partial "term-name.html" . }}</span>
13
+ {{- with $term.type }}
14
+ <span class="romanization">{{ partial "t.html" . }}</span>
15
+ {{- else }}
16
+ {{ partial "icon.html" (dict "name" "chevron") }}
17
+ {{- end }}
18
+ </a>
19
+ </li>
20
+ {{- end }}
21
+ </ul>
22
+ </div>
23
+ </section>
24
+ {{- end }}
@@ -0,0 +1,4 @@
1
+ {{- $t := index hugo.Data.taekwondo.terms . -}}
2
+ {{- $name := $t.name -}}
3
+ {{- if eq site.Language.Lang "ko" -}}{{- $name = $t.hangeul -}}{{- end -}}
4
+ {{- return $name -}}
@@ -0,0 +1,11 @@
1
+ {{- /* dict "kind" technique|term|source|group "key" … → URL in the current language */ -}}
2
+ {{- $db := hugo.Data.taekwondo -}}
3
+ {{- $entry := dict -}}
4
+ {{- if eq .kind "technique" -}}{{- $entry = index $db.techniques .key -}}
5
+ {{- else if eq .kind "term" -}}{{- $entry = index $db.terms .key -}}
6
+ {{- else if eq .kind "source" -}}{{- $entry = index $db.sources .key -}}
7
+ {{- else if eq .kind "group" -}}{{- $entry = index (where $db.groups "key" .key) 0 -}}
8
+ {{- end -}}
9
+ {{- $url := "" -}}
10
+ {{- with $entry -}}{{- $url = relLangURL (printf "%s/%s/" $.kind .slug) -}}{{- end -}}
11
+ {{- return $url -}}
@@ -0,0 +1,2 @@
1
+ {{- /* {{< email "info@example.org" >}} */ -}}
2
+ {{- partial "email.html" (.Get 0) -}}
@@ -0,0 +1,18 @@
1
+ {{- /*
2
+ A detail of the site's operator for imprint and privacy policy: the
3
+ parameter operator.<key>, e.g. name, street, city or email, which the
4
+ environment variable HUGO_PARAMS_OPERATOR_<KEY> can set. An email address is
5
+ rendered like by the shortcode email. A missing one reads TODO-operator.<key>.
6
+ {{< operator "name" >}}
7
+ */ -}}
8
+ {{- $key := .Get 0 -}}
9
+ {{- $value := "" -}}
10
+ {{- with site.Params.operator }}{{ $value = index . $key }}{{ end -}}
11
+ {{- if not $value -}}
12
+ {{- warnf "%s: set HUGO_PARAMS_OPERATOR_%s" .Position (upper $key) -}}
13
+ TODO-operator.{{ $key }}
14
+ {{- else if eq $key "email" -}}
15
+ {{- partial "email.html" $value -}}
16
+ {{- else -}}
17
+ {{- $value -}}
18
+ {{- end -}}
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html>
2
+ <html lang="{{ site.Language.Lang }}">
3
+ <head>
4
+ {{- partial "head.html" . }}
5
+ </head>
6
+ <body>
7
+ <div class="app-shell">
8
+ {{- partial "header.html" . }}
9
+ <main class="app-main{{ if or .IsHome (eq .Kind "404") }} app-main--home{{ end }}">
10
+ {{- block "main" . }}{{ end }}
11
+ </main>
12
+ <footer class="site-footer">
13
+ <div class="site-footer__info">
14
+ {{- with T "disclaimer" }}
15
+ <span>{{ . }}</span>
16
+ {{- end }}
17
+ <span>{{ T "build date" }} {{ time.Format ":date_long" now }}</span>
18
+ </div>
19
+ {{- $links := slice }}
20
+ {{- range site.Menus.footer }}{{ $links = $links | append . }}{{ end }}
21
+ {{- if ne site.Language.Lang hugo.Sites.Default.Language.Lang }}
22
+ {{- /* Pages of the default language without a version in this one are linked as well. */}}
23
+ {{- range hugo.Sites.Default.Menus.footer }}
24
+ {{- if not (and .Page (where .Page.Translations "Language.Lang" site.Language.Lang)) }}{{ $links = $links | append . }}{{ end }}
25
+ {{- end }}
26
+ {{- end }}
27
+ {{- with sort $links "Weight" }}
28
+ <nav class="site-footer__links" aria-label="{{ T "legal" }}">
29
+ {{- range . }}
30
+ {{- $lang := cond (and .Page (ne .Page.Language.Lang site.Language.Lang)) .Page.Language.Lang "" }}
31
+ <a href="{{ .URL }}"{{ with $lang }} hreflang="{{ . }}"{{ end }}>{{ or (T .Identifier) .Name }}</a>
32
+ {{- end }}
33
+ </nav>
34
+ {{- end }}
35
+ </footer>
36
+ </div>
37
+ {{- partial "scripts.html" . }}
38
+ </body>
39
+ </html>
@@ -0,0 +1,24 @@
1
+ {{ define "main" }}
2
+ {{- $key := .Params.key -}}
3
+ {{- $group := index (where hugo.Data.taekwondo.groups "key" $key) 0 -}}
4
+ {{- $label := partial "t.html" $key -}}
5
+
6
+ {{ partial "breadcrumb.html" (dict "trail" (slice (dict "label" (T "techniques") "href" (relLangURL "groups/"))) "current" $label) }}
7
+
8
+ <div class="stack">
9
+ <div class="title-block">
10
+ <span class="pill-category" data-group="{{ partial "category-group.html" $key }}">{{ T "category" }}</span>
11
+ <div class="title-block__line">
12
+ <h1>{{ $label }}</h1>
13
+ <span class="title-block__reading">{{ $key }}</span>
14
+ </div>
15
+ <p class="title-block__translation">{{ len $group.techniques }} {{ T "techniques" }}</p>
16
+ </div>
17
+
18
+ <ul class="result-list">
19
+ {{- range $group.techniques }}
20
+ {{ partial "technique-row.html" . }}
21
+ {{- end }}
22
+ </ul>
23
+ </div>
24
+ {{ end }}
@@ -0,0 +1,48 @@
1
+ {{- /*
2
+ All categories, by colour group or A–Z. Both orders are rendered; the switch
3
+ only shows one or the other. Without JavaScript the grouped order stays.
4
+ */ -}}
5
+ {{ define "main" }}
6
+ {{- $categories := partial "categories.html" . -}}
7
+ {{- $hasGroups := gt (len $categories.grouped) 0 -}}
8
+ {{- $labelled := slice -}}
9
+ {{- range $categories.all }}{{ $labelled = $labelled | append (dict "key" . "label" (partial "t.html" .)) }}{{ end -}}
10
+
11
+ <div class="stack-lg" data-sorting>
12
+ <div class="d-flex flex-wrap justify-content-between align-items-end gap-3">
13
+ <div class="title-block">
14
+ <div class="title-block__line">
15
+ <h1>{{ T "techniques" }}</h1>
16
+ </div>
17
+ <p class="title-block__translation">
18
+ {{ len $categories.all }} {{ T "categories" }}
19
+ {{- if $hasGroups }}<span data-sorting-view="groups"> {{ T "in" }} {{ len $categories.grouped }} {{ T "category groups" }}</span>{{ end }}
20
+ </p>
21
+ </div>
22
+
23
+ {{- if $hasGroups }}
24
+ <div class="toggle-group" role="group" aria-label="{{ T "sorting" }}" hidden data-sorting-switch>
25
+ <button type="button" aria-pressed="true" data-sorting-choice="groups">{{ T "by groups" }}</button>
26
+ <button type="button" aria-pressed="false" data-sorting-choice="alphabetical">{{ T "alphabetical" }}</button>
27
+ </div>
28
+ {{- end }}
29
+ </div>
30
+
31
+ {{- if $hasGroups }}
32
+ <div class="stack-lg" data-sorting-view="groups">
33
+ {{- range $categories.grouped }}
34
+ {{ partial "category-section.html" (dict "group" .id "label" (T (printf "group %s" .id)) "description" (T (printf "group %s description" .id)) "categories" .categories) }}
35
+ {{- end }}
36
+ {{- with $categories.ungrouped }}
37
+ {{ partial "category-section.html" (dict "group" "" "label" (T "other categories") "categories" .) }}
38
+ {{- end }}
39
+ </div>
40
+ {{- end }}
41
+
42
+ <div class="category-tile-grid" data-sorting-view="alphabetical"{{ if $hasGroups }} hidden{{ end }}>
43
+ {{- range sort $labelled "label" }}
44
+ {{ partial "category-tile.html" .key }}
45
+ {{- end }}
46
+ </div>
47
+ </div>
48
+ {{ end }}