bkiers / Liqp

An ANTLR based 'Liquid Template' parser and rendering engine.
MIT License
165 stars 94 forks source link

Fix number comparisons when applying filters, BigDecimal handling #294

Closed kohlschuetter closed 10 months ago

kohlschuetter commented 10 months ago

When comparing numbers in Jekyll flavor, comparisons would fail if a filter like "plus" was applied (e.g., "Cannot compare 1.0 with 0 because they are not the same type: java.lang.String vs java.math.BigDecimal").

This is due to premature BigDecimal-to-String conversion.

Introduce a BigDecimal subclass, PlainBigDecimal, whose toString() method calls toPlainString(), and defer toString() conversion as far as possible.