If you’re using HAML and have a really long piece of code, you probably want to split it into multiple lines so it looks clean. Here’s how you do it.
Let’s say you have this code:
%h1.logo= real_account? && current_account.name ? current_account.name : AppConfig['app_name']
But you’d rather have:
%h1.logo= real_account? && current_account.name ?
current_account.name : AppConfig['app_name']All you need is to pipe them using |, like this:
%h1.logo= real_account? && current_account.name ? | current_account.name : AppConfig['app_name'] |
Notice how the last line also has a |. That is required.

{ 2 comments… read them below or add one }
Awesome – too bad TextMate gets all stupid on the syntax highlighting when you do this. Ditto when you drop into the :javascript tag.
@justin – yea, I know. Maybe we can get haml bundle maintainer to add support for this. Anyone know who that person is?