diff options
author | René Kijewski <Kijewski@users.noreply.github.com> | 2021-11-30 09:51:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-30 09:51:49 +0100 |
commit | 1762792385052bb688b9dde143d6a7a089069a14 (patch) | |
tree | 2074c13e9c0b978fe1538ec81e88e1957a9a1b96 /testing | |
parent | 4940b5dd5e792811491f1c3c3b1c70c8177c7e02 (diff) | |
parent | ef3e840ac4874e52aa52da6ed5f0afddafa61d1a (diff) | |
download | askama-1762792385052bb688b9dde143d6a7a089069a14.tar.gz askama-1762792385052bb688b9dde143d6a7a089069a14.tar.bz2 askama-1762792385052bb688b9dde143d6a7a089069a14.zip |
Merge pull request #546 from Kijewski/pr-fix-raw
Allow whitespace trimming in {{raw}} blocks
Diffstat (limited to 'testing')
-rw-r--r-- | testing/templates/raw-ws.html | 2 | ||||
-rw-r--r-- | testing/tests/simple.rs | 10 |
2 files changed, 12 insertions, 0 deletions
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")] |