+1 for * in Magic HAML, or MAML or whatever. Think * would be best as
it most closely mirrors CSS.
Also think Magic HAML would be best suited to being an additional
plugin to the main core.
The idea of context sensitive implicit tags does have a good use case
for core though. That case is DIV and SPAN, these are both in the same
"family" of elements in HTML, with one being block and the other being
inline. In the case where HAML sees
%li
%a
Hello
.greeting Bob
it will currently generate
<div class="greeting">Bob</div>
for the implicit tag, though DIV is not valid within the context of an
anchor tag. In this case I believe HAML should instead generate a
<span class="greeting">Bob</span>
as this valid and SPAN holds a similar purpose to DIV. At the moment
it is not surprising that you'd need to change it to
%span.greeting Bob
but I think it would help if HAML was at least context sensitive to
the degree of knowing when it should generate a DIV and when to
generate a SPAN.
Do those ramblings make sense to anyone?
Geoff
On Mar 9, 10:00 am, Tom Stuart <[EMAIL PROTECTED]> wrote:
> On 8 Mar 2008, at 19:08, Nate Vack wrote:
>
> > What should happen here? It looks like maybe the code should generate
> > <li class="bar"> and <div class="bar"> -- that would be...
> > surprising... to me, as a developer. Right now with haml, I *know*
> > what's gonna happen when I write '.bar'.
>
> As Irfan Adilovic already pointed out, if you want a <div>, you can
> write %div. In some circumstances it would be monumentally useful to
> have a context-aware partial that generated the appropriate tag at the
> top level -- for rendering a representation of a particular model, for
> example, regardless of whether the partial was rendered directly into
> the <body>, into a <p>, or into a <ul>.
>
> This behaviour shouldn't be "surprising" if you haven't specified
> which tag to output. In many ways it's the least surprising behaviour:
> "I haven't given a tag name here, so do whatever is best". Only
> familiarity with the meaning of Haml's current syntax would lead you
> to expect a <div> where none was specified; if the syntax changed,
> future developers wouldn't have the same expectation.
>
> Cheers,
> -Tom
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---