-
Hi what is the Renoir syntax to output an unescaped HTML string created by a function in a template?
obviously I want
Thanks. |
Beta Was this translation helpful? Give feedback.
Answered by
gi0baro
Oct 27, 2021
Replies: 1 comment 1 reply
-
@denesl Renoir uses an class asis:
def __init__(self, val):
self.val = val
def __html__(self):
return str(self.val) the you function just have to return the wrapped content def f():
...
return asis(whatever) or you can add you class in Renoir's context and call-it directly from the template:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
denesl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@denesl Renoir uses an
__html__
method on objects for escaping when available. You can mimic what Emmett does building a wrapper class:the you function just have to return the wrapped content
or you can add you class in Renoir's context and call-it directly from the template: