You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the | round filter with precision = 0 to return a natural number, the filter still returns a float leading to unexpected behavior when using it in combination with functions expecting an integer.
Minimal code that does not work
use tera::{Tera,Context};fnmain(){let test = Tera::one_off("{% for i in range(end=5.5 | round) %} {{ i }}\n {% endfor %}",&Context::new(),true);print!("{test:?}");}
Output
Err(Error { kind: Msg("Failed to render '__tera_one_off'"), source: Some(Error { kind: CallFunction("range"), source: Some(Error { kind: Msg("Function range received end=6.0 but end can only be a number"), source: None }) }) })
The text was updated successfully, but these errors were encountered:
When using the
| round
filter withprecision = 0
to return a natural number, the filter still returns a float leading to unexpected behavior when using it in combination with functions expecting an integer.Minimal code that does not work
Output
Err(Error { kind: Msg("Failed to render '__tera_one_off'"), source: Some(Error { kind: CallFunction("range"), source: Some(Error { kind: Msg("Function
range
received end=6.0 butend
can only be a number"), source: None }) }) })The text was updated successfully, but these errors were encountered: