I think HTML-escaping of inserted text can be handled using a
ReferenceInsertionEventHandler, can't it?  I've never used one, but see

    http://jakarta.apache.org/velocity/developer-guide.html#EventCartridge and Event 
Handlers

However, this would do HTML-escaping for *all* references; it might be
preferable to have more control, so that you could escape selected
references, while still allowing raw HTML to be inserted in some instances,
e.g.

  | <tr><td>Name:</td>
  |     <td>#html($user.name)</td></tr>
  | <tr><td>Address:</td>
  |     <td>$user.address.toXhtml()</td></tr>

A custom directive would be one way to go, but couldn't this also be done
using a simple context-tool, and a macro? e.g

  | #define(html $string)
  | $htmlTool.escape($string)
  | #end

I guess it depends what syntax you want.  In some ways, it might be "nicer"
to make HTML-escaping the default for most references, but allow overrides
in certain case, e.g.

  | <tr><td>Name:</td>
  |     <td>$user.name</td></tr>
  | <tr><td>Address:</td>
  |     <td>#raw($user.address.toXhtml())</td></tr>

Not sure how to implement that.

-- 
cheers, Mike                             (http://www.dogbiscuit.org/mdub/)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to