Filter helpers
liquid.filter.decimal_arg
Return val
as an int or decimal.
If val
can't be cast to an int or decimal, return default
.
liquid.filter.int_arg
Return val
as an int or default
if val
can't be cast to an int.
liquid.filter.math_filter
Raise a FilterArgumentError
if the filter value can not be a number.
liquid.filter.num_arg
Return val
as an int or float.
If val
can't be cast to an int or float, return default
.
liquid.filter.sequence_filter
A filter function decorator that coerces the left value to sequence.
This is intended to mimic the semantics of the reference implementation's
InputIterator
class.
liquid.filter.string_filter
A filter function decorator that converts the first argument to a string.
liquid.filter.with_context
Pass the active render context to decorated filter functions.
If a function is decorated with with_context
, that function should
accept a context
keyword argument, being the active render context.
PARAMETER | DESCRIPTION |
---|---|
_filter
|
The filter function to decorate.
TYPE:
|
liquid.filter.with_environment
Pass the active environment to decorated filter functions.
If a function is decorated with with_environment
, that function should
accept an environment
keyword argument, being the active environment.
PARAMETER | DESCRIPTION |
---|---|
_filter
|
The filter function to decorate.
TYPE:
|