From c273243725e9aa38a9581ab0ac6f38380c6ff6b7 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Thu, 15 May 2008 18:34:35 -0700 Subject: [PATCH] Add a section on multiline to the FAQ. --- FAQ | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/FAQ b/FAQ index 9e06f92f..37700852 100644 --- a/FAQ +++ b/FAQ @@ -70,6 +70,27 @@ and renders

+=== How do I make my long lines of Ruby code look nicer in my Haml document? + +Put them in a helper or your model. + +Haml purposefully makes it annoying to put lots of Ruby code into your templates, +because lots of code doesn't belong in the view. +If you take that huge +link_to_remote+ call +and move it to a +update_sidebar_link+ helper, +it'll make your view both easier to read and more semantic. + +If you absolutely must put lots of code in your template, +Haml offers a somewhat awkward multiline-continuation tool. +Put a | (pipe character) at the end of each line you want to be merged into one +(including the last line!). +For example: + + %p= @this.is(way.too.much). | + code("and I should"). | + really_move.it.into( | + :a => @helper) | + === I have Haml installed. Why is Rails (only looking for .html.erb files | rendering Haml files as plain text | rendering Haml files as blank pages)? There are several reasons these things might be happening.