Open traviscross opened 11 months ago
Tera v1.19.1 fails to strip whitespace in the else branch of a for loop. I.e., this template...
v1.19.1
else
for
{% for x in [] -%} {% else -%} B {% endfor -%}
...produces \nB\n when it should produce B\n. Here's a failing test:
\nB\n
B\n
//! ```cargo //! [dependencies.tera] //! version = "=1.19.1" //! ``` use tera::{Context, Tera}; #[test] fn can_remove_whitespace_for_else() { let mut tera = Tera::default(); tera.add_raw_templates(vec![ ("a.html", "{% for x in [] -%}{% else -%}\nB\n{% endfor -%}"), ]).unwrap(); assert_eq!(tera.render("a.html", &Context::new()).unwrap(), "B\n"); }
Tera
v1.19.1
fails to strip whitespace in theelse
branch of afor
loop. I.e., this template......produces
\nB\n
when it should produceB\n
. Here's a failing test: