aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/anki-note-builder.js
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/js/anki-note-builder.js
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/js/anki-note-builder.js')
-rw-r--r--ext/bg/js/anki-note-builder.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/bg/js/anki-note-builder.js b/ext/bg/js/anki-note-builder.js
index 33cd3a0b..b6114e4b 100644
--- a/ext/bg/js/anki-note-builder.js
+++ b/ext/bg/js/anki-note-builder.js
@@ -108,9 +108,19 @@ class AnkiNoteBuilder {
_createNoteData(definition, mode, context, resultOutputMode, glossaryLayoutMode, compactTags) {
const pitches = DictionaryDataUtil.getPitchAccentInfos(definition);
const pitchCount = pitches.reduce((i, v) => i + v.pitches.length, 0);
+ const uniqueExpressions = new Set();
+ const uniqueReadings = new Set();
+ if (definition.type !== 'kanji') {
+ for (const {expression, reading} of definition.expressions) {
+ uniqueExpressions.add(expression);
+ uniqueReadings.add(reading);
+ }
+ }
return {
marker: null,
definition,
+ uniqueExpressions: [...uniqueExpressions],
+ uniqueReadings: [...uniqueReadings],
pitches,
pitchCount,
group: resultOutputMode === 'group',