diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-05-08 13:16:56 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-05-08 15:25:35 -0400 |
commit | ff93079a784fd2673f85d09c6d3678ac7ff05cfd (patch) | |
tree | 101145949bb01c1810c430e80720c5b34db77b85 /ext/js/data/anki-note-data-creator.js | |
parent | 5457a4ce32f02991551e69fb68e7aaf49b445d87 (diff) |
Improve term grouping (#1653)
* Rename _addUniqueStrings to _addUniqueSimple
* Update definition merging to not depend the sequence number
* Improve naming
* Update AnkiNoteDataCreator
* Update docs
* Remove fields that no longer exist
* Update test data
Diffstat (limited to 'ext/js/data/anki-note-data-creator.js')
-rw-r--r-- | ext/js/data/anki-note-data-creator.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/js/data/anki-note-data-creator.js b/ext/js/data/anki-note-data-creator.js index 3046a92e..d1bbec18 100644 --- a/ext/js/data/anki-note-data-creator.js +++ b/ext/js/data/anki-note-data-creator.js @@ -362,7 +362,7 @@ class AnkiNoteDataCreator { const definitions = []; const definitionTags = []; - for (const {tags, headwordIndices, entries, dictionary, sequence} of dictionaryEntry.definitions) { + for (const {tags, headwordIndices, entries, dictionary, sequences} of dictionaryEntry.definitions) { const definitionTags2 = []; for (const tag of tags) { definitionTags.push(this._convertTag(tag)); @@ -371,7 +371,7 @@ class AnkiNoteDataCreator { if (!hasDefinitions) { continue; } const only = merged ? DictionaryDataUtil.getDisambiguations(dictionaryEntry.headwords, headwordIndices, allTermsSet, allReadingsSet) : void 0; definitions.push({ - sequence, + sequence: sequences[0], dictionary, glossary: entries, definitionTags: definitionTags2, @@ -613,8 +613,9 @@ class AnkiNoteDataCreator { _getTermDictionaryEntrySequence(dictionaryEntry) { let hasSequence = false; let mainSequence = -1; - for (const {sequence, isPrimary} of dictionaryEntry.definitions) { + for (const {sequences, isPrimary} of dictionaryEntry.definitions) { if (!isPrimary) { continue; } + const sequence = sequences[0]; if (!hasSequence) { mainSequence = sequence; hasSequence = true; |