Re: [Freemarker-devel] Ideal tag syntax; what's your take on it?

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user,gmane.comp.web.freemarker.devel
Message-ID <[email protected]>
Saturday, June 11, 2011, 3:28:42 PM, Daniel Henrique Alves Lima wrote:

[snip]
>> Of course it raises the need for vertical-flow-statements (my term for
>> it...) like:
>>
>>   #vIf condition [
>>     [ <- static, not printed if condition is flase

("false"...)

>>       #vEndIf [
>>         static, always printed
>>       ]
>>     ] <- static, not printed if condition is flase
>>   ]
>>
>> but those are handy even if you have no syntactical problems, so
>> that's not a problem in itself.
>>
>
> I'm afraid I couldn't understand the example :-(
[snip]

It's only remotely relevant anyway... but, let's see. Certainly you
know this situation:

  [#if important]
    <div class="important">
  [/#if]
      ... Lot of other stuff here ...
  [#if important]
    </div>
  [/#if]

Here, you want the div to be conditionally present, but what's inside
of it is not conditional. It's like a conditional bordering. For that
you have to repeat the #if twice, despite in principle you had to
decide only once (do you want that bordering or not). With vertical
flow control statements you only need a single "if" (although to
indicate where the unconditional part begins you will need some trick,
like introducing the vEndIf directive):

  [#vIf important]
    <div class="important">
      [#vEndIf]
        ... Lot of other stuff here ...
      [/#vEndIf]
    </div>
  [/#vIf]

In something like FreeMarker (which actually doesn't have vIf) this is
just convenient. But in a language where the static text parts are
parsed and thus has to maintain some kind of proper nesting, this
trick becomes crucial. (If anybody knows what the official name of
this kind of flow control is, tell me... As far as I know it's my
"invention", but surely many others has invented it too.)

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.