summaryrefslogtreecommitdiff
path: root/ext/bg/js/dictionary.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-09-11 16:56:27 -0700
committerAlex Yatskov <alex@foosoft.net>2017-09-11 16:56:27 -0700
commit3a1aad07d61411f634e86f905babd6fbbac2eae1 (patch)
treef343fc427c0c791823a39a482dc3d1cd35d34253 /ext/bg/js/dictionary.js
parent65b679caeb7ae7261ea6f2ba76d1b14ff1d68c5c (diff)
parent2eb85cb835a4aece7839eba25c0030e9eb186f85 (diff)
Merge branch 'master' into firefox-amo
Diffstat (limited to 'ext/bg/js/dictionary.js')
-rw-r--r--ext/bg/js/dictionary.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index 78240157..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',
@@ -218,19 +218,19 @@ function dictFieldFormat(field, definition, mode, options) {
marker,
definition,
group: options.general.groupResults,
- html: options.anki.htmlCards,
modeTermKanji: mode === 'term-kanji',
modeTermKana: mode === 'term-kana',
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 = [];
@@ -264,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;