diff options
author | praschke <stel@comfy.monster> | 2023-10-17 21:21:30 +0100 |
---|---|---|
committer | praschke <stel@comfy.monster> | 2023-10-17 21:21:30 +0100 |
commit | 0506cfbee5443635ebd6ac79054b85f171775039 (patch) | |
tree | e81dad47651dc4f1c605b603a2f0de19547cad13 | |
parent | c3be9af7b6f00dad7107fcdae60a8004cc81936a (diff) |
initial handlebars patch
-rw-r--r-- | ext/data/templates/anki-field-templates-upgrade-v21.handlebars | 0 | ||||
-rw-r--r-- | ext/js/data/options-util.js | 8 | ||||
-rw-r--r-- | test/test-options-util.js | 15 |
3 files changed, 20 insertions, 3 deletions
diff --git a/ext/data/templates/anki-field-templates-upgrade-v21.handlebars b/ext/data/templates/anki-field-templates-upgrade-v21.handlebars new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/ext/data/templates/anki-field-templates-upgrade-v21.handlebars diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index 2674701f..7b050416 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -470,7 +470,8 @@ class OptionsUtil { {async: false, update: this._updateVersion17.bind(this)}, {async: false, update: this._updateVersion18.bind(this)}, {async: false, update: this._updateVersion19.bind(this)}, - {async: false, update: this._updateVersion20.bind(this)} + {async: false, update: this._updateVersion20.bind(this)}, + {async: true, update: this._updateVersion21.bind(this)} ]; if (typeof targetVersion === 'number' && targetVersion < result.length) { result.splice(targetVersion); @@ -997,4 +998,9 @@ class OptionsUtil { } return options; } + + async _updateVersion21(options) { + await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v21.handlebars'); + return options; + } } diff --git a/test/test-options-util.js b/test/test-options-util.js index 2be6b2f7..068367a2 100644 --- a/test/test-options-util.js +++ b/test/test-options-util.js @@ -622,7 +622,7 @@ function createOptionsUpdatedTestData1() { } ], profileCurrent: 0, - version: 20, + version: 21, global: { database: { prefixWildcardsSupported: false @@ -689,7 +689,8 @@ async function testFieldTemplatesUpdate(extDir) { {version: 8, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v8.handlebars')}, {version: 10, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v10.handlebars')}, {version: 12, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v12.handlebars')}, - {version: 13, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v13.handlebars')} + {version: 13, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v13.handlebars')}, + {version: 21, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v21.handlebars')} ]; const getUpdateAdditions = (startVersion, targetVersion) => { let value = ''; @@ -1215,6 +1216,16 @@ async function testFieldTemplatesUpdate(extDir) { <<<UPDATE-ADDITIONS>>> {{~> (lookup . "marker") ~}}`.trimStart() + }, + // block helper update + { + oldVersion: 20, + newVersion: 21, + old: ` +{{~> (lookup . "marker") ~}}`.trimStart(), + + expected: ` +{{~> (lookup . "marker") ~}}`.trimStart() } ]; |