aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive
diff options
context:
space:
mode:
Diffstat (limited to 'askama_derive')
-rw-r--r--askama_derive/src/generator.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index de2e6f2..ac23290 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -121,6 +121,8 @@ impl<'a> Generator<'a> {
Self::new(self.locals, self.indent)
}
+ /* Helper methods for writing to internal buffer */
+
fn indent(&mut self) {
self.indent += 1;
}
@@ -154,6 +156,8 @@ impl<'a> Generator<'a> {
self.start = true;
}
+ /* Helper methods for dealing with whitespace nodes */
+
fn flush_ws(&mut self, ws: &WS) {
if self.next_ws.is_some() && !ws.0 {
let val = self.next_ws.unwrap();
@@ -174,6 +178,8 @@ impl<'a> Generator<'a> {
self.prepare_ws(ws);
}
+ /* Visitor methods for expression types */
+
fn visit_num_lit(&mut self, s: &str) {
self.write(s);
}
@@ -273,6 +279,8 @@ impl<'a> Generator<'a> {
}
}
+ /* Helper methods for handling node types */
+
fn write_lit(&mut self, lws: &'a str, val: &str, rws: &'a str) {
assert!(self.next_ws.is_none());
if !lws.is_empty() {