[web-devel] Re: Hamlet & Haml

Michael Snoyman michael at snoyman.com
Thu Apr 22 11:55:50 EDT 2010


On Wed, Apr 21, 2010 at 4:01 PM, James Britt <james at neurogami.com> wrote:

> Michael Snoyman wrote:
>
>
>>
>> I'm sorry, I'm not familiar enough with the indentation rules you're
>> referring to; could you explain it more throughly? This might be a case
>> where I accidentally solved a problem ;).
>>
>
> Haml expects that where there is to be indentation, that indentation is to
> be exactly 2 spaces.  Not 1, not 3, or 4, but 2.  It isn't enough that a
> line start in a new column further to the right, it has to start in a very
> specific column relative to its parent.
>
> However, there are cases where the content is such that I want to emphasize
> it or offset it in some way using whitespace.
>
> My experience has been that this isn't allowed.
>
>
> Oh, I'm certainly glad I strayed from the Haml specs then! Hamlet allows
arbitrary indentation. In fact, some might argue that the indentation rules
are *too* lax, but we'll let experience be the deciding factor on that.

Basically, here's the rules:

* a tab is 4 spaces. I considering not allowing tabs at all, but hopefully
people know not to mix spaces and tabs already.
* each line has its indentation level calculated
* a line is nested within the first line above it with a lower indentation
level

I actually think that sums things up completely. I have just added a page[1]
on the documentation site to explain these rules, thank you for pointing out
that it was lacking.

Michael

[1] http://docs.yesodweb.com/hamlet/indentation.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/web-devel/attachments/20100422/03a1b9a1/attachment.html


More information about the web-devel mailing list