aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/template-renderer.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-04 17:57:05 -0400
committerGitHub <noreply@github.com>2020-09-04 17:57:05 -0400
commit21fc0a80f2382f383ae5df221b17313e72b809db (patch)
tree6ac00942df30bc12a1cf132fa203934cba5e7967 /ext/bg/js/template-renderer.js
parent3efd4a1a94ddac6b0c9e0d3cf6fa7eb5621bf8a2 (diff)
Defer assignment of marker (#762)
Diffstat (limited to 'ext/bg/js/template-renderer.js')
-rw-r--r--ext/bg/js/template-renderer.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/bg/js/template-renderer.js b/ext/bg/js/template-renderer.js
index 59af74c8..1f68e3e0 100644
--- a/ext/bg/js/template-renderer.js
+++ b/ext/bg/js/template-renderer.js
@@ -28,7 +28,7 @@ class TemplateRenderer {
this._stateStack = null;
}
- async render(template, data) {
+ async render(template, data, marker) {
if (!this._helpersRegistered) {
this._registerHelpers();
this._helpersRegistered = true;
@@ -42,11 +42,19 @@ class TemplateRenderer {
cache.set(template, instance);
}
+ const markerPre = data.marker;
+ const markerPreHas = hasOwn(data, 'marker');
try {
this._stateStack = [new Map()];
+ data.marker = marker;
return instance(data).trim();
} finally {
this._stateStack = null;
+ if (markerPreHas) {
+ data.marker = markerPre;
+ } else {
+ delete data.marker;
+ }
}
}