From babea28312387a22642cb974cc4b97e9fe7fed49 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 10 Oct 2023 15:10:12 +0200 Subject: Build Config from TemplateArgs --- askama_derive/src/input.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'askama_derive/src/input.rs') diff --git a/askama_derive/src/input.rs b/askama_derive/src/input.rs index 45da7f0..ee9b942 100644 --- a/askama_derive/src/input.rs +++ b/askama_derive/src/input.rs @@ -153,13 +153,13 @@ impl TemplateInput<'_> { #[derive(Debug, Default)] pub(crate) struct TemplateArgs { - pub(crate) source: Option, - pub(crate) print: Print, - pub(crate) escaping: Option, - pub(crate) ext: Option, - pub(crate) syntax: Option, - pub(crate) config: String, - pub(crate) whitespace: Option, + source: Option, + print: Print, + escaping: Option, + ext: Option, + syntax: Option, + config: String, + whitespace: Option, } impl TemplateArgs { @@ -275,6 +275,10 @@ impl TemplateArgs { Ok(args) } + + pub(crate) fn config(&self) -> Result, CompileError> { + Config::new(&self.config, self.whitespace.as_ref()) + } } #[inline] -- cgit