Expose the official recommended bindings for Velocity tools?

Hi everyone,

$escapetool.velocity() is close to unusable right now because it generates content with use of $esc in it. The reason it does this is that $esc is the official recommended binding for EscapeTool.

It’s easy to fix as EscapeTool is configurable, so we can change the key, no problem there. But noticing that esc was the recommended key and that we were not exposing it, I was wondering if we would like to “fix” that, logic being that people who know Velocity might expect it to exist.

Honestly I’m fine with both, but since we are starting a new cycle I thought it might be interesting to talk about it.

Some pros and cons:

Cons:

  • several ways to access the same thing
  • a bit less explicit when reading the code and conflict proof without the “tool” suffix

Pros:

  • more standard from Velocity point of view

+1 to use $escapetool and to not introduce $esc. In the list of cons there’s also if there’s some script defining the variable $esc.

+1 for $escapetool as well for the aforementioned reasons.

Apparently it’s possible to configure Escapetool to use another key then esc using org.apache.velocity.tools.generic.EscapeTool#setKey.

Yes, as I said, “It’s easy to fix as EscapeTool is configurable” but that was not really the question.

That’s what I meant by “less conflict proof” but you could say the same about any variable.

I also prefer $escapetool, even if it’s longer.