-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mosaic tile not interpreting html tags in script tag #424
Comments
AFAIK the tile are rendered using ZPT (zope page templates, not Mustache). Or maybe you mean something different. Can you post the template here? |
Sorry, I was not very explicit. The issue was in plone.app.blocks-4.1.1-py2.7.egg/plone/app/blocks/utils.py in the resolve function. The solution is a bit ugly. I replaced all my <script type="text/x-mustache-template"> tags to <code> tags in my template. Then I patched the resolve function tu replace <code> tags to <script> tags after the html parser did his work. def resolve(url, resolved=None):
"""Resolve the given URL to an lxml tree.
"""
if resolved is None:
resolved = resolveResource(url)
if not resolved.strip():
return None
try:
if isinstance(resolved, unicode):
resolved = resolved.encode('utf-8')
html_parser = html.HTMLParser(encoding='utf-8',)
# patch starts here
htmltree = html.fromstring(resolved, parser=html_parser).getroottree()
for tag in htmltree.iterfind('.//code[@type="text/x-mustache-template"]'):
tag.tag = "script"
# patch ends here
return htmltree
except etree.XMLSyntaxError as e:
logger.error('%s: %s' % (repr(e), url))
return None I close this issue because I'm not sure it's a bug. |
@yleclanche what you're trying to do seems valid to me; we have something similar using Mustache in Zope page templates in collective.upload. so, it should work here also. |
The mustache code works in a standard browser view, just not within a custom Mosaic tile template. |
Fix several problems with the Indonesian language [7.x]
I'm using mustache template in a mosaic tile.
When the page is rendering, the html content of the mustache template is displayed as raw html instead of being interpreted.
Any idea why and how to fix this ?
Thanks.
The text was updated successfully, but these errors were encountered: