aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/parser.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-06 14:51:56 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-06 14:51:56 +0200
commitb9cb5b82e6c87bf0f6037d097476d69f5241bf3a (patch)
tree4bc900914e1c3285b5a0bfdb3bd41d991d426502 /askama_derive/src/parser.rs
parent05f11a6843b482176c32d758e0c4f676d33c16be (diff)
downloadaskama-b9cb5b82e6c87bf0f6037d097476d69f5241bf3a.tar.gz
askama-b9cb5b82e6c87bf0f6037d097476d69f5241bf3a.tar.bz2
askama-b9cb5b82e6c87bf0f6037d097476d69f5241bf3a.zip
Merge handling of trailing newline into get_template_source()
Diffstat (limited to 'askama_derive/src/parser.rs')
-rw-r--r--askama_derive/src/parser.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/askama_derive/src/parser.rs b/askama_derive/src/parser.rs
index d466379..ad23cce 100644
--- a/askama_derive/src/parser.rs
+++ b/askama_derive/src/parser.rs
@@ -323,16 +323,10 @@ named!(block_include<Node>, do_parse!(
ws!(tag_s!("include")) >>
name: ws!(expr_str_lit) >>
nws: opt!(tag_s!("-")) >>
- ({
- let mut src = match name {
- Expr::StrLit(s) => path::get_template_source(s),
- _ => panic!("include path must be a string literal"),
- };
- if src.ends_with('\n') {
- let _ = src.pop();
- }
- Node::Include(WS(pws.is_some(), nws.is_some()), src)
- })
+ (Node::Include(WS(pws.is_some(), nws.is_some()), match name {
+ Expr::StrLit(s) => path::get_template_source(s),
+ _ => panic!("include path must be a string literal"),
+ }))
));
named!(block_node<Node>, do_parse!(