aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index c4315d0..f1e1174 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -751,6 +751,12 @@ impl<'a> Generator<'a> {
self.prepare_ws(*ws1);
self.locals.push();
let size_hint = self.handle(ctx, nodes, buf, AstLevel::Block);
+
+ if !self.locals.is_current_empty() {
+ // Need to flush the buffer before popping the variable stack
+ self.write_buf_writable(buf);
+ }
+
self.locals.pop();
self.flush_ws(*ws2);
@@ -1292,6 +1298,9 @@ where
None => false,
}
}
+ fn is_current_empty(&self) -> bool {
+ self.scopes.last().unwrap().is_empty()
+ }
fn insert(&mut self, val: T) {
self.scopes.last_mut().unwrap().insert(val);
}