From ef3e840ac4874e52aa52da6ed5f0afddafa61d1a Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Tue, 12 Oct 2021 19:24:40 +0200 Subject: Allow whitespace trimming in {{raw}} blocks --- testing/templates/raw-ws.html | 2 ++ testing/tests/simple.rs | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 testing/templates/raw-ws.html (limited to 'testing') diff --git a/testing/templates/raw-ws.html b/testing/templates/raw-ws.html new file mode 100644 index 0000000..d590be7 --- /dev/null +++ b/testing/templates/raw-ws.html @@ -0,0 +1,2 @@ +<{% raw -%} {{hello}} {%- endraw %}> +< {%- raw %}{{bye}}{% endraw -%} > diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index c712900..e66485a 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -433,6 +433,16 @@ fn test_raw_complex() { ); } +#[derive(Template)] +#[template(path = "raw-ws.html")] +struct RawTemplateWs; + +#[test] +fn test_raw_ws() { + let template = RawTemplateWs; + assert_eq!(template.render().unwrap(), "<{{hello}}>\n<{{bye}}>"); +} + mod without_import_on_derive { #[derive(askama::Template)] #[template(source = "foo", ext = "txt")] -- cgit