velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fedor Karpelevitch <fadkarpelevi...@excite.com>
Subject RE: Rendering Velocity Templates with Texen
Date Mon, 18 Dec 2000 22:35:30 GMT
Hi!

As far as I understand how escaping currently works in velocity the easiest
way to accomplish what you want is to put the content you do not want to
parse into separate files and #include them. I agree though that some clean
way of escaping references (like CDATA or smth else) would be useful.

fedor. 


On Mon, 18 Dec 2000 16:54:50 -0500, velocity-user@jakarta.apache.org wrote:

>  
>  >Also, as always, give examples in case it is a bug so that Geir and 
>  >Jason can fix them.
>  
>  What I am trying to achieve is through Torque/Texen to create Velocity
>  Templates. The Insert.vm Template is referenced through the Control.vm
>  template and I want to produce in, a corresponding output template;
>  
>  
>  #if($skin)
>      $!data.setLayoutTemplate($!skin.getLayout())
>      $!page.setCss($!skin.getCss())
>  #end
>  
>  
>  That was the part I dont want to be processed. If I put them like that in
>  the Insert.vm template, then it comes out as, nothing (as expected). If
>  instead I escape the #'s;
>  
>  
>  \#if($skin)
>      $!data.setLayoutTemplate($!skin.getLayout())
>      $!page.setCss($!skin.getCss())
>  \#end
>  
>  
>   it comes out as;
>  
>  
>  
>  #if($skin)
>      
>      
>  #end
>  
>  
>  again as expected. If I escape the $'s and !'s in there;
>  
>  
>  \#if(\$skin)
>      \$\!data.setLayoutTemplate(\$\!skin.getLayout())
>      \$\!page.setCss(\$\!skin.getCss())
>  \#end
>  
>  
>    it comes out as;
>  
>  
>  #if(\$skin)
>      \!data.setLayoutTemplate(\!skin.getLayout())
>      \!page.setCss(\!skin.getCss())
>  #end
>  
>  
>  If I escape the !'s and not the $'s;
>  
>  
>  \#if($skin)
>      $\!data.setLayoutTemplate($\!skin.getLayout())
>      $\!page.setCss($\!skin.getCss())
>  \#end
>  
>  
>    it comes out as;
>  
>  
>  #if($skin)
>      $\!data.setLayoutTemplate($\!skin.getLayout())
>      $\!page.setCss($\!skin.getCss())
>  #end
>  
>  
>  I was wondering if there was existing functionality to do something like;
>  
>  #CDATA
>    #if($skin)
>      $!data.setLayoutTemplate($!skin.getLayout())
>      $!page.setCss($!skin.getCss())
>    #end
>  #end  
>  
>  so that the lines will be spat out as is onto the Torque/Texen output. I
>  also have some parts that require Texen to use the context, like;
>  
>  #foreach ($${colFKjn} in $all${colFKjn}s )
>     <option
>  value="$${colFKjn}.get${colFKjn}id()">$${colFKjn}.getName()</option>
>  #end
>  
>  which, if ${colFKjn} is the State table, at the end of processing I would
>  want to come out something like;
>  
>  #foreach ($State in $allStates )
>     <option value="$State.getStateid()">$State.getName()</option>
>  #end
>  
>  escaping off the first $ doesnt work, is there a way to do this
currently? I
>  also tried setting;
>  
>  $dollar = "$"
>  
>  and putting it in as;
>  
>  \#foreach (${dollar}${colFKjn} in ${dollar}all${colFKjn}s )
>    <option
> 
value="${dollar}${colFKjn}.get${colFKjn}id()">${dollar}${colFKjn}.getName()<
>  /option>
>  \#end
>  
>  which appears to be failing when the reference is put in as $.
>  
>  
>  This is with the Velocity-0.71 that was uploaded into Turbine on Mon Dec
18
>  01:10:51 2000. I havent tested it with a velocity build directly from CVS
>  yet.
>  
>  
>  
>  
>  
>  Cameron Riley

--
BNTP: Bad News Transfer Protocol





_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/



Mime
View raw message