Java freemarker 模板和 smooks 中的评论

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20348559/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 01:14:27  来源:igfitidea点击:

Comments in freemarker template and smooks

javafreemarkersmooks

提问by SikanderAhmed

I am working on a freemarker template and here is a sample.

我正在开发一个 freemarker 模板,这里有一个示例。

<Grantor>
    <UniqueID>${(currentGrantorIndex)!?string}</UniqueID> // want to comment this line
    <Entity>${(grantor.entityTypeName)!?string}</Entity>
</Grantor>

I want to know how to write comments or comment out few lines in freemarker templates. Any idea?

我想知道如何在 freemarker 模板中写评论或注释掉几行。任何的想法?

采纳答案by obourgain

Comment in freemarker are delimited by <#--and -->. Everything between these delimiters will not be interpreted by freemarker and won't appear in the output.

freemarker 中的注释由<#--和分隔-->。这些分隔符之间的所有内容都不会被 freemarker 解释,也不会出现在输出中。

<Grantor>
    <#-- <UniqueID>${(currentGrantorIndex)!?string}</UniqueID> -->
    <Entity>${(grantor.entityTypeName)!?string}</Entity>
</Grantor>

See freemarker reference here.

请参阅此处的freemarker 参考。