Skip to content

liquid.exts.standard

module

liquid.exts.standard

Provides an extension to implment features for standard liquid

Classes
class

liquid.exts.standard.LiquidStandardExtension(environment)

Bases
liquid.exts.ext.LiquidExtension jinja2.ext.Extension

This extension implement features for standard liqiud

These features (that jinja does support) including 1. Allow '.size' to get length of an array (by replacing it with '.len()') 2. Allow 'contains' to work as an operator by turning it into a test 3. Turn 'forloop' to 'loop' 4. Allow (1..5), which will be turned to range(1, 6)

Methods
  • __init_subclass__() Initalize the tags and raw_tags using tag manager</>
  • attr(name, lineno) (ExtensionAttribute) Return an attribute node for the current extension. This is usefulto pass constants on extensions to generated template code. </>
  • bind(environment) (Extension) Create a copy of this extension bound to another environment.</>
  • call_method(name, args, kwargs, dyn_args, dyn_kwargs, lineno) (Call) Call a method of the extension. This is a shortcut for:meth:attr + :class:jinja2.nodes.Call. </>
  • filter_stream(stream) Supports for liquid features</>
  • parse(parser) (Node) Let tag manager to parse the tags that are being listened to</>
  • preprocess(source, name, filename) (str) Try to keep the tag body raw by encode the variable/comment/blockstart strings ('{{', '{#', '{%') so that the body won't be tokenized by jinjia. </>
method

bind(environment) → Extension

Create a copy of this extension bound to another environment.

method

attr(name, lineno=None) → ExtensionAttribute

Return an attribute node for the current extension. This is usefulto pass constants on extensions to generated template code.

::

self.attr('_my_attribute', lineno=lineno)
method

call_method(name, args=None, kwargs=None, dyn_args=None, dyn_kwargs=None, lineno=None) → Call

Call a method of the extension. This is a shortcut for:meth:attr + :class:jinja2.nodes.Call.

classmethod

__init_subclass__()

Initalize the tags and raw_tags using tag manager

method

preprocess(source, name, filename) → str

Try to keep the tag body raw by encode the variable/comment/blockstart strings ('{{', '{#', '{%') so that the body won't be tokenized by jinjia.

method

parse(parser) → Node

Let tag manager to parse the tags that are being listened to

generator

filter_stream(stream)

Supports for liquid features