Releases: jg-rp/liquid
Version 1.12.2
Fixes
- Fixed
{% case %}
/{% when %}
behavior. When usingliquid.future.Environment
, we now render any number of{% else %}
blocks and allow{% when %}
tags to appear after{% else %}
tags. The defaultEnvironment
continues to raise aLiquidSyntaxError
in such cases. - Fixed line numbers in some error messages. When parsing some Liquid expressions, we were always getting a line number of
1
in the event of a syntax error. See issue #162.
Changed
- Changed
{% break %}
and{% continue %}
tag handling when they appear inside a{% tablerow %}
tag. Now, when usingliquid.future.Environment
, interrupts follow Shopify/Liquid behavior introduced in #1818. Python Liquid's default environment is unchanged.
Version 1.12.1
Fixes
- Fixed handling of
{% else %}
tags that include text betweenelse
and the closing tag delimiter (%}
). Previously we were treating such text as part of the{% else %}
block. Now the default behavior is to raise aLiquidSyntaxError
. When usingliquid.future.Environment
, we follow Shopify/Liquid behavior of silently ignoring{% else %}
tag expressions, even in strict mode. See #150. liquid.future.Environment
now silently ignores superfluous{% else %}
and{% elsif %}
blocks. The default environment continues to raise aLiquidSyntaxError
if{% else %}
or{% elsif %}
appear after the first{% else %}
tag. See #151.
Version 1.12.0
Fixes
- Fixed a bug with the LRU cache. We now raise a
ValueError
at construction time if a caching template loader is given a cache size less than 1. Previously, in such cases, anIndexError
would have been raised when attempting to write to the cache. See #148.
Features
- Added
make_choice_loader()
, a factory function that returns aChoiceLoader
orCachingChoiceLoader
depending on its arguments. (docs, source) - Added
make_file_system_loader()
, a factory function that returns aFileSystemLoader
,FileExtensionLoader
orCachingFileSystemLoader
depending on its arguments. (docs, source)
Version 1.11.0
Fixes
- Fixed comparing strings with
<
,<=
,>
and>=
in boolean expressions ({% if %}
and{% unless %}
). Previously we were raising aLiquidTypeError
, now we return the result of comparing two string by their lexicographical order. See #141.
Features
- Added
CachingChoiceLoader
, a template loader that chooses between a list of template loaders and caches parsed templates in memory. (docs, source) - Added
PackageLoader
, a template loader that reads templates from Python packages. (docs, source)
Dependencies
- Python Liquid now depends on importlib-resources >= 5.10. This is that backport of importlib.resources from Python's standard library. We use it in
PackageLoader
.
Version 1.10.2
Fixes
-
Added an additional implementation of the
split
filter, which resolves some compatibility issues between Python Liquid's and the reference implementation. Previously, when given an empty string to split or when the string and the delimiter were equal, we used Python'sstr.split()
behavior of producing one or two element lists containing empty strings. We now match Shopify/Liquid in returning an empty list for such cases. The newsplit
filter will be enabled by default when usingliquid.future.Environment
, and can optionally be registered withliquid.Environment
for those that don't mind the behavioral change. See #135. -
Fixed unexpected errors from the
date
filter when it's given an invalid format string. Previously we were raising aliquid.exceptions.Error
in response to aValueError
from strftime. We now raise aFilterArgumentError
with its__cause__
set to theValueError
. -
Fixed handling of
"%s"
date filter format strings. We now fall back to a string representation ofdatetime.timestamp()
for platforms that don't support%s
. Note that this is for"%s"
exactly. We don't handle the more general case of%s
appearing in a longer format string.
Version 1.10.0
Features
- Optionally disable automatic suppression of whitespace only blocks with the
Environment
class attributerender_whitespace_only_blocks
. (docs). - All built-in and included "extra" tags now have a
node_class
class attribute specifying theNode
type the tag contributes to a templates AST. This is done for easier customization throughTag
andNode
subclassing.
Version 1.9.4
Version 1.9.3
Fixes
- Removed
is_up_to_date
fromliquid.BoundTemplate.__repr__
. It was causingRuntimeWarning
s with Python 3.11 when using an async template loader. Specifically warnings about coroutines that were never awaited. - Fixed the
map
filter. If given a nested array-like input, it now flattens it automatically. See #119. - Fixed the behavior of the
liquid
tag when other liquid tags appear within it. See #123.
Features
Version 1.9.2
Fixes
- Fixed a bug where a class-based filter defining
filter_async
and settingwith_context
orwith_environment
toTrue
would not be awaited. See #117.
Build
- Fixed some package build issues since moving to hatch. Both version 1.9.0 and 1.9.1 inadvertently included
.mypy_cache
folders, making the distribution files significantly larger.
Version 1.9.1
Fixes
- Force the "wheel" build target to include
py.typed
. - Restore
liquid.__version__
.