Fix template updates for multiple declarations (#918)
* Update pattern to be multi-match * Remove unnecessary async
This commit is contained in:
parent
4ca6101273
commit
a72c3d7719
@ -380,13 +380,13 @@ class OptionsUtil {
|
|||||||
if (addition === null) {
|
if (addition === null) {
|
||||||
addition = await this._fetchAsset(additionSourceUrl);
|
addition = await this._fetchAsset(additionSourceUrl);
|
||||||
}
|
}
|
||||||
profileOptions.anki.fieldTemplates = await this._addFieldTemplatesBeforeEnd(fieldTemplates, addition);
|
profileOptions.anki.fieldTemplates = this._addFieldTemplatesBeforeEnd(fieldTemplates, addition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _addFieldTemplatesBeforeEnd(fieldTemplates, addition) {
|
_addFieldTemplatesBeforeEnd(fieldTemplates, addition) {
|
||||||
const pattern = /[ \t]*\{\{~?>\s*\(\s*lookup\s*\.\s*"marker"\s*\)\s*~?\}\}/;
|
const pattern = /[ \t]*\{\{~?>\s*\(\s*lookup\s*\.\s*"marker"\s*\)\s*~?\}\}/g;
|
||||||
const newline = '\n';
|
const newline = '\n';
|
||||||
let replaced = false;
|
let replaced = false;
|
||||||
fieldTemplates = fieldTemplates.replace(pattern, (g0) => {
|
fieldTemplates = fieldTemplates.replace(pattern, (g0) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user