pub fn format(
val: Value,
kwargs: Kwargs,
_: &State<'_, '_>,
) -> TeraResult<String>Expand description
Formats a value using Rust’s std::fmt format specifiers.
Supports width, alignment, precision, sign, and zero-padding. Does NOT support radix specifiers (x, X, b, o) - only Display formatting.
§Example
{{ 3.14159 | format(spec=".2") }} -> "3.14"
{{ 42 | format(spec="05") }} -> "00042"
{{ "hi" | format(spec=">5") }} -> " hi"
{{ 42 | format(spec="+") }} -> "+42"