summaryrefslogtreecommitdiff
path: root/ext/bg/js/options.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-09 12:29:41 -0400
committerGitHub <noreply@github.com>2020-05-09 12:29:41 -0400
commitbdbe680f5cbe612df73cc0532f098f7973dfcc65 (patch)
tree27e168ad79ad6c4dcecf54c80d185faff10f32cf /ext/bg/js/options.js
parent9900291b073bb2b6495cae0993138c26970815a3 (diff)
Omit the sound tag if it's empty (#525)
Diffstat (limited to 'ext/bg/js/options.js')
-rw-r--r--ext/bg/js/options.js2
1 files changed, 1 insertions, 1 deletions
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;