From 3d9048ab50b1030ff741371ed0d853fcc3ab5780 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sun, 15 Oct 2017 15:02:50 +0200 Subject: Add some whitespace to write_call() --- askama_shared/src/generator.rs | 3 +++ 1 file changed, 3 insertions(+) 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(); -- cgit