6. 注释
可以用注释加入描述性文本,他们并不在模板引擎中输出。注释可以有助于你的记忆或者想其他人解释你的VTL语句正在做什么。
## This is a single line comment.
单行注释以##开始,并在本行结束。如果需要加入多行注释,并不需要加入很多的单行注释。多行注释,以#*开始并以*#结束可以处理这种情况。
This is text that is outside the multi-line comment.
Online visitors can see it.
#*
Thus begins a multi-line comment. Online visitors won't
see this text because the Velocity Templating Engine will
ignore it.
*#
Here is text outside the multi-line comment; it is visible.
下面事一些例子说明单行注释和多行注释如何工作。
This text is visible. ## This text is not.
This text is visible.
This text is visible. #* This text, as part of a multi-line comment,
is not visible. This text is not visible; it is also part of the
multi-line comment. This text still not visible. *# This text is outside
the comment, so it is visible.
## This text is not visible.
还有第三种注释, VTL 注释块,可以用来存储诸如文档作者、版本信息等。
#**
This is a VTL comment block and
may be used to store such information
as the document author and versioning
information:
@author
@version 5
*#