Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Fix "tags" template #539

Merged
merged 3 commits into from
May 23, 2020
Merged

Conversation

siikamiika
Copy link
Collaborator

Fixes #538. Yet another issue caused by the data format issue of #337.

fieldTemplates += '\n\n' + replacement;
const replacements = [
[
'{{#*inline "audio"}}\n {{~#if definition.audioFileName~}}\n [sound:{{definition.audioFileName}}]\n {{~/if~}}\n{{/inline}}',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Flip the order of the [replacement, pattern] values, since it's kind of a pattern => replacement style.
  2. Move new RegExp(escapeRegExp( and ), 'g') inside the for.

Copy link
Collaborator Author

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();
Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

@toasted-nutbread
Copy link
Collaborator

Merging this on your behalf in your (semi-)absence.

@toasted-nutbread toasted-nutbread merged commit 39df44e into FooSoft:master May 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to add term's tags to Anki w/ {tags} marker
2 participants