liquid.exts.filter_colon
liquid.exts.filter_colon
Provides an extension to use colon to separate filter and its arguments
Jinja uses {{a | filter(arg)}}
, but liquid uses {{a | filter: arg}}
FilterColonExtension
— This extension allows colon to be used to separatethe filter and arguments, so that we can write django/liquid-style filters </>
liquid.exts.filter_colon.
FilterColonExtension
(
environment
)
This extension allows colon to be used to separatethe filter and arguments, so that we can write django/liquid-style filters
__init_subclass__
(
)
— This method is called when a class is subclassed.</>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
)
(Token) — Modify the colon to lparen and rparen tokens</>parse
(
parser
)
(Union(node, list of node)) — If any of the :attr:tags
matched this method is called with theparser as first argument. The token the parser stream is pointing at is the name token that matched. This method has to return one or a list of multiple nodes. </>preprocess
(
source
,name
,filename
)
(str) — This method is called before the actual lexing and can be used topreprocess the source. Thefilename
is optional. The return value must be the preprocessed source. </>
__init_subclass__
(
)
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
bind
(
environment
)
→ Extension
Create a copy of this extension bound to another environment.
preprocess
(
source
, name
, filename=None
)
→ str
This method is called before the actual lexing and can be used topreprocess the source. The filename
is optional. The return value
must be the preprocessed source.
parse
(
parser
)
→ Union(node, list of node)
If any of the :attr:tags
matched this method is called with theparser as first argument. The token the parser stream is pointing at
is the name token that matched. This method has to return one or a
list of multiple nodes.
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)
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
.
filter_stream
(
stream
)
→ Token
Modify the colon to lparen and rparen tokens