Hi Serge,
the escaping of the characters #$'" does not work in all cases.
I suggest you try:
#set( $H = '#' )
#set( $D = '$' )
#set( $Q = '"' )
#set( $S = "'" )
#mymacro( $attribute "${H}include ${Q}${attribute.type.name}.h${Q}")
You could also use the EscapeTool (from the VelocityTools subproject).
Alternatively, since Velocity 1.5 you can escape quotes by doubling
them.
Cheers,
Christoph
Serge Emantayev wrote:
> Hi everyone,
> I just started to use the Velocity templates. It's an amazing tool. I've a
> problem using velocity macros. I have following:
>
> #macro (mymacro $arg $action)
> #if (some condition on $arg)
> $action
> #end
> #end
>
> Now, I want to call my macro following way (yes, it's c++ code generation :-)
> ):
>
> #mymacro ($attribute "\#include \"${attribute.type.name}.h\"")
>
> The purpose is to put #include "type.h" whenever the attribute matches a
> criterion. Unfortunately, this code does not work, it breaks somewhere near
> "\#include...". Can you help me to fix it?
>
> Thank you,
> Serge Emantayev
> mailto:[EMAIL PROTECTED]
>
>
>
>
>
> ____________________________________________________________________________________
> Pinpoint customers who are looking for what you sell.
> http://searchmarketing.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]