aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-07-25 13:47:26 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-07-25 13:49:50 +0100
commit1f3fae4b119633a29e93ae5186441bb873d6466c (patch)
tree75cab8d621d1de03842099ef7850769d0d392265 /askama_derive
parent396b2b09289a55f60485b99ab608c9aca5ed0d96 (diff)
downloadaskama-1f3fae4b119633a29e93ae5186441bb873d6466c.tar.gz
askama-1f3fae4b119633a29e93ae5186441bb873d6466c.tar.bz2
askama-1f3fae4b119633a29e93ae5186441bb873d6466c.zip
Tweak writeln() handling of state
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs9
1 files changed, 4 insertions, 5 deletions
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;
}