简体   繁体   English

在Japid中替代@Html

[英]alternate for @Html in Japid

In play framework we use @Html in scala views if we do not want play to escape Html characters. 在播放框架中,如果我们不希望播放转义HTML字符,则在scala视图中使用@Html Is there any alternate to this in Japid. Japid中是否有替代方法? I tried to import play.api.templates.Html and tried ${Html and ${Html.get but they are not working. 我尝试导入play.api.templates.Html并尝试${Html${Html.get但它们不起作用。 Am I doing something wrong. 难道我做错了什么。

Japid by default does not escape the string value of expressions to make it html safe, like what Play! 默认情况下,Japid不会转义表达式的字符串值以使其变得html安全,例如Play! does. 做。

Reference: https://github.com/branaway/Japid/blob/master/documentation/manual/Japid_Generic_Engine.textile 参考: https : //github.com/branaway/Japid/blob/master/documentation/manual/Japid_Generic_Engine.textile

In case you need to explicitly escape the string value of expression, you can use: 如果需要显式转义expression的字符串值,可以使用:

${escapeHtml(expr)}

Or simply: 或者简单地:

~{expr}

~ means escape. 〜表示逃避。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM