Skip to content

Releases: jg-rp/liquid

Version 1.12.1

13 Feb 08:12
Compare
Choose a tag to compare

Fixes

  • Fixed handling of {% else %} tags that include text between else and the closing tag delimiter (%}). Previously we were treating such text as part of the {% else %} block. Now the default behavior is to raise a LiquidSyntaxError. When using liquid.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 a LiquidSyntaxError if {% else %} or {% elsif %} appear after the first {% else %} tag. See #151.

Version 1.12.0

07 Feb 08:30
Compare
Choose a tag to compare

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, an IndexError would have been raised when attempting to write to the cache. See #148.

Features

  • Added make_choice_loader(), a factory function that returns a ChoiceLoader or CachingChoiceLoader depending on its arguments. (docs, source)
  • Added make_file_system_loader(), a factory function that returns a FileSystemLoader, FileExtensionLoader or CachingFileSystemLoader depending on its arguments. (docs, source)

Version 1.11.0

01 Feb 08:00
Compare
Choose a tag to compare

Fixes

  • Fixed comparing strings with <, <=, > and >= in boolean expressions ({% if %} and {% unless %}). Previously we were raising a LiquidTypeError, 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

Version 1.10.2

14 Dec 08:36
Compare
Choose a tag to compare

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's str.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 new split filter will be enabled by default when using liquid.future.Environment, and can optionally be registered with liquid.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 a liquid.exceptions.Error in response to a ValueError from strftime. We now raise a FilterArgumentError with its __cause__ set to the ValueError.

  • Fixed handling of "%s" date filter format strings. We now fall back to a string representation of datetime.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

03 Sep 08:41
Compare
Choose a tag to compare

Features

  • Optionally disable automatic suppression of whitespace only blocks with the Environment class attribute render_whitespace_only_blocks. (docs).
  • All built-in and included "extra" tags now have a node_class class attribute specifying the Node type the tag contributes to a templates AST. This is done for easier customization through Tag and Node subclassing.

Version 1.9.4

13 Aug 11:19
Compare
Choose a tag to compare

Fixes

  • Fixed async loading of templates with the {% extends %} tag. Previously templates were being loaded synchronously, even when using render_async(). See #124.
  • Fixed handling of recursive {% extends %} tags during async static analysis. See #125.

Version 1.9.3

10 Jul 15:23
Compare
Choose a tag to compare

Fixes

  • Removed is_up_to_date from liquid.BoundTemplate.__repr__. It was causing RuntimeWarnings 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

  • Added the sum filter, which will return the sum of all numeric values in its input sequence. (docs, source).
  • Added Environment.setup_tags_and_filters() for easier tag and filter registration when subclassing Environment. See #122.

Version 1.9.2

24 Apr 14:30
Compare
Choose a tag to compare

Fixes

  • Fixed a bug where a class-based filter defining filter_async and setting with_context or with_environment to True 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

21 Apr 05:46
Compare
Choose a tag to compare

Fixes

  • Force the "wheel" build target to include py.typed.
  • Restore liquid.__version__.

Version 1.9.0

17 Apr 10:43
Compare
Choose a tag to compare

Fixes

  • Changed FileSystemLoader so that loaded templates can be pickled. See #107.
  • Fixed the liquid.Environment template cache. Now, when given a cache_size of 0, the cache is disabled. See #108.

Features

  • Added context-aware template loader bootstrapping methods. See #109.
  • Added support for async class-based filters. See #115.
  • Added CachingFileSystemLoader, a template loader that handles its own cache rather than relying on the Environment template cache, which can't handle context-aware loaders. See #116.