aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src
diff options
context:
space:
mode:
Diffstat (limited to 'askama_derive/src')
-rw-r--r--askama_derive/src/generator.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 5af38c0..db9ac17 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -117,6 +117,11 @@ impl<'a> Generator<'a> {
self.flush_ws(WS(false, false));
self.writeln("Ok(())");
self.writeln("}");
+
+ self.writeln("fn extension(&self) -> Option<&str> {");
+ self.writeln(&format!("{:?}", self.input.path.extension().map(|s| s.to_str().unwrap())));
+ self.writeln("}");
+
self.writeln("}");
}