Tuesday, June 24, 2003, 3:01:57 PM, Mike Williams wrote:

> 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
[snip]

Actually, I remember that earlier I used that to do automatic escaping,
and then something like like $asis($someHtml) to prevent escaping in the
exceptional cases. It maybe works well if all template in your project
uses HTML escaping automatically everywhere, but it can't be used with
#escape directive (or at least it's not the natural way of implementing
#escape). Consider:

#macro(foo)
  ## Should NOT be escaped:
  $bar
#end

#escape(html)
  #foo()
  ## Should be escaped:
  $bar
#end

Or you can imagine similar situation with #parse. So this is why I said
that automatic escaping is a parse time thing, and not a runtime thing.
Only those references should be escaped, that are between #escape and
the #end *in the template file*.

-- 
Best regards,
 Daniel Dekany



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

Reply via email to