Haml has a feature called “Whitespace Preservation” which usually tries to nicely indent your markup. This is great.
However, sometimes it gets in your way – especially when it indents your
<pre> paragraphs wrong.
I had a setup like
%p Here, some code! = render_some_code
#render_some_code would return some markup.
def render_some_code "include 'cells'ninclude 'apotomo' /pre>" end
[The missing < before /pre is intentional as it breaks this writing, haha.]
I expected the render output to be ...nice.Here, some code! include 'cells' include 'apotomo'
Nevertheless, it turned out to be even nicer. Haml's nice indentation striked.Here, some code! include 'cells' include 'apotomo'
Haml::Helpers#find_and_preserve, it works like a charm now. I don't know why, neither how, but it works.include Haml::Helpers def render_some_code find_and_preserve "include 'cells'ninclude 'apotomo' /pre>" end