Question

In my Jekyll blog I use the include tag to put the contents of a file into the document. However if I attempt to do this with a HAML based document the indentation of the included text is wrong. :preserve does not work because it requires indentation. Is there a way to specify a block of text without depending on indentation?

%html
  %body
    - preserve do
<strong>included text from file</strong>
    - end
Was it helpful?

Solution

It seems that in current version of Haml :text filter was removed. Now you can use :plain filter. No processing is performed for the text inside this block. You can paste multiline blocks of text or HTML code there. HTML will appear on the page unescaped.

:plain
  Some text <b>or HTML</b>.

OTHER TIPS

For text, use filters:

:text
  some text
:erb
  <%= render :partial ... %>

http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#filters

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top