简体   繁体   English

使用Rythm模板引擎过滤标签

[英]Filtering tags using Rythm template engine

Is it possible to filter tags in Rythm ? 是否可以在Rythm中过滤标签?

I want to allow specific tags like if and for while denying all other tags (especially @{ } ). 我想允许特定标签,例如iffor同时拒绝所有其他标签(尤其是@{ } )。

At the moment no filtering mechanism. 目前没有过滤机制。 However Rythm provides a utility called Dialect to allow template author to use a limit set of Rythm directives. 但是,Rythm提供了一个称为Dialect的实用程序,以允许模板作者使用Rythm指令的限制集。 For example, SimpleRythm does NOT allow you to use the following directives: 例如, SimpleRythm不允许您使用以下指令:

"@extends",
"@section",
"@render",
"@inherited",
"@doLayout",
"@doBody",
"@include",
"@set",
"@get",
"@init",
"@finally",
"@nosim"

While BasicRythm is more restricted and you are not allow to use anyone of the following directives: 虽然BasicRythm受到更多限制,并且您不允许使用以下任何伪指令:

"@args",
"@assign",
"@debug",
"@doLayout",
"@doBody",
"@extends",
"@section",
"@render",
"@inherited",
"@i18n",
"@import",
"@include",
"@invoke",
"@locale",
"@set",
"@get",
"@init",
"@finally",
"@expand",
"@exec",
"@macro",
"@compact",
"@nocompact",
"@def ",
"@tag ",
"@return",
"@nosim",
"@verbatim"

In order to use specific dialect, instead of using 为了使用特定的方言,而不是使用

String result = engine.render(...);

Use the following code: 使用以下代码:

ITemplate template = engine.getTemplate(SimpleRythm.INSTANCE, ...);
String result = template.render();

There is no way to prevent @{...} for the moment. 目前尚无法阻止@{...} Please submit a ticket on https://github.com/greenlaw110/rythm/issues to request a configuration to disable scripting in Rythm template 请在https://github.com/greenlaw110/rythm/issues上提交票证,以请求配置以禁用Rythm模板中的脚本

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

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