diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-07-11 22:38:07 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-07-11 22:38:07 +0100 |
commit | f9f4f57221e4488f3ecf26752e6c53d60167a5af (patch) | |
tree | e76898c9a4f86b5dceaa4707620f2245f448b6d2 /askama_shared | |
parent | c8d9a6326d69471145ce6ec7742389a3f9186f1a (diff) | |
download | askama-f9f4f57221e4488f3ecf26752e6c53d60167a5af.tar.gz askama-f9f4f57221e4488f3ecf26752e6c53d60167a5af.tar.bz2 askama-f9f4f57221e4488f3ecf26752e6c53d60167a5af.zip |
Move get_template_source() into askama_derive
Diffstat (limited to '')
-rw-r--r-- | askama_shared/src/lib.rs | 1 | ||||
-rw-r--r-- | askama_shared/src/path.rs | 29 |
2 files changed, 0 insertions, 30 deletions
diff --git a/askama_shared/src/lib.rs b/askama_shared/src/lib.rs index 08b243d..312057c 100644 --- a/askama_shared/src/lib.rs +++ b/askama_shared/src/lib.rs @@ -17,7 +17,6 @@ mod escaping; pub use error::{Error, Result}; pub use escaping::MarkupDisplay; pub mod filters; -pub mod path; pub struct Config { pub dirs: Vec<PathBuf>, diff --git a/askama_shared/src/path.rs b/askama_shared/src/path.rs deleted file mode 100644 index 16102b8..0000000 --- a/askama_shared/src/path.rs +++ /dev/null @@ -1,29 +0,0 @@ -use std::fs; -use std::path::Path; - -pub fn get_template_source(tpl_path: &Path) -> String { - match fs::read_to_string(tpl_path) { - Err(_) => panic!( - "unable to open template file '{}'", - tpl_path.to_str().unwrap() - ), - Ok(mut source) => { - if source.ends_with('\n') { - let _ = source.pop(); - } - source - } - } -} - -#[cfg(test)] -mod tests { - use super::get_template_source; - use Config; - - #[test] - fn get_source() { - let path = Config::new().find_template("sub/b.html", None); - assert_eq!(get_template_source(&path), "bar"); - } -} |