aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_shared/src/generator.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
index 13c5072..f58d1dd 100644
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -457,10 +457,12 @@ impl<'a> Generator<'a> {
panic!(format!("macro '{}' not found", name));
}
});
+
self.flush_ws(ws); // Cannot handle_ws() here: whitespace from macro definition comes first
self.locals.push();
self.writeln("{");
self.prepare_ws(&def.ws1);
+
for (i, arg) in def.args.iter().enumerate() {
self.write(&format!("let {} = &", arg));
self.visit_expr(args.get(i)
@@ -469,6 +471,7 @@ impl<'a> Generator<'a> {
self.locals.insert(arg);
}
self.handle(state, &def.nodes, AstLevel::Nested);
+
self.flush_ws(&def.ws2);
self.writeln("}");
self.locals.pop();