public
Rubygem
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/nex3/haml.git
Search Repo:
Add a section on multiline to the FAQ.
nex3 (author)
Thu May 15 18:34:35 -0700 2008
commit  c273243725e9aa38a9581ab0ac6f38380c6ff6b7
tree    65f4a3426d2003c233c1921be1ddf8ee939a35fe
parent  6fc675ef4e5193cccb117999fb13436f86c7ec77
0
FAQ
...
70
71
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
74
75
...
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
0
@@ -70,6 +70,27 @@
0
 
0
   <p><textarea>Foo&#x000A;Bar</textarea></p>
0
 
0
+=== How do I make my long lines of Ruby code look nicer in my Haml document?
0
+
0
+Put them in a helper or your model.
0
+
0
+Haml purposefully makes it annoying to put lots of Ruby code into your templates,
0
+because lots of code doesn't belong in the view.
0
+If you take that huge +link_to_remote+ call
0
+and move it to a +update_sidebar_link+ helper,
0
+it'll make your view both easier to read and more semantic.
0
+
0
+If you absolutely must put lots of code in your template,
0
+Haml offers a somewhat awkward multiline-continuation tool.
0
+Put a <tt>|</tt> (pipe character) at the end of each line you want to be merged into one
0
+(including the last line!).
0
+For example:
0
+
0
+ %p= @this.is(way.too.much). |
0
+ code("and I should"). |
0
+ really_move.it.into( |
0
+ :a => @helper) |
0
+
0
 === I have Haml installed. Why is Rails (only looking for <tt>.html.erb</tt> files | rendering Haml files as plain text | rendering Haml files as blank pages)?
0
 
0
 There are several reasons these things might be happening.

Comments

    No one has commented yet.