forums-YrDk4eUcT3KaMJb+
2011-05-23 17:41:13 UTC
I have a Velocity template that is copied from the Comment section from an Issue. I want to put an internal page link, down to a specific Comment ID.
However, when I attempt to put a variable ($commentId) in the href link, I keep getting a Velocity error, complaining about the hyphen. I've tried using character codes for the hyphen, that didn't work either.
I'm stuck with the hyphen, because that's how Atlassian has decided to name the id's for the Comments section. I've tried searching on using a hyphen in Velocity scripts, and found some reference that it needs to be handled differently, but can't find the answer.
If I don't put a velocity $variable in the href statement, it works just fine. I think the hash (#) in front of comment is what's setting the whole thing off. if I remove the #, it also works ok, with the variable.
Here's the line from my Velocity script:
{code}
<a href="${urlPrefix}#comment-$commentId-open"><font size="1" color="grey">...(truncated)</font></a>
{code}
Here's the error I get:
{code}
org.apache.velocity.exception.ParseErrorException: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 18, column 47. Encountered: "-" (45)
{code}
Thanks for any help.
-Cory
--
Post by csytsma - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=54146
However, when I attempt to put a variable ($commentId) in the href link, I keep getting a Velocity error, complaining about the hyphen. I've tried using character codes for the hyphen, that didn't work either.
I'm stuck with the hyphen, because that's how Atlassian has decided to name the id's for the Comments section. I've tried searching on using a hyphen in Velocity scripts, and found some reference that it needs to be handled differently, but can't find the answer.
If I don't put a velocity $variable in the href statement, it works just fine. I think the hash (#) in front of comment is what's setting the whole thing off. if I remove the #, it also works ok, with the variable.
Here's the line from my Velocity script:
{code}
<a href="${urlPrefix}#comment-$commentId-open"><font size="1" color="grey">...(truncated)</font></a>
{code}
Here's the error I get:
{code}
org.apache.velocity.exception.ParseErrorException: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 18, column 47. Encountered: "-" (45)
{code}
Thanks for any help.
-Cory
--
Post by csytsma - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=54146