2008/3/5 Nex3 <[EMAIL PROTECTED]>:
>
> Mislav Marohnić had an interesting idea for extending this. In some
> cases, divs are invalid - within a p tag, for example, or an ol. What
> if instead of producing a div, an implicit tag would create whatever
> makes sense? A span, an li, maybe a tr or td.
My idea is simple. This used to generate a div:
.foo
It would become <div class="foo">. But when we are in a UL element, for
example, DIV doesn't make sense (it's not allowed). The only allowed child
for UL is LI (list item). So:
%ul
.foo Item
This would become:
<ul><li class="foo">Item</li></ul>
I call it "smart implicit tag". Smart, because implicit tag can not always
be a DIV. In TABLEs, it's a TR. In a lot of elements that don't allow
children of type block (like DIV), it's a SPAN. For instance, a paragraph
doesn't allow DIV as child element, so the smart implicit tag inside a P
would be a SPAN.
Here is a test template from my branch where I implemented it:
http://github.com/mislav/haml/tree/html/test/haml/templates/implicit_tags.haml
You can see how this can save typing.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Haml" 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/haml?hl=en
-~----------~----~----~----~------~----~------~--~---