Dictionary definition structure fixes (#888)

* Restore support for tags without metadata

* Fix missing spread
This commit is contained in:
toasted-nutbread 2020-10-05 21:10:52 -04:00 committed by GitHub
parent 8c8c27001e
commit 0cfaa1a5a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -446,7 +446,7 @@ class Translator {
this._addUniqueTermInfos(relatedDefinitions, termInfoMap);
let secondaryDefinitions = await this._getMergedSecondarySearchResults(termInfoMap, secondarySearchDictionaryMap);
secondaryDefinitions = [unsequencedDefinitions, ...secondaryDefinitions];
secondaryDefinitions = [...unsequencedDefinitions, ...secondaryDefinitions];
this._removeUsedDefinitions(secondaryDefinitions, termInfoMap, usedDefinitions);
this._removeDuplicateDefinitions(secondaryDefinitions);
@ -721,9 +721,8 @@ class Translator {
const results = [];
for (let i = 0, ii = tagMetaList.length; i < ii; ++i) {
const meta = tagMetaList[i];
if (meta === null) { continue; }
const name = names[i];
const {category, notes, order, score, dictionary} = meta;
const {category, notes, order, score, dictionary} = (meta !== null ? meta : {dictionary: title});
const tag = this._createTag(name, category, notes, order, score, dictionary);
results.push(tag);
}