You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Ed Yu <ek...@asgnet.psc.sc.edu> on 2002/07/08 23:01:08 UTC

Macro calls related question

Here is my vm file:

<html>
#macro (nofun)
    This is no fun!<br>
#end
#macro (fun arg1)
    This is fun for $arg1.<br>
#end

#fun("me")
</html>

It renders properly with output:

This is fun for me. 

But if I add #fun("#nofun") or #fun("\#nofun"), it result an error. What
I really want to do here is to use the # sign as a literal character
such that it will display:

This is fun for #nofun,

How do I achieve this? Or is it a potential parser error?

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Ed Yu, IBM Certified Specialist - AIX System Administrator
Information Technology Manager,
University of South Carolina,
Advanced Solutions Group, Physics Dept.,
Columbia, SC 29208
Office (803)777-8831, FAX (803)777-8833, Email ekyu@asgnet.psc.sc.edu


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Macro calls related question

Posted by Ch...@dlr.de.
Have you tried using
#set( $H = '#' )
#fun( "${H}nofun" )
to call your macro? Maybe it will work! (some odds remain, since
macro indirect references are a world of their own).

Cheers,
Christoph

Ed Yu wrote:
> Here is my vm file:
> 
> <html>
> #macro (nofun)
>     This is no fun!<br>
> #end
> #macro (fun arg1)
>     This is fun for $arg1.<br>
> #end
> 
> #fun("me")
> </html>
> 
> It renders properly with output:
> 
> This is fun for me. 
> 
> But if I add #fun("#nofun") or #fun("\#nofun"), it result an error. What
> I really want to do here is to use the # sign as a literal character
> such that it will display:
> 
> This is fun for #nofun,
> 
> How do I achieve this? Or is it a potential parser error?
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Ed Yu, IBM Certified Specialist - AIX System Administrator


-- 
:) Christoph Reck


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>