Re: Bug: Amaya does not preserve Jakarta Velocity template langua ge statements

Mike Keating wrote:
>
> Hi Vincent -
> 
> > Amaya is probably not the best tool you may use to edit templates.
> > Amaya tries to produce valid documents, but Velocity templates,
> > as far as I understand, are not valid HTML or XML documents. They are
> > made of a mix of HTML fragments and VTL statements and the result is
> > not usually valid HTML. I guess this is the reason why Amaya strip
> > out some VTL statements.
> 
> 
> I was under the impression that velocity template language is simply treated
> as html content in the body of the document unless it's run through the
> Velocity template processor.

Right, but the issue is that some VTL statements may appear at locations
where no content is allowed. For instance, the example below is invalid HTML:

   <table>
     <tbody>
     #foreach( $mud in $mudsOnSpecial )
        #if ( $customer.hasPurchased($mud) )
           <tr>
             <td>
               $flogger.getPromo( $mud )
             </td>
           </tr>
        #end
     #end
     </tbody>
   </table>

In a HTML document, no content is expected between tags <table> and <tr>
or between </tr> and </table> (What would it mean?)

> In other words, if I open a velocity template in a web browser without
> processing it, i should just see the statements on the web page pretty much
> as i had typed them in.

Not sure. Take the above example. All lines starting with a '#' are
considered invalid. Then you can't make any assumption about the way
a HTML browser would display them. It could simply reject the whole
document, or remove the invalid parts, or display them in a specific
way, or... This depends on the error recovery mechanism used by
the browser.

> is there any reason why Amaya should remove lines that begin with "#" or
> "$"?  It should just be text to Amaya.

Amaya is tolerant in what it receives and the example above works
almost the way you expect. Amaya does not remove the invalid content.
It certainly does not discard all lines starting with "#" or "$"
either.

Could you send me an example where this happens?

Vincent.

> 
> Mike Keating wrote:
> > 
> > I'm using Amaya 4.3.2 to design some Velocity templates, using
> statements
> > like
> > 
> >    #foreach( $item in $items )
> >       The item name is $item.name<br>
> >    #end
> > 
> > 
> > Sometimes Amaya will strip out the statements beginning with "#" - I
> believe
> > it happens when I look at the document in structure view, and/or when
> I save
> > the document to disk.
> > 
> > Velocity site here:
> > 
> >    http://jakarta.apache.org/velocity
> 
> 

-------------------------------------------------------
Vincent Quint                       INRIA Rhône-Alpes
W3C/INRIA                           ZIRST
e-mail: Vincent.Quint@w3.org        655 avenue de l'Europe
Tel.: +33 4 76 61 53 62             Montbonnot
Fax:  +33 4 76 61 52 07             38334 Saint Ismier Cedex
                                    France

Received on Saturday, 23 June 2001 05:06:17 UTC