From d0481b8c62bf8765207912ce3856655384dbcfe9 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sun, 12 Feb 2017 12:12:23 +0100 Subject: Improve formatting of generated code --- askama/src/generator.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/askama/src/generator.rs b/askama/src/generator.rs index 5e5f8bf..9c3581d 100644 --- a/askama/src/generator.rs +++ b/askama/src/generator.rs @@ -125,8 +125,8 @@ impl<'a> Generator<'a> { if self.next_ws.is_some() && !ws.0 { let val = self.next_ws.unwrap(); if !val.is_empty() { - self.write(&format!("writer.write_str({:#?}).unwrap();", - val)); + self.writeln(&format!("writer.write_str({:#?}).unwrap();", + val)); } } else if self.next_ws.is_some() { } @@ -151,11 +151,12 @@ impl<'a> Generator<'a> { assert!(rws.is_empty()); self.next_ws = Some(lws); } else { - self.write(&format!("writer.write_str({:#?}).unwrap();", lws)); + self.writeln(&format!("writer.write_str({:#?}).unwrap();", + lws)); } } if !val.is_empty() { - self.write(&format!("writer.write_str({:#?}).unwrap();", val)); + self.writeln(&format!("writer.write_str({:#?}).unwrap();", val)); } if !rws.is_empty() { self.next_ws = Some(rws); -- cgit