From 1f3fae4b119633a29e93ae5186441bb873d6466c Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 25 Jul 2018 13:47:26 +0100 Subject: Tweak writeln() handling of state --- askama_derive/src/generator.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'askama_derive/src') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 3e050d5..bc24c06 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -943,17 +943,16 @@ impl Buffer { } fn writeln(&mut self, s: &str) { - if s.is_empty() { - return; - } if s == "}" { self.dedent(); } - self.write(s); + if !s.is_empty() { + self.write(s); + } + self.buf.push('\n'); if s.ends_with('{') { self.indent(); } - self.buf.push('\n'); self.start = true; } -- cgit