> <%@ index(Album, Songs, ShowSongs) %>
> album: <% Album %><br/>
> <et:if "ShowSongs">
>  songs:<br/>
>    <et:map "S <- Songs">
>       song: <% S %><br/>
>    </et:map>
> </et:if>

Yuck. If you're needing to do that, why not just pass Songs as an  
empty iolist, and have it be its own component?

Isn't the point of having a component system to be able to do this is  
a real language (Erlang) instead of some underpowered sub-language? As  
someone whose used Struts 2, which uses templates like this one, I can  
tell you that it's going down a bad path.

>
>
> If you are at improving ErlTL I would like to see some whitespace
> handling. As a designer I have a fetish for well looking html sources
> and whats spit out right now doesn´t make me cheer.
>
> On 10 Jan., 09:42, "Yariv Sadan" <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I've seen a few ErlTL enhancement proposals and I'd like to bring  
>> them
>> all together and add some of my ideas to the mix so hopefully we can
>> end up with an improved ErlTL. I think the current ErlTL is a good
>> start but after using it for a while I saw some areas where it can  
>> use
>> some refinement. Specifically, I think ErlTL could use new syntax for
>> the following expressions: if, case, and map. Below is an example
>> showing the use of the current and proposed syntax (for 'if' and
>> 'map'):
>>
>> current:
>>
>> <%@ index(Album, Songs, ShowSongs) %>
>> album: <% Album %><br/>
>> <% if ShowSongs ->
>>          songs(S);
>>         true ->
>>           []
>>      end %>
>>
>> <%@ songs(Songs) %>
>> songs: <br/>
>> <% [song(S) || S <- Songs] %>
>>
>> <%@ song(Song) %>
>> song: <% Song %><br/>
>>
>> Improved:
>>
>> <%@ index(Album, Songs, ShowSongs) %>
>> album: <% Album %><br/>
>> <et:if expr="ShowSongs">
>>  songs:<br/>
>>    <et:map expr="S <- Songs">
>>       song: <% S %><br/>
>>    </et:map>
>> </et:if>
>>
>> In more detaul, the new syntax would be:
>>
>> if:
>>
>> <et:if expr="Expr">
>> <et:elseif expr="Expr">  (optional)
>> <et:else>   (optional)
>> </et:if>
>>
>> case:
>>
>> <et:switch expr="Expr">
>>  <et:case expr="Expr">
>>    stuff...
>>  </et:case>
>>  <et:case expr="Expr">
>>    stuf..
>>  </et:case>
>>  <et:default>   (optional)
>>    stuff...
>>  </et:default>
>> </et:switch>
>>
>> map:
>>
>> <et:map expr="Elem <- List, Elem =/= foo">stuff  <% Elem %></et:map>
>>
>> This syntax is pretty self explanatory. All three constructs would be
>> translated to their Erlang equivalents by the ErlTL parser.
>>
>> I think this is a step in the right direction, but I'm not sure that
>> this is the ideal syntax so I'll be happy to hear some other
>> suggestions.
>>
>> Thanks,
>> Yariv
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to