I like Haml because it makes my generated HTML look pretty. But here's
something that would make my HTML even easier to read: tag close
commenting. Basically, it would be an html comment after the end tag
of a block-level element which would indicate to me, the guy reading
the HTML, which tag was being closed. This is currently indicated by
the indent level, which is great, except when you have a complex
layout and your element open and close tags are 50 lines apart -- it
starts to become hard to visually line up the indenting.
With tag close commenting, Haml could display the tag type, plus some
or all of the tag attributes, in an HTML comment beside the closing
tag, like this:
#thingie.widget how come?
#what.why because I said so.
Would render to:
<div id='thingie' class='widget>how come?
<div id='what' class='why'>because I said so. </div>
</div><!-- end of %div#thingie.widget -->
No comment is needed on an opened-and-closed-on-the-same-line tag, of
course.
And again, to get an idea of the point of a feature like this, you
need to apply it to a larger example. Here's some rendered HAML with
tag close commenting added in:
<div class='what'>
<div class='rate' id='rate_button_1' onclick="toggle_thingie('1')">
<div class='rate_pane' id='thing_1'>
<div id='rate_number'>0</div>
<div id='rate_container'>
<div class="rate_things trans_inactive" id="rate_5"> </
div>
<div class="rate_things trans_inactive" id="rate_4"> </
div>
<div class="rate_things trans_inactive" id="rate_3"> </
div>
<div class="rate_things trans_inactive" id="rate_2"> </
div>
<div class="rate_things trans_inactive" id="rate_1"> </
div>
</div><!-- end of %div#rate_container -->
<div class='rate_pane_bonus'>select an option!!</div>
</div><!-- end of %div#thing_1.rate_pane -->
</div><!-- end of %div#rate_button_1.rate
<div class='number'><a href="/posts/1850">Post #1850</a></div>
</div><!-- end of %div.what-->
Also, this wouldn't really need a Haml syntax addition, it could be as
simple as toggling a config value.
What do you guys think?
Mike
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---