You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Dan Finkelstein <da...@emind.com> on 2001/07/21 01:04:11 UTC

#parse doesn't work with evaluate()

Here's an odd one.   It happens in the 1.2 dev jar, not in Velocity 
1.0.  #parse fails when evaluate() is used but works ok with 
getTemplate()/merge().

We have templates that begin something like this line:

	#parse ("global.vm")

It has a bunch of #set-s.  Typical lines might be something like

	#set ($jFontFace = 'Arial, Helvetica, Tahoma, Verdana, sans-serif')
	#set ($style_author = "font-family: $jFontFace; font-size: 12pt; color: 
#CCCCCC")

What we really want is for this file to be read in before every template is 
processed, sort of like a global define.  Now, when we run our processor, 
velocity.log contains this error:

	Fri Jul 20 15:16:36 PDT 2001  [error] #parse : cannot find global.vm template!

Weird.  Now, if I change the line to

	#include ("global.vm")

then it finds the file just fine.  Strange, huh?

I included some small files so you can replicate it easily....

Thanks again,
Dan

	

Re: #parse doesn't work with evaluate()

Posted by Dan Finkelstein <da...@emind.com>.
This new jar worked great !! We are very, very happy campers !!

Thanks Geir,

Dan

PS -- The reason that Piero can't read the 
whiteboard/geir/velocity_src_20010722.tgz file is that it wasn't added with 
the "-kb" flag -- for binary files.



At 10:40 PM 7/22/01 -0400, you wrote:
>Dan Finkelstein wrote:
> >
> > Here's an odd one.   It happens in the 1.2 dev jar, not in Velocity
> > 1.0.  #parse fails when evaluate() is used but works ok with
> > getTemplate()/merge().
>
>[SNIP]
>
>This is now fixed in both CVS HEAD as well as the proposed version in
>/whiteboard/geir.
>
>I am uploading a new source tree for the 'single instance' code as well
>as a jar, so anyone interested in the new separate instance stuff should
>use the whiteboard version - it is up to date with CVS HEAD, and
>everyone else should give the new jar from whiteboard a try in their
>existing apps to make sure that the latest changes don't do any harm.
>It shouldn't :) The more testers the merrier.
>
>geir
>
>--
>Geir Magnusson Jr.                           geirm@optonline.net
>System and Software Consulting
>Developing for the web?  See http://jakarta.apache.org/velocity/
>Be well, do good work, and keep in touch.

Dan Finkelstein
Senior Architect, Instructional Tools & Technology
eMind LLC
Northern California Annex
1250 Addison St, Suite #210
Berkeley, CA 94702-1700
Tel: (510) 486-2740
Fax: (510)486-2843

Visit us at <http://www.emind.com/>

This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message.


Re: #parse doesn't work with evaluate()

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
The reason why this doesn't work is because I have been a distracted
dunderhead lately and I didn't fix it when I fixed #inculde() - I will
have the fix in tonight...  I know what it is...

geir


Dan Finkelstein wrote:
> 
> Here's an odd one.   It happens in the 1.2 dev jar, not in Velocity
> 1.0.  #parse fails when evaluate() is used but works ok with
> getTemplate()/merge().
> 
> We have templates that begin something like this line:
> 
>         #parse ("global.vm")
> 
> It has a bunch of #set-s.  Typical lines might be something like
> 
>         #set ($jFontFace = 'Arial, Helvetica, Tahoma, Verdana, sans-serif')
>         #set ($style_author = "font-family: $jFontFace; font-size: 12pt; color:
> #CCCCCC")
> 
> What we really want is for this file to be read in before every template is
> processed, sort of like a global define.  Now, when we run our processor,
> velocity.log contains this error:
> 
>         Fri Jul 20 15:16:36 PDT 2001  [error] #parse : cannot find global.vm template!
> 
> Weird.  Now, if I change the line to
> 
>         #include ("global.vm")
> 
> then it finds the file just fine.  Strange, huh?
> 
> I included some small files so you can replicate it easily....
> 
> Thanks again,
> Dan
> 
> 
> 
>   ------------------------------------------------------------------------
> 
>    test.vmName: test.vm
>           Type: Plain Text (text/plain)
> 
>    Example.javaName: Example.java
>                Type: Plain Text (text/plain)
> 
>    example.vmName: example.vm
>              Type: Plain Text (text/plain)
> 
>   ------------------------------------------------------------------------
> Dan Finkelstein
> Senior Architect, Instructional Tools & Technology
> eMind LLC
> Northern California Annex
> 1250 Addison St, Suite #210
> Berkeley, CA 94702-1700
> Tel: (510) 486-2740
> Fax: (510)486-2843
> 
> Visit us at <http://www.emind.com/>
> 
> This email message is for the sole use of the intended recipient(s) and may
> contain confidential and privileged information. Any unauthorized review,
> use, disclosure or distribution is prohibited. If you are not the intended
> recipient, please contact the sender by reply email and destroy all copies
> of the original message.

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

Re: #parse doesn't work with evaluate()

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Dan Finkelstein wrote:
> 
> Here's an odd one.   It happens in the 1.2 dev jar, not in Velocity
> 1.0.  #parse fails when evaluate() is used but works ok with
> getTemplate()/merge().

[SNIP]

This is now fixed in both CVS HEAD as well as the proposed version in
/whiteboard/geir.

I am uploading a new source tree for the 'single instance' code as well
as a jar, so anyone interested in the new separate instance stuff should
use the whiteboard version - it is up to date with CVS HEAD, and
everyone else should give the new jar from whiteboard a try in their
existing apps to make sure that the latest changes don't do any harm. 
It shouldn't :) The more testers the merrier.

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
Be well, do good work, and keep in touch.

Re: #parse doesn't work with evaluate()

Posted by Jon Stevens <jo...@latchkey.com>.
on 7/20/01 4:04 PM, "Dan Finkelstein" <da...@emind.com> wrote:

> Here's an odd one.   It happens in the 1.2 dev jar, not in Velocity
> 1.0.  #parse fails when evaluate() is used but works ok with
> getTemplate()/merge().
> 
> We have templates that begin something like this line:
> 
> #parse ("global.vm")
> 
> It has a bunch of #set-s.  Typical lines might be something like
> 
> #set ($jFontFace = 'Arial, Helvetica, Tahoma, Verdana, sans-serif')
> #set ($style_author = "font-family: $jFontFace; font-size: 12pt; color:
> #CCCCCC")
> 
> What we really want is for this file to be read in before every template is
> processed, sort of like a global define.  Now, when we run our processor,
> velocity.log contains this error:
> 
> Fri Jul 20 15:16:36 PDT 2001  [error] #parse : cannot find global.vm template!
> 
> Weird.  Now, if I change the line to
> 
> #include ("global.vm")
> 
> then it finds the file just fine.  Strange, huh?
> 
> I included some small files so you can replicate it easily....
> 
> Thanks again,
> Dan

I would not say that is strange, more a lack of clarity...

I bet what is happening is that #parse is failing to properly parse the file
and therefore, it isn't available to the resource loader. #include doesn't
parse the file.

Now, the question is...why aren't you using #parse to load the file and not
the velocimacro.library= property?

-jon