diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-10-10 15:10:12 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-11-01 12:52:09 +0100 |
commit | babea28312387a22642cb974cc4b97e9fe7fed49 (patch) | |
tree | 4e4a2b492574009d98f4d75b74d7e717efecef9a /askama_derive/src/input.rs | |
parent | 2a4d58cbb2033114890415c98a61e730185d1f83 (diff) | |
download | askama-babea28312387a22642cb974cc4b97e9fe7fed49.tar.gz askama-babea28312387a22642cb974cc4b97e9fe7fed49.tar.bz2 askama-babea28312387a22642cb974cc4b97e9fe7fed49.zip |
Build Config from TemplateArgs
Diffstat (limited to 'askama_derive/src/input.rs')
-rw-r--r-- | askama_derive/src/input.rs | 18 |
1 files changed, 11 insertions, 7 deletions
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<Source>, - pub(crate) print: Print, - pub(crate) escaping: Option<String>, - pub(crate) ext: Option<String>, - pub(crate) syntax: Option<String>, - pub(crate) config: String, - pub(crate) whitespace: Option<String>, + source: Option<Source>, + print: Print, + escaping: Option<String>, + ext: Option<String>, + syntax: Option<String>, + config: String, + whitespace: Option<String>, } impl TemplateArgs { @@ -275,6 +275,10 @@ impl TemplateArgs { Ok(args) } + + pub(crate) fn config(&self) -> Result<Config<'_>, CompileError> { + Config::new(&self.config, self.whitespace.as_ref()) + } } #[inline] |