Omit the sound tag if it's empty (#525)
This commit is contained in:
parent
9900291b07
commit
bdbe680f5c
@ -14,9 +14,11 @@
|
|||||||
{{~/if~}}
|
{{~/if~}}
|
||||||
{{/inline}}
|
{{/inline}}
|
||||||
|
|
||||||
{{#*inline "audio"~}}
|
{{#*inline "audio"}}
|
||||||
[sound:{{definition.audioFileName}}]
|
{{~#if definition.audioFileName~}}
|
||||||
{{~/inline}}
|
[sound:{{definition.audioFileName}}]
|
||||||
|
{{~/if~}}
|
||||||
|
{{/inline}}
|
||||||
|
|
||||||
{{#*inline "character"}}
|
{{#*inline "character"}}
|
||||||
{{~definition.character~}}
|
{{~definition.character~}}
|
||||||
|
@ -115,7 +115,7 @@ const profileOptionsVersionUpdates = [
|
|||||||
let fieldTemplates = options.anki.fieldTemplates;
|
let fieldTemplates = options.anki.fieldTemplates;
|
||||||
if (typeof fieldTemplates !== 'string') { return; }
|
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;
|
let replaced = false;
|
||||||
fieldTemplates = fieldTemplates.replace(/\{\{#\*inline "audio"\}\}\{\{\/inline\}\}/g, () => {
|
fieldTemplates = fieldTemplates.replace(/\{\{#\*inline "audio"\}\}\{\{\/inline\}\}/g, () => {
|
||||||
replaced = true;
|
replaced = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user