这是indexloc提供的服务,不要输入任何密码
Skip to content

v0.3.0

Compare
Choose a tag to compare
@PgBiel PgBiel released this 27 May 03:14
· 9 commits to main since this release
c5a4066

What's Changed

  • Breaking change: Named replacements prefixed with fmt- are now an error. Those are reserved for future oxifmt options. (Issue #15)
    • For example, instead of strfmt("{fmt-x}", fmt-x: 10), write strfmt("{_fmt-x}, _fmt-x: 10") instead (or some other name with a different prefix).
  • Added thousands separator support, configurable with strfmt(format, fmt-thousands-count: 3, fmt-thousands-separator: ""). The first option defines how many digits should appear between each separator, and the second option controls the separator itself (default is empty string, disabling it). (Issue #5)
    • For example, strfmt("{}", 2000, fmt-thousands-separator: ",") displays "2,000".
    • Within the same example, adding fmt-thousands-count: 2 would display 20,00 instead.
    • Numeric systems with irregular thousands separator distances will be supported in a future release.
  • Added support for numeric formatting of fixed-point decimal numbers. They support the same format specifiers as floats, e.g. {:e} for exponential notation, {:.3} for a fixed precision and so on. (Issue #11)
  • oxifmt is now dual-licensed as MIT or Apache-2.0 (previously just MIT).
  • Fixed some bugs when formatting inf and NaN.
  • Fixed a rare case of wrong usage of types in strings in internal code, which could cause oxifmt to generate an error in upcoming Typst v0.14. It is recommended to upgrade oxifmt to avoid this problem.
    • However, this was only triggered when a very rare formatting option was used (dynamic precision specifiers, which have a dollar sign $, e.g. {:.prec$}), so existing code is unlikely to be affected. Still a good idea to upgrade, though.
  • Fixed exponential notation formatting with very large numbers. Note that they might need rounding to look good (e.g. strfmt("{:.2e}", number) instead of just {:e}), but they will no longer cause an error. (Issue #16)

Full Changelog: v0.2.1...v0.3.0