From 5a2bc4e542b7f22d1e6a4ba318cfcdc33817d34a Mon Sep 17 00:00:00 2001 From: Kuuuube <61125188+Kuuuube@users.noreply.github.com> Date: Fri, 2 Feb 2024 21:53:42 -0500 Subject: Add frequency number handlebars (#600) * Add frequencies-num handlebar * Fix handlebar name * Fix inconsistent variable name format * Add frequency-number to anki tests * Use full names for total and frequency variables * Migrate handlebars to JS, split rank and occurance, add average * Remove left behind frequency-number * Fix "occurrence" spelling * Cleanup types * Add frequency support for kanji cards * Fix code style * Clean up most of duplicate code and merge functions * Fix frequencies.length check * Use less witchcraft and remove redundant type casting --- .../default-anki-field-templates.handlebars | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'ext/data') diff --git a/ext/data/templates/default-anki-field-templates.handlebars b/ext/data/templates/default-anki-field-templates.handlebars index 0ea98e5e..07efd07e 100644 --- a/ext/data/templates/default-anki-field-templates.handlebars +++ b/ext/data/templates/default-anki-field-templates.handlebars @@ -302,6 +302,38 @@ {{~/if~}} {{/inline}} +{{#*inline "frequency-harmonic-rank"}} + {{~#if (op "===" definition.frequencyHarmonic -1) ~}} + 9999999 + {{~else ~}} + {{definition.frequencyHarmonic}} + {{~/if~}} +{{/inline}} + +{{#*inline "frequency-harmonic-occurrence"}} + {{~#if (op "===" definition.frequencyHarmonic -1) ~}} + 0 + {{~else ~}} + {{definition.frequencyHarmonic}} + {{~/if~}} +{{/inline}} + +{{#*inline "frequency-average-rank"}} + {{~#if (op "===" definition.frequencyAverage -1) ~}} + 9999999 + {{~else ~}} + {{definition.frequencyAverage}} + {{~/if~}} +{{/inline}} + +{{#*inline "frequency-average-occurrence"}} + {{~#if (op "===" definition.frequencyAverage -1) ~}} + 0 + {{~else ~}} + {{definition.frequencyAverage}} + {{~/if~}} +{{/inline}} + {{#*inline "stroke-count"}} {{~#scope~}} {{~set "found" false~}} -- cgit v1.2.3