diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-08-06 14:51:56 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-08-06 14:51:56 +0200 |
commit | b9cb5b82e6c87bf0f6037d097476d69f5241bf3a (patch) | |
tree | 4bc900914e1c3285b5a0bfdb3bd41d991d426502 /askama_derive/src/path.rs | |
parent | 05f11a6843b482176c32d758e0c4f676d33c16be (diff) | |
download | askama-b9cb5b82e6c87bf0f6037d097476d69f5241bf3a.tar.gz askama-b9cb5b82e6c87bf0f6037d097476d69f5241bf3a.tar.bz2 askama-b9cb5b82e6c87bf0f6037d097476d69f5241bf3a.zip |
Merge handling of trailing newline into get_template_source()
Diffstat (limited to '')
-rw-r--r-- | askama_derive/src/path.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/askama_derive/src/path.rs b/askama_derive/src/path.rs index e48f7d7..28b1b17 100644 --- a/askama_derive/src/path.rs +++ b/askama_derive/src/path.rs @@ -46,6 +46,9 @@ pub fn get_template_source(tpl_file: &str) -> String { }; let mut s = String::new(); f.read_to_string(&mut s).unwrap(); + if s.ends_with('\n') { + let _ = s.pop(); + } s } @@ -56,7 +59,7 @@ mod tests { #[test] fn get_source() { - assert_eq!(get_template_source("sub/b.html"), "bar\n"); + assert_eq!(get_template_source("sub/b.html"), "bar"); } #[test] |