You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Mike Haberman <mi...@ncsa.uiuc.edu> on 2002/06/13 22:12:01 UTC

assign the output of #parse ?

I read the user's guide.  It claimed that you can do the following:
#set($stuff = "#bold('hello')" )


What I want is
#set ($text = "#parse('somefile.vm')")
so I can process the contents of 'somefile.vm'

Doesn't seem to work.  Is there a way to assign the output of #parse()
to a variable?

thanks a ton!

mike

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


Re: assign the output of #parse ?

Posted by Mike Haberman <mi...@ncsa.uiuc.edu>.
Got it: (this works)

#set ($file = "news/info/5.23.2002.vm")
#set ($text = "#parse($file)")
GOT $text

The problem has to do with how the ' and " are handled

mike


On Thu, Jun 13, 2002 at 03:27:29PM -0500, Mike Haberman wrote:
> here's the test:
> ------------------------
> 
> #macro (readFile $dir $file)
>    #parse("$dir/$file")
> #end
> 
> #set ($dir = "news")
> #set ($file = "5.23.2002.vm")
> #set ($text = "#parse('$dir/$file')")
> GOT $text
> #set ($text = "#readFile($dir $file)")
> GOT $text
> 
> 
> here's the output:
> ------------------------
> 
> GOT #parse('$dir/$file') GOT #readFile(news 5.23.2002.vm)
> 
> 
> 
> thanks for the quick response!
> 
> mike
> 
> 
> 
> 
> 
> On Thu, Jun 13, 2002 at 04:21:17PM -0400, Geir Magnusson Jr. wrote:
> > On 6/13/02 4:12 PM, "Mike Haberman" <mi...@ncsa.uiuc.edu> wrote:
> > 
> > > 
> > > I read the user's guide.  It claimed that you can do the following:
> > > #set($stuff = "#bold('hello')" )
> > > 
> > > 
> > > What I want is
> > > #set ($text = "#parse('somefile.vm')")
> > > so I can process the contents of 'somefile.vm'
> > > 
> > > Doesn't seem to work.  Is there a way to assign the output of #parse()
> > > to a variable?
> > 
> > That should work just fine.
> > 
> > What do you get?
> > 
> > -- 
> > Geir Magnusson Jr. 
> > Research & Development, Adeptra Inc.
> > geirm@adeptra.com
> > +1-203-247-1713
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> -- 
> -------------------------------------------------
> I am Vinz, Vinz Clortho.  Keymaster of Gozer,
> Volguus Zildrohar, Lord of the Sebouillia.
> Are you the Gatekeeper?
> -------------------------------------------------
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 
-------------------------------------------------
I am Vinz, Vinz Clortho.  Keymaster of Gozer,
Volguus Zildrohar, Lord of the Sebouillia.
Are you the Gatekeeper?
-------------------------------------------------

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


Re: assign the output of #parse ?

Posted by Mike Haberman <mi...@ncsa.uiuc.edu>.
here's the test:
------------------------

#macro (readFile $dir $file)
   #parse("$dir/$file")
#end

#set ($dir = "news")
#set ($file = "5.23.2002.vm")
#set ($text = "#parse('$dir/$file')")
GOT $text
#set ($text = "#readFile($dir $file)")
GOT $text


here's the output:
------------------------

GOT #parse('$dir/$file') GOT #readFile(news 5.23.2002.vm)



thanks for the quick response!

mike





On Thu, Jun 13, 2002 at 04:21:17PM -0400, Geir Magnusson Jr. wrote:
> On 6/13/02 4:12 PM, "Mike Haberman" <mi...@ncsa.uiuc.edu> wrote:
> 
> > 
> > I read the user's guide.  It claimed that you can do the following:
> > #set($stuff = "#bold('hello')" )
> > 
> > 
> > What I want is
> > #set ($text = "#parse('somefile.vm')")
> > so I can process the contents of 'somefile.vm'
> > 
> > Doesn't seem to work.  Is there a way to assign the output of #parse()
> > to a variable?
> 
> That should work just fine.
> 
> What do you get?
> 
> -- 
> Geir Magnusson Jr. 
> Research & Development, Adeptra Inc.
> geirm@adeptra.com
> +1-203-247-1713
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 
-------------------------------------------------
I am Vinz, Vinz Clortho.  Keymaster of Gozer,
Volguus Zildrohar, Lord of the Sebouillia.
Are you the Gatekeeper?
-------------------------------------------------

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


Re: assign the output of #parse ?

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 6/13/02 4:12 PM, "Mike Haberman" <mi...@ncsa.uiuc.edu> wrote:

> 
> I read the user's guide.  It claimed that you can do the following:
> #set($stuff = "#bold('hello')" )
> 
> 
> What I want is
> #set ($text = "#parse('somefile.vm')")
> so I can process the contents of 'somefile.vm'
> 
> Doesn't seem to work.  Is there a way to assign the output of #parse()
> to a variable?

That should work just fine.

What do you get?

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



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