aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-12 12:12:23 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-12 12:12:23 +0100
commitd0481b8c62bf8765207912ce3856655384dbcfe9 (patch)
tree629e00ef9649b28534584d8c1c594c2b22bd4bb7
parent4691cf3559f73cadb6d31c307c72f82aa6eb43da (diff)
downloadaskama-d0481b8c62bf8765207912ce3856655384dbcfe9.tar.gz
askama-d0481b8c62bf8765207912ce3856655384dbcfe9.tar.bz2
askama-d0481b8c62bf8765207912ce3856655384dbcfe9.zip
Improve formatting of generated code
-rw-r--r--askama/src/generator.rs9
1 files 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);