diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-09-06 13:35:18 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-09-06 13:35:18 -0700 |
commit | 9efe7bfe1b904db43fafda3520d702c17f44b362 (patch) | |
tree | 696d1d3de9bc968e9801c10a220c3e2819024d94 /ext/bg/js/dictionary.js | |
parent | a3c8508031a1073629803d0616a2ee416cd3cccc (diff) |
work on sandbox
Diffstat (limited to 'ext/bg/js/dictionary.js')
-rw-r--r-- | ext/bg/js/dictionary.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js index 960ff84d..e749390f 100644 --- a/ext/bg/js/dictionary.js +++ b/ext/bg/js/dictionary.js @@ -192,7 +192,7 @@ function dictFieldSplit(field) { return field.length === 0 ? [] : field.split(' '); } -function dictFieldFormat(field, definition, mode, options) { +async function dictFieldFormat(field, definition, mode, options) { const markers = [ 'audio', 'character', @@ -223,13 +223,14 @@ function dictFieldFormat(field, definition, mode, options) { modeKanji: mode === 'kanji' }; - field = field.replace(`{${marker}}`, handlebarsRender('fields.html', data)); + const html = await apiTemplateRender(options.anki.fieldTemplates, data, true); + field = field.replace(`{${marker}}`, html); } return field; } -function dictNoteFormat(definition, mode, options) { +async function dictNoteFormat(definition, mode, options) { const note = {fields: {}, tags: options.anki.tags}; let fields = []; @@ -263,7 +264,7 @@ function dictNoteFormat(definition, mode, options) { } for (const name in fields) { - note.fields[name] = dictFieldFormat(fields[name], definition, mode, options); + note.fields[name] = await dictFieldFormat(fields[name], definition, mode, options); } return note; |