注释掉文件末尾的行时出现速度词法错误
我在 JIRA 中有以下 Velocity 模板(注意,保留了额外的行):
NOTE: Please REPLY-TO this email when replying to this issue.
##parse("templates/email/includes/issueplugins.vm")
#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end
#if($remoteUser.fullName)
$i18n.getText("template.issue.commented.on", $remoteUser.fullName, $issue.getKey())
#dashes($!remoteUser.fullName)--------------#dashes($issue.getKey())-
#end
#if($changelog)
#changes([])
#end
#comment()
#visibility()
#parse("templates/email/text/includes/issuesummary.vm")
#parse("templates/email/text/includes/footer.vm")
最后一行后面没有任何行。我什么时候在最后一行执行此操作:
##parse("templates/email/text/includes/footer.vm")
我收到以下错误:
An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug.
Details:
-------
org.apache.velocity.exception.ParseErrorException: Lexical error:
org.apache.velocity.runtime.parser.TokenMgrError:
Lexical error at line 20, column 51. Encountered: <EOF> after : ""
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:272)
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:202)
...
我发现了 2004 年的以下问题:
https://issues.apache.org/jira/browse/VELOCITY-272
这似乎表明这是 1.5 中修复的错误。检查我的 JIRA 系统信息,我发现 JIRA 4.2.1 似乎表明正在使用版本 1.6:
Atlassian 模板渲染器 Velocity 1.6 插件 - 1.1.1
当我将开始 #if($comment.getId())
的行移至末尾时,错误消失。我在模板末尾做错了什么,还是这是一个错误?
编辑
嗯。当我这样做时:
#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end
作为最后一行,后面没有空行,我得到了同样的错误。但是,如果我在该行之后添加一行(只需按 ENTER
一次),它就会起作用。
Velocity 模板需要结尾空格吗?我很困惑。
I have the following Velocity template in JIRA (note, extra lines kept in):
NOTE: Please REPLY-TO this email when replying to this issue.
##parse("templates/email/includes/issueplugins.vm")
#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end
#if($remoteUser.fullName)
$i18n.getText("template.issue.commented.on", $remoteUser.fullName, $issue.getKey())
#dashes($!remoteUser.fullName)--------------#dashes($issue.getKey())-
#end
#if($changelog)
#changes([])
#end
#comment()
#visibility()
#parse("templates/email/text/includes/issuesummary.vm")
#parse("templates/email/text/includes/footer.vm")
There is no line following that last line. When do I this on the very last line:
##parse("templates/email/text/includes/footer.vm")
I get the following error:
An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug.
Details:
-------
org.apache.velocity.exception.ParseErrorException: Lexical error:
org.apache.velocity.runtime.parser.TokenMgrError:
Lexical error at line 20, column 51. Encountered: <EOF> after : ""
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:272)
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:202)
...
I found the following issue from 2004:
https://issues.apache.org/jira/browse/VELOCITY-272
Which seems to suggest this was a bug fixed in 1.5. Checking in my JIRA System Info, I see that JIRA 4.2.1 appears to suggest version 1.6 is in use:
Atlassian Template Renderer Velocity 1.6 Plugin - 1.1.1
When I move the line starting #if($comment.getId())
to the end, the error goes away. Am I doing something wrong here at the end of the template, or is this a bug?
EDIT
Hmm. When I did this:
#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end
As the last line, with no empty line following it, I got the same error. However, if I add a line after that line (just hit ENTER
once), it works.
Do Velocity template's require an ending space? I'm confused.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,他们没有;请参阅几天前的讨论..
And no, they haven't; see this discussion from a few days ago..