views:

307

answers:

1

I read the Haml docs where they talk about the pre tag and "preserving whitespace". According to the docs, pre "preserves whitespace" by default and you need to use the ~ operator to output the contents of the tag to get it to render correctly. Following the recommended practice, I have this:

%pre
  ~ @calendar.main_template

The output in the browser:

(This may be a little confusing -- the app is letting the user manipulate Haml code, so I'm actually displaying Haml code here in the UI.)

%div
                = events

What output want:

%div
  = events

I also tried using = instead of ~. Also tried %pre>, %pre<, and %pre>< all with identical results.

+4  A: 

You want preserve.

%pre
  = preserve "I like\n  Cheese"
Squeegy