From ea4dab1251eccc63e8717c99327282b7af04671f Mon Sep 17 00:00:00 2001 From: Marvin Jütte Date: Tue, 7 Nov 2023 13:49:37 +0100 Subject: add support for svg file extension --- askama_derive/src/config.rs | 7 +++++-- askama_derive/src/input.rs | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs index 47801cd..2347f6c 100644 --- a/askama_derive/src/config.rs +++ b/askama_derive/src/config.rs @@ -299,7 +299,7 @@ pub(crate) fn get_template_source(tpl_path: &Path) -> std::result::Result Mime { basic_type } -const TEXT_TYPES: [(Mime, Mime); 6] = [ +const TEXT_TYPES: [(Mime, Mime); 7] = [ (mime::TEXT_PLAIN, mime::TEXT_PLAIN_UTF_8), (mime::TEXT_HTML, mime::TEXT_HTML_UTF_8), (mime::TEXT_CSS, mime::TEXT_CSS_UTF_8), @@ -358,6 +358,7 @@ const TEXT_TYPES: [(Mime, Mime); 6] = [ mime::APPLICATION_JAVASCRIPT, mime::APPLICATION_JAVASCRIPT_UTF_8, ), + (mime::IMAGE_SVG, mime::IMAGE_SVG), ]; #[cfg(test)] @@ -369,10 +370,12 @@ mod tests { assert_eq!(extension(Path::new("foo-bar.txt")), Some("txt")); assert_eq!(extension(Path::new("foo-bar.html")), Some("html")); assert_eq!(extension(Path::new("foo-bar.unknown")), Some("unknown")); + assert_eq!(extension(Path::new("foo-bar.svg")), Some("svg")); assert_eq!(extension(Path::new("foo/bar/baz.txt")), Some("txt")); assert_eq!(extension(Path::new("foo/bar/baz.html")), Some("html")); assert_eq!(extension(Path::new("foo/bar/baz.unknown")), Some("unknown")); + assert_eq!(extension(Path::new("foo/bar/baz.svg")), Some("svg")); } #[test] -- cgit