-
-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
incompatibilityBehavioural differences between Python and Ruby LiquidBehavioural differences between Python and Ruby LiquidwontfixThis will not be worked onThis will not be worked on
Description
Many filters built in to Liquid will automatically convert a string representation of a number to an integer or float as needed.
When converting integers, Ruby Liquid uses Ruby's String.to_i method, which will disregard trailing non-digit characters. In the following example, '7,42' is converted to 7
template:
{{ 3.14 | plus: '7,42' }}
{{ '123abcdef45' | plus: '1,,,,..!@qwerty' }}output
10.14
124
Python Liquid currently falls back to 0 for any string that can't be converted to an integer in its entirety. As is the case in Ruby Liquid for strings without leading digits.
This does not apply to parsing of integer literals, only converting strings to integers (not floats) inside filters.
Metadata
Metadata
Assignees
Labels
incompatibilityBehavioural differences between Python and Ruby LiquidBehavioural differences between Python and Ruby LiquidwontfixThis will not be worked onThis will not be worked on