aboutsummaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js')
-rw-r--r--ext/js/data/options-util.js10
-rw-r--r--ext/js/templates/sandbox/template-renderer.js2
2 files changed, 10 insertions, 2 deletions
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js
index cac2f82d..d89b3370 100644
--- a/ext/js/data/options-util.js
+++ b/ext/js/data/options-util.js
@@ -533,7 +533,8 @@ export class OptionsUtil {
this._updateVersion24,
this._updateVersion25,
this._updateVersion26,
- this._updateVersion27
+ this._updateVersion27,
+ this._updateVersion28
];
/* eslint-enable @typescript-eslint/unbound-method */
if (typeof targetVersion === 'number' && targetVersion < result.length) {
@@ -1199,6 +1200,13 @@ export class OptionsUtil {
await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v27.handlebars');
}
+ /**
+ * - Removed whitespace in URL handlebars template.
+ * @type {import('options-util').UpdateFunction}
+ */
+ async _updateVersion28(options) {
+ await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v28.handlebars');
+ }
/**
* @param {string} url
diff --git a/ext/js/templates/sandbox/template-renderer.js b/ext/js/templates/sandbox/template-renderer.js
index 90fb63f3..84eb6a19 100644
--- a/ext/js/templates/sandbox/template-renderer.js
+++ b/ext/js/templates/sandbox/template-renderer.js
@@ -140,7 +140,7 @@ export class TemplateRenderer {
let additions2;
try {
additions1 = (typeof renderSetup === 'function' ? renderSetup(data) : null);
- result = instance(data).trim();
+ result = instance(data).replace(/^\n+|\n+$/g, '');
} finally {
additions2 = (typeof renderCleanup === 'function' ? renderCleanup(data) : null);
}