tags:

views:

51

answers:

2

I love using HAML for HTML documents. It has clean syntax that's much more attractive than ERB. It works perfectly for HTML documents.

What about for non-HTML? Such as, for example, an email or text document with certain automatically-substituted components? I've been falling back to ERB, but don't like the heavy syntax compared to HAML. Is there any way to use HAML for ordinary documents without having divs and html elements appear when % and . start a line?

Or is there some alternative to both HAML and ERB that I should investigate?

A: 

Probably not. Just escape your % and . with a backspace when they really need to start a line, or do some clever scripting to process those lines before passing them off to the HAML compiler.

Matchu
A: 

I don't think that makes sense.

The unique thing about HAML is that it uses a tree representation (using indentation) to represent the DOM tree. E-mails don't have a tree representation, therefore it doesn't make sense to use HAML or a HAML-like language for them.

Jörg W Mittag
I agree that lots of the HAML stuff doesn't make sense. But simple things like `-` and `=` and in-line interpolation with `#{}` are much nicer than ERB. I'm basically looking for ERB with the ERB syntax replaced by HAML syntax (though with none of HAML's other features).
Peter