簡體   English   中英

使用Rythm模板引擎過濾標簽

[英]Filtering tags using Rythm template engine

是否可以在Rythm中過濾標簽?

我想允許特定標簽,例如iffor同時拒絕所有其他標簽(尤其是@{ } )。

目前沒有過濾機制。 但是,Rythm提供了一個稱為Dialect的實用程序,以允許模板作者使用Rythm指令的限制集。 例如, SimpleRythm不允許您使用以下指令:

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

雖然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"

為了使用特定的方言,而不是使用

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

使用以下代碼:

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

目前尚無法阻止@{...} 請在https://github.com/greenlaw110/rythm/issues上提交票證,以請求配置以禁用Rythm模板中的腳本

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM