@taekwondo-db/web-app 0.1.2 → 0.2.0
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.
- package/README.md +27 -8
- package/assets/css/components/detail.css +17 -4
- package/assets/css/components/downloads.css +86 -0
- package/assets/css/components/layout.css +12 -0
- package/assets/css/components/pronunciation.css +113 -0
- package/assets/css/style.css +2 -0
- package/assets/fonts/noto-serif-kr.css +2 -1
- package/assets/js/main.js +4 -1
- package/assets/js/pronunciation.js +35 -0
- package/assets/js/pwa.js +160 -23
- package/assets/js/search.js +1 -1
- package/bin/taekwondo-db.js +30 -13
- package/i18n/de.json +25 -2
- package/i18n/en.json +25 -2
- package/i18n/ko.json +19 -2
- package/layouts/_partials/category-cards.html +1 -1
- package/layouts/_partials/category-section.html +1 -1
- package/layouts/_partials/downloads-dialog.html +20 -0
- package/layouts/_partials/fonts.html +1 -1
- package/layouts/_partials/head.html +6 -1
- package/layouts/_partials/meta-description.html +60 -0
- package/layouts/_partials/pronunciation.html +23 -0
- package/layouts/_partials/scripts.html +3 -7
- package/layouts/_partials/search-index.html +2 -0
- package/layouts/_partials/structured-data.html +54 -0
- package/layouts/baseof.html +5 -3
- package/layouts/robots.txt +4 -0
- package/layouts/source/page.html +1 -1
- package/layouts/technique/page.html +9 -5
- package/layouts/term/page.html +2 -1
- package/lib/database.js +1 -0
- package/lib/export.js +83 -11
- package/lib/fonts.js +36 -0
- package/lib/service-worker.js +170 -46
- package/lib/validate.js +14 -2
- package/package.json +4 -3
package/bin/taekwondo-db.js
CHANGED
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Command line of @taekwondo-db/web-app, run from the site directory.
|
|
4
4
|
*
|
|
5
|
-
* taekwondo-db build [--db <file>] [--img <dir>]… [-- <hugo flags>]
|
|
6
|
-
* taekwondo-db dev [--db <file>] [--img <dir>]… [-- <hugo flags>]
|
|
7
|
-
* taekwondo-db export [--db <file>] [--img <dir>]…
|
|
8
|
-
* taekwondo-db validate [--db <file>] [--img <dir>]… [--data <dir>]
|
|
5
|
+
* taekwondo-db build [--db <file>] [--img <dir>]… [--audio <dir>]… [-- <hugo flags>]
|
|
6
|
+
* taekwondo-db dev [--db <file>] [--img <dir>]… [--audio <dir>]… [-- <hugo flags>]
|
|
7
|
+
* taekwondo-db export [--db <file>] [--img <dir>]… [--audio <dir>]…
|
|
8
|
+
* taekwondo-db validate [--db <file>] [--img <dir>]… [--audio <dir>]… [--data <dir>]
|
|
9
9
|
*/
|
|
10
10
|
import { spawn, spawnSync } from "node:child_process";
|
|
11
11
|
import fs from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
13
13
|
import { parseArgs } from "node:util";
|
|
14
14
|
import {
|
|
15
|
+
audioDirsOf,
|
|
15
16
|
DATA_THEME,
|
|
16
17
|
exportSite,
|
|
17
18
|
imageDirsOf,
|
|
18
19
|
loadDbOptions,
|
|
19
20
|
THEME,
|
|
20
21
|
} from "../lib/export.js";
|
|
22
|
+
import { subsetFonts } from "../lib/fonts.js";
|
|
21
23
|
import { writeServiceWorker } from "../lib/service-worker.js";
|
|
22
24
|
import { validateSite } from "../lib/validate.js";
|
|
23
25
|
|
|
@@ -25,12 +27,14 @@ const HUGO = process.env.HUGO_BIN ?? "hugo";
|
|
|
25
27
|
|
|
26
28
|
// Not taken from a theme's config, so set here; a site can still override it.
|
|
27
29
|
process.env.HUGO_DISABLEKINDS ??= "taxonomy term rss";
|
|
30
|
+
process.env.HUGO_ENABLEROBOTSTXT ??= "true";
|
|
28
31
|
const USAGE =
|
|
29
|
-
"Usage: taekwondo-db build|dev|export|validate [--db <file>] [--img <dir>]… [-- <hugo flags>]";
|
|
32
|
+
"Usage: taekwondo-db build|dev|export|validate [--db <file>] [--img <dir>]… [--audio <dir>]… [-- <hugo flags>]";
|
|
30
33
|
|
|
31
34
|
const { positionals, values } = parseArgs({
|
|
32
35
|
allowPositionals: true,
|
|
33
36
|
options: {
|
|
37
|
+
audio: { default: ["audio"], multiple: true, type: "string" },
|
|
34
38
|
data: { default: "db", type: "string" },
|
|
35
39
|
db: { default: "db/index.js", type: "string" },
|
|
36
40
|
img: { default: ["img"], multiple: true, type: "string" },
|
|
@@ -41,7 +45,8 @@ const [command, ...hugoArgs] = positionals;
|
|
|
41
45
|
const root = process.cwd();
|
|
42
46
|
const db = await loadDbOptions(root, values.db);
|
|
43
47
|
const imageDirs = imageDirsOf(db, root, values.img);
|
|
44
|
-
const
|
|
48
|
+
const audioDirs = audioDirsOf(db, root, values.audio);
|
|
49
|
+
const run = () => exportSite({ audioDirs, db, imageDirs, root });
|
|
45
50
|
|
|
46
51
|
function themeArgs(themesDir) {
|
|
47
52
|
return ["--themesDir", themesDir, "--theme", `${DATA_THEME},${THEME}`];
|
|
@@ -84,13 +89,22 @@ switch (command) {
|
|
|
84
89
|
process.exitCode = result.status ?? 1;
|
|
85
90
|
break;
|
|
86
91
|
}
|
|
87
|
-
const
|
|
88
|
-
.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
)
|
|
93
|
-
|
|
92
|
+
for (const { after, before, file } of await subsetFonts(outDir))
|
|
93
|
+
console.log(`${file}: ${before >> 10} → ${after >> 10} KB`);
|
|
94
|
+
|
|
95
|
+
const config = hugoConfig(themesDir);
|
|
96
|
+
const pathname = new URL(config.baseurl || "/", "http://x").pathname;
|
|
97
|
+
const base = pathname.endsWith("/") ? pathname : `${pathname}/`;
|
|
98
|
+
const languages = Object.keys(config.languages ?? {}).map((code) => ({
|
|
99
|
+
code,
|
|
100
|
+
home:
|
|
101
|
+
code === config.defaultcontentlanguage &&
|
|
102
|
+
!config.defaultcontentlanguageinsubdir
|
|
103
|
+
? base
|
|
104
|
+
: `${base}${code}/`,
|
|
105
|
+
}));
|
|
106
|
+
const count = writeServiceWorker(outDir, { base, languages });
|
|
107
|
+
console.log(`sw.js: ${count} files`);
|
|
94
108
|
break;
|
|
95
109
|
}
|
|
96
110
|
|
|
@@ -100,6 +114,7 @@ switch (command) {
|
|
|
100
114
|
for (const dir of [
|
|
101
115
|
path.dirname(path.resolve(root, values.db)),
|
|
102
116
|
...imageDirs,
|
|
117
|
+
...audioDirs,
|
|
103
118
|
]) {
|
|
104
119
|
if (!fs.existsSync(dir) || dir.includes("node_modules")) continue;
|
|
105
120
|
fs.watch(dir, { recursive: true }, () => {
|
|
@@ -114,6 +129,7 @@ switch (command) {
|
|
|
114
129
|
"--db",
|
|
115
130
|
values.db,
|
|
116
131
|
...values.img.flatMap((dir) => ["--img", dir]),
|
|
132
|
+
...values.audio.flatMap((dir) => ["--audio", dir]),
|
|
117
133
|
],
|
|
118
134
|
{ stdio: "inherit" },
|
|
119
135
|
);
|
|
@@ -129,6 +145,7 @@ switch (command) {
|
|
|
129
145
|
case "validate": {
|
|
130
146
|
const languages = Object.keys(hugoConfig().languages ?? {});
|
|
131
147
|
const valid = await validateSite({
|
|
148
|
+
audioDirs,
|
|
132
149
|
dataDir: values.data,
|
|
133
150
|
db,
|
|
134
151
|
imageDirs,
|
package/i18n/de.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"adverb": "Adverb",
|
|
5
5
|
"ai badge": "KI",
|
|
6
6
|
"ai generated": "Mit KI generiertes Bild",
|
|
7
|
+
"ai generated speech": "mit KI erzeugt",
|
|
7
8
|
"all": "Alle",
|
|
8
9
|
"all categories": "Alle Kategorien",
|
|
9
10
|
"alphabetical": "A–Z",
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
"book": "Buch",
|
|
14
15
|
"build date": "Stand",
|
|
15
16
|
"by groups": "Nach Gruppen",
|
|
17
|
+
"cancel": "Abbrechen",
|
|
16
18
|
"categories": "Kategorien",
|
|
17
19
|
"category": "Kategorie",
|
|
18
20
|
"category groups": "Gruppen",
|
|
@@ -44,6 +46,7 @@
|
|
|
44
46
|
"historic data": "Historische Daten",
|
|
45
47
|
"historical names": "Historische Namen",
|
|
46
48
|
"home subtitle": "Techniken und Begriffe – auf Deutsch oder in koreanischer Umschrift.",
|
|
49
|
+
"home title": "Techniken und Begriffe mit Hangeul und Übersetzung",
|
|
47
50
|
"image": "Bild",
|
|
48
51
|
"images": "Bilder",
|
|
49
52
|
"imprint": "Impressum",
|
|
@@ -53,11 +56,24 @@
|
|
|
53
56
|
"jjireugi": "Stich",
|
|
54
57
|
"kkeokgi": "Hebeln",
|
|
55
58
|
"language": "Sprache",
|
|
56
|
-
"
|
|
59
|
+
"later": "Später",
|
|
57
60
|
"lemma": "Grundform",
|
|
61
|
+
"listen to pronunciation": "Aussprache anhören",
|
|
58
62
|
"look up": "Nachschlagen",
|
|
59
63
|
"makgi": "Block",
|
|
60
64
|
"mccune reischauer": "McCune-Reischauer",
|
|
65
|
+
"meta group": {
|
|
66
|
+
"one": "1 Taekwondo-Technik in dieser Kategorie – {{ .Techniques }}",
|
|
67
|
+
"other": "{{ .Count }} Taekwondo-Techniken in dieser Kategorie – {{ .Techniques }}"
|
|
68
|
+
},
|
|
69
|
+
"meta groups": "Alle Taekwondo-Techniken nach Kategorien: {{ .Categories }}",
|
|
70
|
+
"meta home": "Taekwondo-Techniken und -Begriffe mit Hangeul, Übersetzung, Beschreibung und Quellen.",
|
|
71
|
+
"meta source": {
|
|
72
|
+
"one": "1 Taekwondo-Technik aus dieser Quelle.",
|
|
73
|
+
"other": "{{ .Count }} Taekwondo-Techniken aus dieser Quelle."
|
|
74
|
+
},
|
|
75
|
+
"meta technique": "Taekwondo-Technik der Kategorie {{ .Category }}.",
|
|
76
|
+
"meta term": "Koreanischer Taekwondo-Begriff.",
|
|
61
77
|
"milgi": "Schubsen",
|
|
62
78
|
"missing source": "Die Quelle ist unbekannt.",
|
|
63
79
|
"modifier": "Bestimmungsform",
|
|
@@ -67,6 +83,8 @@
|
|
|
67
83
|
"no results": "Es wurden keine Ergebniss gefunden.",
|
|
68
84
|
"noun": "Nomen",
|
|
69
85
|
"occurs in": "Kommt vor in",
|
|
86
|
+
"offline downloading": "Offline-Inhalte werden geladen …",
|
|
87
|
+
"offline ready": "Die Seite funktioniert jetzt auch offline.",
|
|
70
88
|
"open in google translate": "In Google Übersetzer öffnen",
|
|
71
89
|
"open source": "Quelle öffnen",
|
|
72
90
|
"other categories": "Weitere Kategorien",
|
|
@@ -85,10 +103,13 @@
|
|
|
85
103
|
"search placeholder": "Suche nach Techniken oder Begriffen...",
|
|
86
104
|
"search placeholder short": "Begriff oder Übersetzung",
|
|
87
105
|
"seogi": "Stand",
|
|
106
|
+
"site info": "Über diese Seite",
|
|
88
107
|
"sorting": "Sortierung",
|
|
89
108
|
"source": "Quelle",
|
|
109
|
+
"source code": "Quelltext",
|
|
90
110
|
"sources": "Quellen",
|
|
91
111
|
"specialization": "Spezialisierung",
|
|
112
|
+
"spoken by": "gesprochen von",
|
|
92
113
|
"supplementaryName": "Alternativer Name",
|
|
93
114
|
"technique": "Technik",
|
|
94
115
|
"techniques": "Techniken",
|
|
@@ -98,7 +119,9 @@
|
|
|
98
119
|
"terms": "Begriffe",
|
|
99
120
|
"ttwigi": "Springen",
|
|
100
121
|
"unknown": "Unbekannt",
|
|
101
|
-
"update
|
|
122
|
+
"update downloading": "Eine neue Version wird geladen …",
|
|
123
|
+
"update now": "Jetzt aktualisieren",
|
|
124
|
+
"update ready": "Eine neue Version ist bereit.",
|
|
102
125
|
"verb": "Verb",
|
|
103
126
|
"videos": "Videos",
|
|
104
127
|
"weight": "Gewicht",
|
package/i18n/en.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"adverb": "Adverb",
|
|
5
5
|
"ai badge": "AI",
|
|
6
6
|
"ai generated": "Image generated with AI",
|
|
7
|
+
"ai generated speech": "generated with AI",
|
|
7
8
|
"all": "All",
|
|
8
9
|
"all categories": "All categories",
|
|
9
10
|
"alphabetical": "A–Z",
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
"book": "Book",
|
|
14
15
|
"build date": "Built",
|
|
15
16
|
"by groups": "By group",
|
|
17
|
+
"cancel": "Cancel",
|
|
16
18
|
"categories": "categories",
|
|
17
19
|
"category": "Category",
|
|
18
20
|
"category groups": "groups",
|
|
@@ -44,6 +46,7 @@
|
|
|
44
46
|
"historic data": "Historical data",
|
|
45
47
|
"historical names": "Historical names",
|
|
46
48
|
"home subtitle": "Techniques and terms — in English or in Korean romanisation.",
|
|
49
|
+
"home title": "Techniques and Terms with Hangeul and Translation",
|
|
47
50
|
"image": "Image",
|
|
48
51
|
"images": "Images",
|
|
49
52
|
"imprint": "Legal Notice",
|
|
@@ -53,11 +56,24 @@
|
|
|
53
56
|
"jjireugi": "Thrust",
|
|
54
57
|
"kkeokgi": "Joint-lock",
|
|
55
58
|
"language": "Language",
|
|
56
|
-
"
|
|
59
|
+
"later": "Later",
|
|
57
60
|
"lemma": "Base form",
|
|
61
|
+
"listen to pronunciation": "Listen to the pronunciation",
|
|
58
62
|
"look up": "Look up",
|
|
59
63
|
"makgi": "Block",
|
|
60
64
|
"mccune reischauer": "McCune-Reischauer",
|
|
65
|
+
"meta group": {
|
|
66
|
+
"one": "1 Taekwondo technique in this category – {{ .Techniques }}",
|
|
67
|
+
"other": "{{ .Count }} Taekwondo techniques in this category – {{ .Techniques }}"
|
|
68
|
+
},
|
|
69
|
+
"meta groups": "All Taekwondo techniques by category: {{ .Categories }}",
|
|
70
|
+
"meta home": "Taekwondo techniques and terms with Hangeul, translation, description and sources.",
|
|
71
|
+
"meta source": {
|
|
72
|
+
"one": "1 Taekwondo technique from this source.",
|
|
73
|
+
"other": "{{ .Count }} Taekwondo techniques from this source."
|
|
74
|
+
},
|
|
75
|
+
"meta technique": "Taekwondo technique of the category {{ .Category }}.",
|
|
76
|
+
"meta term": "Korean Taekwondo term.",
|
|
61
77
|
"milgi": "Pushing",
|
|
62
78
|
"missing source": "Source is currently missing",
|
|
63
79
|
"modifier": "Modifier",
|
|
@@ -67,6 +83,8 @@
|
|
|
67
83
|
"no results": "No results have been found.",
|
|
68
84
|
"noun": "Noun",
|
|
69
85
|
"occurs in": "Occurs in",
|
|
86
|
+
"offline downloading": "Downloading for offline use …",
|
|
87
|
+
"offline ready": "The site now works offline too.",
|
|
70
88
|
"open in google translate": "Open in Google Translate",
|
|
71
89
|
"open source": "Open source",
|
|
72
90
|
"other categories": "Other categories",
|
|
@@ -85,10 +103,13 @@
|
|
|
85
103
|
"search placeholder": "Search for techniques or terms...",
|
|
86
104
|
"search placeholder short": "Term or translation",
|
|
87
105
|
"seogi": "Stance",
|
|
106
|
+
"site info": "About this site",
|
|
88
107
|
"sorting": "Sorting",
|
|
89
108
|
"source": "Source",
|
|
109
|
+
"source code": "Source code",
|
|
90
110
|
"sources": "Sources",
|
|
91
111
|
"specialization": "Specialization",
|
|
112
|
+
"spoken by": "spoken by",
|
|
92
113
|
"supplementaryName": "Supplementary name",
|
|
93
114
|
"technique": "Technique",
|
|
94
115
|
"techniques": "Techniques",
|
|
@@ -98,7 +119,9 @@
|
|
|
98
119
|
"terms": "Terms",
|
|
99
120
|
"ttwigi": "Jumping",
|
|
100
121
|
"unknown": "Unknown",
|
|
101
|
-
"update
|
|
122
|
+
"update downloading": "Downloading a new version …",
|
|
123
|
+
"update now": "Update now",
|
|
124
|
+
"update ready": "A new version is ready.",
|
|
102
125
|
"verb": "Verb",
|
|
103
126
|
"videos": "Videos",
|
|
104
127
|
"weight": "Weight",
|
package/i18n/ko.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"adverb": "부사",
|
|
5
5
|
"ai badge": "AI",
|
|
6
6
|
"ai generated": "AI로 생성된 이미지",
|
|
7
|
+
"ai generated speech": "AI로 생성된 음성",
|
|
7
8
|
"all": "전체",
|
|
8
9
|
"all categories": "모든 분류",
|
|
9
10
|
"alphabetical": "A–Z",
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
"book": "도서",
|
|
14
15
|
"build date": "빌드",
|
|
15
16
|
"by groups": "묶음별",
|
|
17
|
+
"cancel": "취소",
|
|
16
18
|
"categories": "분류",
|
|
17
19
|
"category": "분류",
|
|
18
20
|
"category groups": "묶음",
|
|
@@ -44,6 +46,7 @@
|
|
|
44
46
|
"historic data": "역사 자료",
|
|
45
47
|
"historical names": "역사적 명칭",
|
|
46
48
|
"home subtitle": "기술과 용어 — 한국어 또는 로마자 표기로.",
|
|
49
|
+
"home title": "한글과 로마자 표기로 보는 기술과 용어",
|
|
47
50
|
"image": "이미지",
|
|
48
51
|
"images": "이미지",
|
|
49
52
|
"imprint": "운영자 정보",
|
|
@@ -53,11 +56,18 @@
|
|
|
53
56
|
"jjireugi": "찌르기",
|
|
54
57
|
"kkeokgi": "꺾기",
|
|
55
58
|
"language": "언어",
|
|
56
|
-
"
|
|
59
|
+
"later": "나중에",
|
|
57
60
|
"lemma": "기본형",
|
|
61
|
+
"listen to pronunciation": "발음 듣기",
|
|
58
62
|
"look up": "찾아보기",
|
|
59
63
|
"makgi": "막기",
|
|
60
64
|
"mccune reischauer": "매큔-라이샤워",
|
|
65
|
+
"meta group": "이 분류의 태권도 기술 {{ .Count }}개 – {{ .Techniques }}",
|
|
66
|
+
"meta groups": "분류별 태권도 기술 전체: {{ .Categories }}",
|
|
67
|
+
"meta home": "태권도 기술과 용어 — 한글, 로마자 표기, 출처와 함께.",
|
|
68
|
+
"meta source": "이 출처의 태권도 기술 {{ .Count }}개.",
|
|
69
|
+
"meta technique": "{{ .Category }} 분류의 태권도 기술.",
|
|
70
|
+
"meta term": "태권도 용어.",
|
|
61
71
|
"milgi": "밀기",
|
|
62
72
|
"missing source": "출처가 확인되지 않았습니다.",
|
|
63
73
|
"modifier": "수식어",
|
|
@@ -67,6 +77,8 @@
|
|
|
67
77
|
"no results": "검색 결과가 없습니다.",
|
|
68
78
|
"noun": "명사",
|
|
69
79
|
"occurs in": "쓰이는 곳",
|
|
80
|
+
"offline downloading": "오프라인 사용을 위해 내려받는 중…",
|
|
81
|
+
"offline ready": "이제 오프라인에서도 사용할 수 있습니다.",
|
|
70
82
|
"open in google translate": "구글 번역에서 열기",
|
|
71
83
|
"open source": "출처 열기",
|
|
72
84
|
"other categories": "기타 분류",
|
|
@@ -85,10 +97,13 @@
|
|
|
85
97
|
"search placeholder": "기술이나 용어를 검색하세요...",
|
|
86
98
|
"search placeholder short": "용어 또는 번역",
|
|
87
99
|
"seogi": "서기",
|
|
100
|
+
"site info": "사이트 정보",
|
|
88
101
|
"sorting": "정렬",
|
|
89
102
|
"source": "출처",
|
|
103
|
+
"source code": "소스 코드",
|
|
90
104
|
"sources": "출처",
|
|
91
105
|
"specialization": "세부 분류",
|
|
106
|
+
"spoken by": "녹음:",
|
|
92
107
|
"supplementaryName": "보조 명칭",
|
|
93
108
|
"technique": "기술",
|
|
94
109
|
"techniques": "기술",
|
|
@@ -98,7 +113,9 @@
|
|
|
98
113
|
"terms": "용어",
|
|
99
114
|
"ttwigi": "뛰기",
|
|
100
115
|
"unknown": "알 수 없음",
|
|
101
|
-
"update
|
|
116
|
+
"update downloading": "새 버전을 내려받는 중…",
|
|
117
|
+
"update now": "지금 업데이트",
|
|
118
|
+
"update ready": "새 버전이 준비되었습니다.",
|
|
102
119
|
"verb": "동사",
|
|
103
120
|
"videos": "동영상",
|
|
104
121
|
"weight": "가중치",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
{{- end -}}
|
|
10
10
|
|
|
11
11
|
{{- with $cards }}
|
|
12
|
-
<section class="stack"
|
|
12
|
+
<section class="stack-md" data-search-idle>
|
|
13
13
|
<div class="d-flex flex-wrap justify-content-between align-items-baseline gap-2">
|
|
14
14
|
<h2 class="h4 m-0">{{ T "techniques" }}</h2>
|
|
15
15
|
<a href="{{ relLangURL "groups/" }}" class="fw-semibold">{{ T "all categories" }} →</a>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{- /* dict "group" … "label" … "description" … "categories" … */ -}}
|
|
2
|
-
<section class="stack"
|
|
2
|
+
<section class="stack-md">
|
|
3
3
|
<div class="category-group-heading">
|
|
4
4
|
<span class="group-mark" data-group="{{ .group }}" aria-hidden="true"></span>
|
|
5
5
|
<h2>{{ .label }}</h2>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{{- /* Progress of the offline downloads and the offer of an update; see assets/js/pwa.js. */ -}}
|
|
2
|
+
{{- if hugo.IsProduction }}
|
|
3
|
+
<dialog class="downloads" data-downloads aria-labelledby="downloads-title">
|
|
4
|
+
<p class="downloads__title" id="downloads-title">
|
|
5
|
+
<span data-when="offline">{{ T "offline downloading" }}</span>
|
|
6
|
+
<span data-when="update">{{ T "update downloading" }}</span>
|
|
7
|
+
<span data-when="done">{{ T "offline ready" }}</span>
|
|
8
|
+
<span data-when="ready">{{ T "update ready" }}</span>
|
|
9
|
+
</p>
|
|
10
|
+
<div class="downloads__progress" data-when="offline update">
|
|
11
|
+
<progress max="1" value="0" aria-labelledby="downloads-title"></progress>
|
|
12
|
+
<span data-percent></span>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="downloads__actions" data-when="offline update ready">
|
|
15
|
+
<button type="button" class="downloads__button" data-when="offline update" data-cancel>{{ T "cancel" }}</button>
|
|
16
|
+
<button type="button" class="downloads__button" data-when="ready" data-later>{{ T "later" }}</button>
|
|
17
|
+
<button type="button" class="downloads__button downloads__button--primary" data-when="ready" data-apply>{{ T "update now" }}</button>
|
|
18
|
+
</div>
|
|
19
|
+
</dialog>
|
|
20
|
+
{{- end }}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"fonts/ibm-plex-sans-latin-600-normal.woff2"
|
|
14
14
|
"fonts/ibm-plex-sans-latin-700-normal.woff2"
|
|
15
15
|
-}}
|
|
16
|
-
{{- /*
|
|
16
|
+
{{- /* Only where Hangeul is shown. */ -}}
|
|
17
17
|
{{- if or (eq site.Language.Lang "ko") (in (slice "technique" "term") .Section) (eq .Kind "404") -}}
|
|
18
18
|
{{- $preload = $preload | append "fonts/noto-serif-kr-korean-500-normal.woff2" -}}
|
|
19
19
|
{{- end -}}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<meta charset="UTF-8">
|
|
2
2
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
3
|
-
<title>{{ with partial "page-title.html" . }}{{ . }} · {{
|
|
3
|
+
<title>{{ with partial "page-title.html" . }}{{ . }} · {{ site.Title }}{{ else }}{{ site.Title }} · {{ T "home title" }}{{ end }}</title>
|
|
4
|
+
{{- with partial "meta-description.html" . }}
|
|
5
|
+
<meta name="description" content="{{ . }}">
|
|
6
|
+
{{- end }}
|
|
4
7
|
|
|
5
8
|
{{- if gt (len hugo.Sites) 1 }}
|
|
6
9
|
{{- range .Rotate "language" }}
|
|
@@ -15,3 +18,5 @@
|
|
|
15
18
|
{{- end }}
|
|
16
19
|
|
|
17
20
|
{{- partial "favicons.html" . }}
|
|
21
|
+
|
|
22
|
+
{{- partial "structured-data.html" . }}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{{- /* Plain text for <meta name="description">; "" leaves it out. Front matter `description` wins. */ -}}
|
|
2
|
+
{{- $db := hugo.Data.taekwondo -}}
|
|
3
|
+
{{- $lang := site.Language.Lang -}}
|
|
4
|
+
{{- $korean := eq $lang "ko" -}}
|
|
5
|
+
{{- $key := .Params.key -}}
|
|
6
|
+
{{- $name := "" -}}
|
|
7
|
+
{{- $other := "" -}}
|
|
8
|
+
{{- $parts := slice -}}
|
|
9
|
+
|
|
10
|
+
{{- if .Description -}}
|
|
11
|
+
{{- $parts = slice .Description -}}
|
|
12
|
+
{{- else if eq .Section "technique" -}}
|
|
13
|
+
{{- $t := index $db.techniques $key -}}
|
|
14
|
+
{{- $name = partial "technique-name.html" $key -}}
|
|
15
|
+
{{- $other = cond $korean $t.name $t.hangeul -}}
|
|
16
|
+
{{- $text := "" -}}
|
|
17
|
+
{{- range index $t.description $lang }}{{ $text = printf "%s%s" $text (or .label .text) }}{{ end -}}
|
|
18
|
+
{{- $parts = slice (index $t.translation $lang) $text -}}
|
|
19
|
+
{{- if not (or (index $t.translation $lang) $text) -}}
|
|
20
|
+
{{- $parts = slice (T "meta technique" (dict "Category" (partial "t.html" $t.group))) -}}
|
|
21
|
+
{{- end -}}
|
|
22
|
+
{{- else if eq .Section "term" -}}
|
|
23
|
+
{{- $term := index $db.terms $key -}}
|
|
24
|
+
{{- $name = partial "term-name.html" $key -}}
|
|
25
|
+
{{- $other = cond $korean $term.name $term.hangeul -}}
|
|
26
|
+
{{- $parts = slice (index $term.plain $lang) (T "meta term") -}}
|
|
27
|
+
{{- else if eq .Section "source" -}}
|
|
28
|
+
{{- $source := index $db.sources $key -}}
|
|
29
|
+
{{- $name = $source.title -}}
|
|
30
|
+
{{- $byline := slice -}}
|
|
31
|
+
{{- range slice $source.author $source.year }}{{ with . }}{{ $byline = $byline | append . }}{{ end }}{{ end -}}
|
|
32
|
+
{{- $parts = slice (delimit $byline ", ") (index $source.description $lang) -}}
|
|
33
|
+
{{- with $source.techniques }}{{ $parts = $parts | append (T "meta source" (dict "Count" (len .))) }}{{ end -}}
|
|
34
|
+
{{- else if eq .Section "group" -}}
|
|
35
|
+
{{- $group := index (where $db.groups "key" $key) 0 -}}
|
|
36
|
+
{{- $names := slice -}}
|
|
37
|
+
{{- range first 8 $group.techniques }}{{ $names = $names | append (partial "technique-name.html" .) }}{{ end -}}
|
|
38
|
+
{{- if gt (len $group.techniques) 8 }}{{ $names = $names | append "…" }}{{ end -}}
|
|
39
|
+
{{- $name = partial "t.html" $key -}}
|
|
40
|
+
{{- $other = $key -}}
|
|
41
|
+
{{- $parts = slice (T "meta group" (dict "Count" (len $group.techniques) "Techniques" (delimit $names ", "))) -}}
|
|
42
|
+
{{- else if eq .Layout "groups" -}}
|
|
43
|
+
{{- $labels := slice -}}
|
|
44
|
+
{{- range (partial "categories.html" .).all }}{{ $labels = $labels | append (partial "t.html" .) }}{{ end -}}
|
|
45
|
+
{{- $parts = slice (T "meta groups" (dict "Categories" (delimit $labels ", "))) -}}
|
|
46
|
+
{{- else if .IsHome -}}
|
|
47
|
+
{{- $parts = slice (T "meta home") -}}
|
|
48
|
+
{{- end -}}
|
|
49
|
+
|
|
50
|
+
{{- $sentences := slice -}}
|
|
51
|
+
{{- range $parts -}}
|
|
52
|
+
{{- with . }}{{ $sentences = $sentences | append (cond (findRE `[.!?…]$` .) . (printf "%s." .)) }}{{ end -}}
|
|
53
|
+
{{- end -}}
|
|
54
|
+
{{- $text := delimit $sentences " " -}}
|
|
55
|
+
{{- with $name -}}
|
|
56
|
+
{{- /* The name in the script of the language, then the other one — e.g. "Anchagi (안차기)". */ -}}
|
|
57
|
+
{{- $label := cond (and $other (ne $other $name)) (printf "%s (%s)" $name $other) $name -}}
|
|
58
|
+
{{- $text = cond (eq $text "") $label (printf "%s: %s" $label $text) -}}
|
|
59
|
+
{{- end -}}
|
|
60
|
+
{{- return $text -}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{{- /*
|
|
2
|
+
The spoken Korean name as a round play button. Without JavaScript the link
|
|
3
|
+
opens the file, which the browser plays itself. dict "pronunciation" …
|
|
4
|
+
*/ -}}
|
|
5
|
+
{{- with $p := .pronunciation -}}
|
|
6
|
+
{{- with resources.Get (printf "audio/%s" $p.src) -}}
|
|
7
|
+
{{- $label := T "listen to pronunciation" -}}
|
|
8
|
+
{{- if $p.ai }}{{ $label = printf "%s (%s)" $label (T "ai generated speech") }}{{ end -}}
|
|
9
|
+
{{- with $p.speaker }}{{ $label = printf "%s (%s %s)" $label (T "spoken by") . }}{{ end }}
|
|
10
|
+
<a class="pronounce" href="{{ .RelPermalink }}" type="{{ .MediaType.Type }}" title="{{ $label }}" aria-label="{{ $label }}" data-pronunciation>
|
|
11
|
+
<svg class="pronounce__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
12
|
+
<path d="M11 5 6 9H3v6h3l5 4z" fill="currentColor"></path>
|
|
13
|
+
<path class="pronounce__wave" d="M15.5 9.5a3.5 3.5 0 0 1 0 5"></path>
|
|
14
|
+
<path class="pronounce__wave pronounce__wave--outer" d="M18.5 6.5a8 8 0 0 1 0 11"></path>
|
|
15
|
+
</svg>
|
|
16
|
+
{{- if $p.ai }}
|
|
17
|
+
<span class="pronounce__ai" aria-hidden="true">
|
|
18
|
+
<svg viewBox="0 0 16 16"><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>
|
|
19
|
+
</span>
|
|
20
|
+
{{- end }}
|
|
21
|
+
</a>
|
|
22
|
+
{{- end -}}
|
|
23
|
+
{{- end -}}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
{{- /*
|
|
2
2
|
Every page works without JavaScript. The script adds the search, the image
|
|
3
|
-
gallery, the sorting switch, the language select
|
|
3
|
+
gallery, in-place pronunciations, the sorting switch, the language select
|
|
4
|
+
and offline support.
|
|
4
5
|
*/ -}}
|
|
5
|
-
{{- $homes := slice -}}
|
|
6
|
-
{{- range hugo.Sites }}{{ $homes = $homes | append .Home.RelPermalink }}{{ end -}}
|
|
7
6
|
{{- $config := dict
|
|
8
7
|
"home" (relLangURL "")
|
|
9
|
-
"homes" $homes
|
|
10
8
|
"searchIndex" (partialCached "search-index.html" . site.Language.Lang).RelPermalink
|
|
11
9
|
"serviceWorker" (cond hugo.IsProduction (relURL "sw.js") "")
|
|
12
10
|
"t" (dict
|
|
@@ -16,10 +14,8 @@
|
|
|
16
14
|
"techniques" (T "techniques")
|
|
17
15
|
"term" (T "term")
|
|
18
16
|
"terms" (T "terms")
|
|
19
|
-
"updateAvailable" (T "update available")
|
|
20
17
|
)
|
|
21
18
|
-}}
|
|
22
|
-
<script type="application/json" id="app-config">{{ jsonify $config | safeJS }}</script>
|
|
23
19
|
{{- 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>
|
|
20
|
+
<script type="module" src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" data-config="{{ jsonify $config }}"></script>
|
|
25
21
|
{{- end }}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
{{- $techniques = $techniques | append (dict
|
|
15
15
|
"name" $key
|
|
16
16
|
"supplementaryName" $t.supplementaryName
|
|
17
|
+
"hangeul" $t.hangeul
|
|
17
18
|
"translation" $translation
|
|
18
19
|
"display" (partial "technique-name.html" $key)
|
|
19
20
|
"subtitle" (cond $korean "" $translation)
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
{{- $description := index $t.plain $lang | default "" -}}
|
|
31
32
|
{{- $terms = $terms | append (dict
|
|
32
33
|
"name" $key
|
|
34
|
+
"hangeul" $t.hangeul
|
|
33
35
|
"description" $description
|
|
34
36
|
"display" (partial "term-name.html" $key)
|
|
35
37
|
"subtitle" (cond $korean "" $description)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{{- /* schema.org data of the page as JSON-LD. */ -}}
|
|
2
|
+
{{- $db := hugo.Data.taekwondo -}}
|
|
3
|
+
{{- $key := .Params.key -}}
|
|
4
|
+
{{- $lang := site.Language.Lang -}}
|
|
5
|
+
{{- $home := site.Home.Permalink -}}
|
|
6
|
+
{{- $website := dict "@type" "WebSite" "@id" (printf "%s#website" $home) "name" site.Title "url" $home "inLanguage" $lang -}}
|
|
7
|
+
{{- $termSet := dict "@type" "DefinedTermSet" "@id" (printf "%s#terms" $home) "name" site.Title "url" $home -}}
|
|
8
|
+
{{- $page := dict "name" (partial "page-title.html" .) "url" .Permalink "inLanguage" $lang -}}
|
|
9
|
+
{{- with partial "meta-description.html" . }}{{ $page = merge $page (dict "description" .) }}{{ end -}}
|
|
10
|
+
{{- $data := dict -}}
|
|
11
|
+
{{- $names := slice -}}
|
|
12
|
+
|
|
13
|
+
{{- if .IsHome -}}
|
|
14
|
+
{{- $search := dict
|
|
15
|
+
"@type" "SearchAction"
|
|
16
|
+
"target" (dict "@type" "EntryPoint" "urlTemplate" (printf "%s?search={query}" $home))
|
|
17
|
+
"query-input" "required name=query"
|
|
18
|
+
-}}
|
|
19
|
+
{{- $data = merge $website (dict "potentialAction" $search) -}}
|
|
20
|
+
{{- with $page.description }}{{ $data = merge $data (dict "description" .) }}{{ end -}}
|
|
21
|
+
{{- else if eq .Section "technique" -}}
|
|
22
|
+
{{- $t := index $db.techniques $key -}}
|
|
23
|
+
{{- $data = merge $page (dict "@type" "DefinedTerm" "termCode" $key "inDefinedTermSet" $termSet) -}}
|
|
24
|
+
{{- $names = slice $t.hangeul $t.name $t.supplementaryName -}}
|
|
25
|
+
{{- with index $t.images 0 -}}
|
|
26
|
+
{{- with resources.Get (printf "img/%s" .src) -}}
|
|
27
|
+
{{- $image := . -}}
|
|
28
|
+
{{- if in (slice "image/jpeg" "image/png" "image/webp") .MediaType.Type }}{{ $image = .Process "fit 1600x1600 webp" }}{{ end -}}
|
|
29
|
+
{{- $data = merge $data (dict "image" $image.Permalink) -}}
|
|
30
|
+
{{- end -}}
|
|
31
|
+
{{- end -}}
|
|
32
|
+
{{- else if eq .Section "term" -}}
|
|
33
|
+
{{- $term := index $db.terms $key -}}
|
|
34
|
+
{{- $data = merge $page (dict "@type" "DefinedTerm" "termCode" $key "inDefinedTermSet" $termSet) -}}
|
|
35
|
+
{{- $names = slice $term.hangeul $term.name $term.hanja -}}
|
|
36
|
+
{{- else if eq .Section "source" -}}
|
|
37
|
+
{{- $source := index $db.sources $key -}}
|
|
38
|
+
{{- $data = merge $page (dict "@type" (cond (eq $source.type "book") "Book" "CreativeWork")) -}}
|
|
39
|
+
{{- with $source.author }}{{ $data = merge $data (dict "author" .) }}{{ end -}}
|
|
40
|
+
{{- with $source.year }}{{ $data = merge $data (dict "datePublished" (string .)) }}{{ end -}}
|
|
41
|
+
{{- with $source.isbn }}{{ $data = merge $data (dict "isbn" .) }}{{ end -}}
|
|
42
|
+
{{- else if or (eq .Section "group") (eq .Layout "groups") -}}
|
|
43
|
+
{{- $data = merge $page (dict "@type" "CollectionPage" "isPartOf" $website) -}}
|
|
44
|
+
{{- else if eq .Kind "page" -}}
|
|
45
|
+
{{- $data = merge $page (dict "@type" "WebPage" "isPartOf" $website) -}}
|
|
46
|
+
{{- end -}}
|
|
47
|
+
|
|
48
|
+
{{- $alternate := slice -}}
|
|
49
|
+
{{- range $names }}{{ with . }}{{ if not (or (eq . $page.name) (in $alternate .)) }}{{ $alternate = $alternate | append . }}{{ end }}{{ end }}{{ end -}}
|
|
50
|
+
{{- with $alternate }}{{ $data = merge $data (dict "alternateName" .) }}{{ end -}}
|
|
51
|
+
|
|
52
|
+
{{- with $data }}
|
|
53
|
+
<script type="application/ld+json">{{ merge (dict "@context" "https://schema.org") . | jsonify | safeJS }}</script>
|
|
54
|
+
{{- end }}
|
package/layouts/baseof.html
CHANGED
|
@@ -21,19 +21,21 @@
|
|
|
21
21
|
{{- if ne site.Language.Lang hugo.Sites.Default.Language.Lang }}
|
|
22
22
|
{{- /* Pages of the default language without a version in this one are linked as well. */}}
|
|
23
23
|
{{- range hugo.Sites.Default.Menus.footer }}
|
|
24
|
-
{{- if
|
|
24
|
+
{{- if and .Page (not (where .Page.Translations "Language.Lang" site.Language.Lang)) }}{{ $links = $links | append . }}{{ end }}
|
|
25
25
|
{{- end }}
|
|
26
26
|
{{- end }}
|
|
27
27
|
{{- with sort $links "Weight" }}
|
|
28
|
-
<nav class="site-footer__links" aria-label="{{ T "
|
|
28
|
+
<nav class="site-footer__links" aria-label="{{ T "site info" }}">
|
|
29
29
|
{{- range . }}
|
|
30
|
-
{{- $lang :=
|
|
30
|
+
{{- $lang := "" }}
|
|
31
|
+
{{- with .Page }}{{ if ne .Language.Lang site.Language.Lang }}{{ $lang = .Language.Lang }}{{ end }}{{ end }}
|
|
31
32
|
<a href="{{ .URL }}"{{ with $lang }} hreflang="{{ . }}"{{ end }}>{{ or (T .Identifier) .Name }}</a>
|
|
32
33
|
{{- end }}
|
|
33
34
|
</nav>
|
|
34
35
|
{{- end }}
|
|
35
36
|
</footer>
|
|
36
37
|
</div>
|
|
38
|
+
{{- partial "downloads-dialog.html" . }}
|
|
37
39
|
{{- partial "scripts.html" . }}
|
|
38
40
|
</body>
|
|
39
41
|
</html>
|
package/layouts/source/page.html
CHANGED