It's actually important in some cases that "-#" is treated as an actual 
line of Haml, rather than just removed: it allows multiple consecutive 
multiline blocks. In any case, I feel that, stylistically speaking, it's 
important to keep with the structure of the document, even when commenting.

This also goes for

  - if
  -# comment
  - else


If you don't nest code within the "if", Haml has no idea that you want 
it to add an "end" afterwards. Haml doesn't attempt to parse Ruby except 
the minimal amount that's necessary to know that it shouldn't add an 
"end" before "else and friends. Thus, unless you nest code within "if", 
Haml doesn't know it's any different than (say) "- foo = 12".

So, in short, just keep your indentation sane ;-).

- Nathan

neem wrote:
> Thank you for the explanation!
>
> In my opinion, to improve the haml comments should be possible at any
> place, anyway they are removed.
> When interpretator sees -#, it should remove the line. Probably, I am
> mistaking and can't see the problems, that could appear in this case.
>
> Another problem. When I put the code like this:
> - if
> -# comment
> - else
> there is a translation into
> if
> end
> # comment
> else (but why I don't receive a notification about error?, can it
> happen that block of code begins with "else" without "if" before?)
>
> thank you,
> Evgeny
>
>   
>> You'd have to write that as:
>>
>> -if
>>    -# comment
>> -else
>>
>> When you put it in the first column you're explicitly telling Haml
>> that you want to end the previously nested scope(s). When you format
>> Haml source code you can't align it so that it looks nice to your eye,
>> you have to align it so that the whitespace dictates the desired
>> semantics.
>>
>> Cheers,
>> Wincent
>>     
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to