summaryrefslogtreecommitdiff
path: root/ext/bg/data
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-28 14:30:50 -0500
committerGitHub <noreply@github.com>2020-11-28 14:30:50 -0500
commit008ffdb6bffc2855957be948a24c9e07730501d6 (patch)
treebe6642b030011f0007aad1025da3c5accd0d9a54 /ext/bg/data
parent94d63f4f87a61f7e42ea44d8100ea11d5ccdbce0 (diff)
Frequencies marker (#1074)
* Update japanese.js tests * Simplify fallback/early exit * Add overloads to furigana and furiganaPlain handlebars helper functions * Expose unique expression/reading arrays (and subsequently counts) * Add {frequencies} marker
Diffstat (limited to 'ext/bg/data')
-rw-r--r--ext/bg/data/anki-field-templates-upgrade-v6.handlebars17
-rw-r--r--ext/bg/data/default-anki-field-templates.handlebars17
2 files changed, 34 insertions, 0 deletions
diff --git a/ext/bg/data/anki-field-templates-upgrade-v6.handlebars b/ext/bg/data/anki-field-templates-upgrade-v6.handlebars
index 33a2f949..809423ce 100644
--- a/ext/bg/data/anki-field-templates-upgrade-v6.handlebars
+++ b/ext/bg/data/anki-field-templates-upgrade-v6.handlebars
@@ -6,3 +6,20 @@
{{~/each~}}
{{~/if~}}
{{/inline}}
+
+{{#*inline "frequencies"}}
+ {{~#if (op ">" definition.frequencies.length 0)~}}
+ <ul style="text-align: left;">
+ {{~#each definition.frequencies~}}
+ <li>
+ {{~#if (op "!==" ../definition.type "kanji")~}}
+ {{~#if (op "||" (op ">" ../uniqueExpressions.length 1) (op ">" ../uniqueReadings.length 1))~}}(
+ {{~#furigana expression reading~}}{{~/furigana~}}
+ ) {{/if~}}
+ {{~/if~}}
+ {{~dictionary}}: {{frequency~}}
+ </li>
+ {{~/each~}}
+ </ul>
+ {{~/if~}}
+{{/inline}}
diff --git a/ext/bg/data/default-anki-field-templates.handlebars b/ext/bg/data/default-anki-field-templates.handlebars
index 0b0e9ca6..1024e2e6 100644
--- a/ext/bg/data/default-anki-field-templates.handlebars
+++ b/ext/bg/data/default-anki-field-templates.handlebars
@@ -306,4 +306,21 @@
{{~/if~}}
{{/inline}}
+{{#*inline "frequencies"}}
+ {{~#if (op ">" definition.frequencies.length 0)~}}
+ <ul style="text-align: left;">
+ {{~#each definition.frequencies~}}
+ <li>
+ {{~#if (op "!==" ../definition.type "kanji")~}}
+ {{~#if (op "||" (op ">" ../uniqueExpressions.length 1) (op ">" ../uniqueReadings.length 1))~}}(
+ {{~#furigana expression reading~}}{{~/furigana~}}
+ ) {{/if~}}
+ {{~/if~}}
+ {{~dictionary}}: {{frequency~}}
+ </li>
+ {{~/each~}}
+ </ul>
+ {{~/if~}}
+{{/inline}}
+
{{~> (lookup . "marker") ~}}