aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama/src/generator.rs40
1 files changed, 20 insertions, 20 deletions
diff --git a/askama/src/generator.rs b/askama/src/generator.rs
index eee8bc5..f327d26 100644
--- a/askama/src/generator.rs
+++ b/askama/src/generator.rs
@@ -77,6 +77,26 @@ impl<'a> Generator<'a> {
self.start = true;
}
+ fn flush_ws(&mut self, ws: &WS) {
+ if self.next_ws.is_some() && !ws.0 {
+ let val = self.next_ws.unwrap();
+ if !val.is_empty() {
+ self.writeln(&format!("writer.write_str({:#?}).unwrap();",
+ val));
+ }
+ }
+ self.next_ws = None;
+ }
+
+ fn prepare_ws(&mut self, ws: &WS) {
+ self.skip_ws = ws.1;
+ }
+
+ fn handle_ws(&mut self, ws: &WS) {
+ self.flush_ws(ws);
+ self.prepare_ws(ws);
+ }
+
fn visit_str_lit(&mut self, s: &str) {
self.write(&format!("\"{}\"", s));
}
@@ -121,26 +141,6 @@ impl<'a> Generator<'a> {
}
}
- fn flush_ws(&mut self, ws: &WS) {
- if self.next_ws.is_some() && !ws.0 {
- let val = self.next_ws.unwrap();
- if !val.is_empty() {
- self.writeln(&format!("writer.write_str({:#?}).unwrap();",
- val));
- }
- }
- self.next_ws = None;
- }
-
- fn prepare_ws(&mut self, ws: &WS) {
- self.skip_ws = ws.1;
- }
-
- fn handle_ws(&mut self, ws: &WS) {
- self.flush_ws(ws);
- self.prepare_ws(ws);
- }
-
fn write_lit(&mut self, lws: &'a str, val: &str, rws: &'a str) {
assert!(self.next_ws.is_none());
if !lws.is_empty() {