-
Notifications
You must be signed in to change notification settings - Fork 231
Fix "tags" template #539
Fix "tags" template #539
Conversation
ext/bg/js/options.js
Outdated
fieldTemplates += '\n\n' + replacement; | ||
const replacements = [ | ||
[ | ||
'{{#*inline "audio"}}\n {{~#if definition.audioFileName~}}\n [sound:{{definition.audioFileName}}]\n {{~/if~}}\n{{/inline}}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Flip the order of the
[replacement, pattern]
values, since it's kind of apattern => replacement
style. - Move
new RegExp(escapeRegExp(
and), 'g')
inside thefor
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -150,7 +150,7 @@ class Backend { | |||
await profileConditionsDescriptorPromise; | |||
|
|||
this.optionsSchema = await requestJson(chrome.runtime.getURL('/bg/data/options-schema.json'), 'GET'); | |||
this.defaultAnkiFieldTemplates = await requestText(chrome.runtime.getURL('/bg/data/default-anki-field-templates.handlebars'), 'GET'); | |||
this.defaultAnkiFieldTemplates = (await requestText(chrome.runtime.getURL('/bg/data/default-anki-field-templates.handlebars'), 'GET')).trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something that could cause issues in the future? I think it should work fine as long as you don't compare anything with the raw result from the .handlebars
file. I did it this way because I've configured my editor to ensure a newline at the end of the file and it was added when I modified the tags
template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should probably be fine.
Merging this on your behalf in your (semi-)absence. |
Fixes #538. Yet another issue caused by the data format issue of #337.