简体   繁体   中英

Apache Velocity and Escaping # followed by $

Question regarding Velocity and I cannot seem to find an answer anywhere online... Maybe it's really that obvious, anyway, the question:

I have a variable called $link and when I want to use it as a hyperlink to an anchor I use eg:

<a href="#$link">something</a>

And I get that as a literal output...

How can I get if $link = "bla":

<a href="#bla">something</a>

as output?

And also the same problem with:

<a href="#$link-something-else">something</a>

to get as

<a href="#bla-something-else">something</a>

Thanks!!

Ok, found the answer:

<a href="#${link}">something</a>

and

<a href="#${link}-something-else">something</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM