You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jeff Schnitzer <je...@infohazard.org> on 2002/10/19 20:28:46 UTC

Freemarker Syntax (was: a lot of junk)

On 10/19/02 9:43 AM, "Daniel Dekany" <dd...@freemail.hu> wrote:
> 
> <if foo>
> a
> <elseif bar>
> b
> <elseif baaz>
> c
> <else>
> d
> </if>

Ugh.  This is probably the #2 reason I will avoid freemarker:
It looks waaay too much like the surrounding XML-ish content.

The worst of it is not when you are filling in big textual
areas of XML elements, but attributes.  JSTL has the same
awful problem.

<table>
  <tr>
    <td class="<if foo>a<elseif bar>b<else>c</if>">
	</td>
  </tr>
</table>

That just creeps me out, and XML compliance is out the window.

Jeff Schnitzer
jeff@infohazard.org

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


Re: Freemarker Syntax (was: a lot of junk)

Posted by Jonathan Revusky <re...@wanadoo.es>.
On Sunday 20 October 2002 12:20 am, Derick Fernando wrote:
> Ewww, that is horrible, there goes validation, and readability. 

Various of you seem to suffer from a misconception. There is no particular 
reason to *validate* a raw FreeMarker template. If you are generating XML 
with FreeMarker (and believe me, this is quite feasible) then you are 
concerned with the *generated output* being well-formed and possibly valid as 
well.

As for readability, I have received various feedback that FreeMarker syntax is 
more readable. For example, the closing of a directive states more clearly 
what is being closed.

<if condition>
....
</if>

The closing </if> states that this is the end of an if condition -- as opposed 
to Velocity's #end which ends macros, ifs, and other things.

> This crap
> is what all the fuss is about? I wouldn't use it with any of my XML or
> HTML. #set for example stands out against any other markup.

If you'd been reading the discussion more carefully, you would have noted that 
we have an alternative syntax that largely resolves that issue.

<#assign foo="bar">

<# cannot be confused with valid markup (since elements cannot begin with #) 
and this can easily be set as a regexp pattern for highlighting in various 
editor modes, etcetera. In any case, with this alternative syntax (introduced 
in 2.1, Daniel Dekany's idea) makes FreeMarker directives stand out against 
any other markup.

I only became actively involved in FreeMarker development really about a year 
ago and the pseudo-tag syntax had existed for nearly 3 years at that point.

OTOH, I had been an end-user of FreeMarker for 2 years preceding that, and in 
my own experience, I found that the FreeMarker syntax worked quite well in 
practice, since HTML coders would just tend to relate to it as a few "extra 
tags" -- which it isn't really, of course. But I mean, they wouldn't perceive 
it as something so new and intimidating.

Truth told, I think that comparing syntax is pretty much a red herring. People 
use whatever syntax is there and probably get used it within a few days or so 
anyway. 

Regards,

Jonathan Revusky
--
FreeMarker-Velocity comparison doc
http://freemarker.sourceforge.net/fmVsVel.html
Velocity->FreeMarker template conversion utility
http://freemarker.sourceforge.net/usCavalry.html


>
> Derick.
>
> ----- Original Message -----
> From: "Daniel Dekany" <dd...@freemail.hu>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: Saturday, October 19, 2002 12:15 PM
> Subject: Re: Freemarker Syntax (was: a lot of junk)
>
> > Saturday, October 19, 2002, 8:28:46 PM, Jeff Schnitzer wrote:
> > > On 10/19/02 9:43 AM, "Daniel Dekany" <dd...@freemail.hu> wrote:
> > >> <if foo>
> > >> a
> > >> <elseif bar>
> > >> b
> > >> <elseif baaz>
> > >> c
> > >> <else>
> > >> d
> > >> </if>
> > >
> > > Ugh.  This is probably the #2 reason I will avoid freemarker:
> > > It looks waaay too much like the surrounding XML-ish content.
> >
> > Well, I guess the original intent was that the designer feels that he
> > just works with an extended HTML... so, it intentionally looks like
> > the surrounding XML or HTML.
> >
> > > The worst of it is not when you are filling in big textual
> > > areas of XML elements, but attributes.  JSTL has the same
> > > awful problem.
> > >
> > > <table>
> > >   <tr>
> > >     <td class="<if foo>a<elseif bar>b<else>c</if>">
> > >         </td>
> > >   </tr>
> > > </table>
> > >
> > > That just creeps me out, and XML compliance is out the window.
> >
> > XML compliance? If you say that you want the *template* to be
> > well-formed XML, them it is out the window. If you want produce XML
> > with FreeMarker templates, then that's not a problem.
> >
> > What would be a syntax what you would prefer? (How would your example
> > looks with that syntax?)
> >
> >
> > --
> > To unsubscribe, e-mail:
>
> <ma...@jakarta.apache.org>
>
> > For additional commands, e-mail:
>
> <ma...@jakarta.apache.org>


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


Re: Freemarker Syntax (was: a lot of junk)

Posted by Daniel Dekany <dd...@freemail.hu>.
Sunday, October 20, 2002, 4:15:22 AM, Derick Fernando wrote:

> Acutally yes, Granted my templates are simple, I only use logic between
> tags:
>
> Velocity:
> #foreach( $bozo in $bozos )
> <td>$bozo.name</td>
> #end

(Even in this case, it is not valid XHTML. <tr> does not allow text
around <td>s.)

> Freemarker:
> <foreach bozo in bozos>
> <td>${bozo.name}<td>
> </foreach>
>
> Simple reader class removes #lines and validates templates recursively (they
> are xml).

Aha. So your templates are *not* valid XHTML-s, but you preprocess
them before validation. You can do exactly the same with FreeMarker
templates.

--
Daniel

> Derick.

> ----- Original Message -----
> From: "Daniel Dekany" <dd...@freemail.hu>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: Saturday, October 19, 2002 5:32 PM
> Subject: Re: Freemarker Syntax (was: a lot of junk)


>> Sunday, October 20, 2002, 12:20:08 AM, Derick Fernando wrote:
>>
>> > Ewww, that is horrible, there goes validation, and readability. This
> crap is
>> > what all the fuss is about? I wouldn't use it with any of my XML or
> HTML.
>> > #set for example stands out against any other markup.
>> >
>> > Derick.
>>
>> Man... I hope you write these totally stupid things, because you are
>> *very* angry. You can't tell it seriously, that you look at that 10
>> lines of FreeMarker, and you know that FM is a "crap". Also, "there
>> goes validation"... you used to validate your *templates* against some
>> DTD??? Don't answer...
>>
>> > ----- Original Message -----
>> > From: "Daniel Dekany" <dd...@freemail.hu>
>> > To: "Velocity Users List" <ve...@jakarta.apache.org>
>> > Sent: Saturday, October 19, 2002 12:15 PM
>> > Subject: Re: Freemarker Syntax (was: a lot of junk)
>>
>>
>> >> Saturday, October 19, 2002, 8:28:46 PM, Jeff Schnitzer wrote:
>> >>
>> >> > On 10/19/02 9:43 AM, "Daniel Dekany" <dd...@freemail.hu> wrote:
>> >> >>
>> >> >> <if foo>
>> >> >> a
>> >> >> <elseif bar>
>> >> >> b
>> >> >> <elseif baaz>
>> >> >> c
>> >> >> <else>
>> >> >> d
>> >> >> </if>
>> >> >
>> >> > Ugh.  This is probably the #2 reason I will avoid freemarker:
>> >> > It looks waaay too much like the surrounding XML-ish content.
>> >>
>> >> Well, I guess the original intent was that the designer feels that he
>> >> just works with an extended HTML... so, it intentionally looks like
>> >> the surrounding XML or HTML.
>> >>
>> >> > The worst of it is not when you are filling in big textual
>> >> > areas of XML elements, but attributes.  JSTL has the same
>> >> > awful problem.
>> >> >
>> >> > <table>
>> >> >   <tr>
>> >> >     <td class="<if foo>a<elseif bar>b<else>c</if>">
>> >> >         </td>
>> >> >   </tr>
>> >> > </table>
>> >> >
>> >> > That just creeps me out, and XML compliance is out the window.
>> >>
>> >> XML compliance? If you say that you want the *template* to be
>> >> well-formed XML, them it is out the window. If you want produce XML
>> >> with FreeMarker templates, then that's not a problem.
>> >>
>> >> What would be a syntax what you would prefer? (How would your example
>> >> looks with that syntax?)
>> >>
>> >>
>> >> --
>> >> To unsubscribe, e-mail:
>> > <ma...@jakarta.apache.org>
>> >> For additional commands, e-mail:
>> > <ma...@jakarta.apache.org>
>> >>
>>
>>
>> > --
>> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
>> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>>
>>
>> --
>> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>>


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


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


Re: Freemarker Syntax (was: a lot of junk)

Posted by Derick Fernando <de...@xenocex.com>.
Acutally yes, Granted my templates are simple, I only use logic between
tags:

Velocity:
#foreach( $bozo in $bozos )
<td>$bozo.name</td>
#end

Freemarker:
<foreach bozo in bozos>
<td>${bozo.name}<td>
</foreach>

Simple reader class removes #lines and validates templates recursively (they
are xml).

Derick.

----- Original Message -----
From: "Daniel Dekany" <dd...@freemail.hu>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Saturday, October 19, 2002 5:32 PM
Subject: Re: Freemarker Syntax (was: a lot of junk)


> Sunday, October 20, 2002, 12:20:08 AM, Derick Fernando wrote:
>
> > Ewww, that is horrible, there goes validation, and readability. This
crap is
> > what all the fuss is about? I wouldn't use it with any of my XML or
HTML.
> > #set for example stands out against any other markup.
> >
> > Derick.
>
> Man... I hope you write these totally stupid things, because you are
> *very* angry. You can't tell it seriously, that you look at that 10
> lines of FreeMarker, and you know that FM is a "crap". Also, "there
> goes validation"... you used to validate your *templates* against some
> DTD??? Don't answer...
>
> > ----- Original Message -----
> > From: "Daniel Dekany" <dd...@freemail.hu>
> > To: "Velocity Users List" <ve...@jakarta.apache.org>
> > Sent: Saturday, October 19, 2002 12:15 PM
> > Subject: Re: Freemarker Syntax (was: a lot of junk)
>
>
> >> Saturday, October 19, 2002, 8:28:46 PM, Jeff Schnitzer wrote:
> >>
> >> > On 10/19/02 9:43 AM, "Daniel Dekany" <dd...@freemail.hu> wrote:
> >> >>
> >> >> <if foo>
> >> >> a
> >> >> <elseif bar>
> >> >> b
> >> >> <elseif baaz>
> >> >> c
> >> >> <else>
> >> >> d
> >> >> </if>
> >> >
> >> > Ugh.  This is probably the #2 reason I will avoid freemarker:
> >> > It looks waaay too much like the surrounding XML-ish content.
> >>
> >> Well, I guess the original intent was that the designer feels that he
> >> just works with an extended HTML... so, it intentionally looks like
> >> the surrounding XML or HTML.
> >>
> >> > The worst of it is not when you are filling in big textual
> >> > areas of XML elements, but attributes.  JSTL has the same
> >> > awful problem.
> >> >
> >> > <table>
> >> >   <tr>
> >> >     <td class="<if foo>a<elseif bar>b<else>c</if>">
> >> >         </td>
> >> >   </tr>
> >> > </table>
> >> >
> >> > That just creeps me out, and XML compliance is out the window.
> >>
> >> XML compliance? If you say that you want the *template* to be
> >> well-formed XML, them it is out the window. If you want produce XML
> >> with FreeMarker templates, then that's not a problem.
> >>
> >> What would be a syntax what you would prefer? (How would your example
> >> looks with that syntax?)
> >>
> >>
> >> --
> >> To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> >> For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >>
>
>
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


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


Re: Freemarker Syntax (was: a lot of junk)

Posted by Daniel Dekany <dd...@freemail.hu>.
Sunday, October 20, 2002, 12:20:08 AM, Derick Fernando wrote:

> Ewww, that is horrible, there goes validation, and readability. This crap is
> what all the fuss is about? I wouldn't use it with any of my XML or HTML.
> #set for example stands out against any other markup.
>
> Derick.

Man... I hope you write these totally stupid things, because you are
*very* angry. You can't tell it seriously, that you look at that 10
lines of FreeMarker, and you know that FM is a "crap". Also, "there
goes validation"... you used to validate your *templates* against some
DTD??? Don't answer...

> ----- Original Message -----
> From: "Daniel Dekany" <dd...@freemail.hu>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: Saturday, October 19, 2002 12:15 PM
> Subject: Re: Freemarker Syntax (was: a lot of junk)


>> Saturday, October 19, 2002, 8:28:46 PM, Jeff Schnitzer wrote:
>>
>> > On 10/19/02 9:43 AM, "Daniel Dekany" <dd...@freemail.hu> wrote:
>> >>
>> >> <if foo>
>> >> a
>> >> <elseif bar>
>> >> b
>> >> <elseif baaz>
>> >> c
>> >> <else>
>> >> d
>> >> </if>
>> >
>> > Ugh.  This is probably the #2 reason I will avoid freemarker:
>> > It looks waaay too much like the surrounding XML-ish content.
>>
>> Well, I guess the original intent was that the designer feels that he
>> just works with an extended HTML... so, it intentionally looks like
>> the surrounding XML or HTML.
>>
>> > The worst of it is not when you are filling in big textual
>> > areas of XML elements, but attributes.  JSTL has the same
>> > awful problem.
>> >
>> > <table>
>> >   <tr>
>> >     <td class="<if foo>a<elseif bar>b<else>c</if>">
>> >         </td>
>> >   </tr>
>> > </table>
>> >
>> > That just creeps me out, and XML compliance is out the window.
>>
>> XML compliance? If you say that you want the *template* to be
>> well-formed XML, them it is out the window. If you want produce XML
>> with FreeMarker templates, then that's not a problem.
>>
>> What would be a syntax what you would prefer? (How would your example
>> looks with that syntax?)
>>
>>
>> --
>> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>>


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


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


Re: Freemarker Syntax (was: a lot of junk)

Posted by Derick Fernando <de...@xenocex.com>.
Ewww, that is horrible, there goes validation, and readability. This crap is
what all the fuss is about? I wouldn't use it with any of my XML or HTML.
#set for example stands out against any other markup.

Derick.

----- Original Message -----
From: "Daniel Dekany" <dd...@freemail.hu>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Saturday, October 19, 2002 12:15 PM
Subject: Re: Freemarker Syntax (was: a lot of junk)


> Saturday, October 19, 2002, 8:28:46 PM, Jeff Schnitzer wrote:
>
> > On 10/19/02 9:43 AM, "Daniel Dekany" <dd...@freemail.hu> wrote:
> >>
> >> <if foo>
> >> a
> >> <elseif bar>
> >> b
> >> <elseif baaz>
> >> c
> >> <else>
> >> d
> >> </if>
> >
> > Ugh.  This is probably the #2 reason I will avoid freemarker:
> > It looks waaay too much like the surrounding XML-ish content.
>
> Well, I guess the original intent was that the designer feels that he
> just works with an extended HTML... so, it intentionally looks like
> the surrounding XML or HTML.
>
> > The worst of it is not when you are filling in big textual
> > areas of XML elements, but attributes.  JSTL has the same
> > awful problem.
> >
> > <table>
> >   <tr>
> >     <td class="<if foo>a<elseif bar>b<else>c</if>">
> >         </td>
> >   </tr>
> > </table>
> >
> > That just creeps me out, and XML compliance is out the window.
>
> XML compliance? If you say that you want the *template* to be
> well-formed XML, them it is out the window. If you want produce XML
> with FreeMarker templates, then that's not a problem.
>
> What would be a syntax what you would prefer? (How would your example
> looks with that syntax?)
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


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


Re: Freemarker Syntax (was: a lot of junk)

Posted by Daniel Dekany <dd...@freemail.hu>.
Saturday, October 19, 2002, 8:28:46 PM, Jeff Schnitzer wrote:

> On 10/19/02 9:43 AM, "Daniel Dekany" <dd...@freemail.hu> wrote:
>> 
>> <if foo>
>> a
>> <elseif bar>
>> b
>> <elseif baaz>
>> c
>> <else>
>> d
>> </if>
>
> Ugh.  This is probably the #2 reason I will avoid freemarker:
> It looks waaay too much like the surrounding XML-ish content.

Well, I guess the original intent was that the designer feels that he
just works with an extended HTML... so, it intentionally looks like
the surrounding XML or HTML.

> The worst of it is not when you are filling in big textual
> areas of XML elements, but attributes.  JSTL has the same
> awful problem.
>
> <table>
>   <tr>
>     <td class="<if foo>a<elseif bar>b<else>c</if>">
>         </td>
>   </tr>
> </table>
>
> That just creeps me out, and XML compliance is out the window.

XML compliance? If you say that you want the *template* to be
well-formed XML, them it is out the window. If you want produce XML
with FreeMarker templates, then that's not a problem.

What would be a syntax what you would prefer? (How would your example
looks with that syntax?)


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