aboutsummaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
authorStefanVukovic99 <stefanvukovic44@gmail.com>2024-03-03 05:48:57 +0100
committerGitHub <noreply@github.com>2024-03-03 04:48:57 +0000
commit5ec2344df95da39cda4ad07cfe5181b05fa24830 (patch)
tree3774ad807c1b2c301fd0e49ae1c2548e0c4fc6bf /ext/js
parentf162884b4cbfa5adf4a4e3dbbbad0d635fb5d603 (diff)
fix whitespace (#755)
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);
}