How to have blank lines in a .text.haml document?

John picture John · Feb 18, 2012 · Viewed 7k times · Source

I'm creating an email notification in a .text.haml document. How does one denote a blank line?

= @variable.name + " , you have a new update."
=
=
= "There has been new activity."

In the above example I would like the two lines that have just the HAML = on them to be blank lines but just having the = signs causes an error. What should I be doing?

Answer

Jon picture Jon · Mar 2, 2012

Blank lines in a .haml.text document can be created by placing a \ on a line by itself. An example in the form of an email:

Dear #{@user.name},
\
Use a backslash for blank lines in haml text templates.
\
Thanks!

However, HAML is designed for creating HTML documents, not plaintext ones. You really would be better off using erb or something else for this.