Keats / tera

A template engine for Rust based on Jinja2/Django
http://keats.github.io/tera/
MIT License
3.54k stars 283 forks source link

Support Math.pow for number formatting #781

Open chevdor opened 1 year ago

chevdor commented 1 year ago

It would be nice for formatting purpose to support Math.pow in the form of 10**3 for instance, where the result is 1000.

I am hitting a case where I would need to format numbers such as 1000000000 (how many zeroes ? :)) into 1'000'000'000 (easier now) or even 1_000_000_000.

Or even 1 or 1.0 given 1000000000 and 9 decimals as input. This likely requires BigInt but having already pow and a float formatting option would solve quite some problems.

chevdor commented 1 year ago

See also #630 and #22

Keats commented 1 year ago

10**3 will be supported in v2

This likely requires BigInt but having already pow and a float formatting option would solve quite some problems.

You can write your own in the meantime. BigInt is not going to happen though

chevdor commented 1 year ago

10**3 will be supported in v2

🎉

BigInt is not going to happen though

yes, this is rather opinionated and I can understand not adding it