diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-14 16:59:44 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-29 12:33:03 -0500 |
commit | 3033fea31e4bc9ba7198d2d31d6f6046813926d1 (patch) | |
tree | 4d6e212260ee9bca9f4807fe6d6fefbe9ed12f22 /ext/bg/js/dictionary.js | |
parent | 024f969bfd884e43cd40f408d0e3ba32839be45f (diff) |
Treat null templates as the default value
Diffstat (limited to 'ext/bg/js/dictionary.js')
-rw-r--r-- | ext/bg/js/dictionary.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js index 0b35e32e..28705513 100644 --- a/ext/bg/js/dictionary.js +++ b/ext/bg/js/dictionary.js @@ -310,7 +310,7 @@ function dictFieldSplit(field) { return field.length === 0 ? [] : field.split(' '); } -async function dictFieldFormat(field, definition, mode, options, exceptions) { +async function dictFieldFormat(field, definition, mode, options, templates, exceptions) { const data = { marker: null, definition, @@ -329,7 +329,7 @@ async function dictFieldFormat(field, definition, mode, options, exceptions) { } data.marker = marker; try { - return await apiTemplateRender(options.anki.fieldTemplates, data, true); + return await apiTemplateRender(templates, data, true); } catch (e) { if (exceptions) { exceptions.push(e); } return `{${marker}-render-error}`; @@ -357,7 +357,7 @@ dictFieldFormat.markers = new Set([ 'url' ]); -async function dictNoteFormat(definition, mode, options) { +async function dictNoteFormat(definition, mode, options, templates) { const note = {fields: {}, tags: options.anki.tags}; let fields = []; @@ -391,7 +391,7 @@ async function dictNoteFormat(definition, mode, options) { } for (const name in fields) { - note.fields[name] = await dictFieldFormat(fields[name], definition, mode, options); + note.fields[name] = await dictFieldFormat(fields[name], definition, mode, options, templates); } return note; |