Replies: 1 comment
-
|
Hi @Abbodavi,
"""Alias a Liquid filter example. Require Python Liquid version 2."""
from liquid import Environment
class MyLiquidEnvironment(Environment):
def setup_tags_and_filters(self, *, extra=False):
super().setup_tags_and_filters(extra=extra)
self.filters["skip_autoescape"] = self.filters["safe"]
env = MyLiquidEnvironment(autoescape=True)
template = env.parse(
"Hello, {{ some_html }}!\n"
"Hello, {{ some_html | safe }}!\n"
"Hello, {{ some_html | skip_autoescape }}!"
)
print(template.render(some_html="<p><b>World</b></p>"))
# Hello, <p><b>World</b></p>!
# Hello, <p><b>World</b></p>!
# Hello, <p><b>World</b></p>!Note that without In general, I am open to including new filters if they are widely useful. Non-standard filters will usually be disabled by default, and if filters have additional Python dependencies, it might be better to maintain them in a separate project/package. I imagine |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! I've been using this library for a while to test the creation of a liquid template which is then being used by AWS SageMaker GroundTruth to create a custom labeling template. Besides standard Liquid filters Ground Truth offers a few additional filters and recently I've developed some stuff that requires the use of the
skip_autoescapefilter. However this is currently not present in the library which causes the failure of a few tests.I had a brief look at the code and I think the implementation shouldn't be particularly hard but since this filter is outside the standard liquid I was wondering if you would be open to their addition or not.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions