summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/data/default-anki-field-templates.handlebars8
-rw-r--r--ext/bg/js/options.js2
2 files changed, 6 insertions, 4 deletions
diff --git a/ext/bg/data/default-anki-field-templates.handlebars b/ext/bg/data/default-anki-field-templates.handlebars
index 77818a43..4382f707 100644
--- a/ext/bg/data/default-anki-field-templates.handlebars
+++ b/ext/bg/data/default-anki-field-templates.handlebars
@@ -14,9 +14,11 @@
{{~/if~}}
{{/inline}}
-{{#*inline "audio"~}}
- [sound:{{definition.audioFileName}}]
-{{~/inline}}
+{{#*inline "audio"}}
+ {{~#if definition.audioFileName~}}
+ [sound:{{definition.audioFileName}}]
+ {{~/if~}}
+{{/inline}}
{{#*inline "character"}}
{{~definition.character~}}
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 47101b49..10df033c 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -115,7 +115,7 @@ const profileOptionsVersionUpdates = [
let fieldTemplates = options.anki.fieldTemplates;
if (typeof fieldTemplates !== 'string') { return; }
- const replacement = '{{#*inline "audio"~}}\n [sound:{{definition.audioFileName}}]\n{{~/inline}}';
+ const replacement = '{{#*inline "audio"}}\n {{~#if definition.audioFileName~}}\n [sound:{{definition.audioFileName}}]\n {{~/if~}}\n{{/inline}}';
let replaced = false;
fieldTemplates = fieldTemplates.replace(/\{\{#\*inline "audio"\}\}\{\{\/inline\}\}/g, () => {
replaced = true;