From bdb6c0b89df5099fe6cf2e79e04e0efd21f64aa8 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sun, 2 Jul 2023 10:53:15 +0200 Subject: derive: move whitespace conversion into config module --- askama_derive/src/config.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'askama_derive/src/config.rs') diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs index 1fee3c8..e456c67 100644 --- a/askama_derive/src/config.rs +++ b/askama_derive/src/config.rs @@ -5,7 +5,7 @@ use std::{env, fs}; #[cfg(feature = "serde")] use serde::Deserialize; -use crate::parser::Syntax; +use crate::parser::{Syntax, Whitespace}; use crate::CompileError; #[derive(Debug)] @@ -215,6 +215,16 @@ pub(crate) enum WhitespaceHandling { Minimize, } +impl From for Whitespace { + fn from(ws: WhitespaceHandling) -> Self { + match ws { + WhitespaceHandling::Suppress => Whitespace::Suppress, + WhitespaceHandling::Preserve => Whitespace::Preserve, + WhitespaceHandling::Minimize => Whitespace::Minimize, + } + } +} + impl Default for WhitespaceHandling { fn default() -> Self { WhitespaceHandling::Preserve -- cgit