inline tag in haml

Matt Briggs picture Matt Briggs · Sep 24, 2010 · Viewed 23.2k times · Source

In html, you can do something like this

<p>
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eget 
  aliquet odio. Fusce id quam eu augue sollicitudin imperdiet eu ac eros. 
  <em>Etiam nec nisi lorem</em>, ac venenatis ipsum. In sollicitudin, 
  lectus eget varius tincidunt, felis sapien porta eros, non 
  pellentesque dui quam vitae tellus. 
</p>

It is nice, because the paragraph of text still looks like a paragraph in the markup. In haml, it looks like this

%p
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eget 
    aliquet odio. Fusce id quam eu augue sollicitudin imperdiet eu ac eros. 
    %em Etiam nec nisi lorem
    , ac venenatis ipsum. In sollicitudin, 
    lectus eget varius tincidunt, felis sapien porta eros, non 
    pellentesque dui quam vitae tellus. 

Is there any way to totally inline a tag in haml?

Answer

Andrew Vit picture Andrew Vit · Sep 24, 2010

Haml excels for structural markup, but it's not really intended for inline markup. Read: Haml Sucks for Content. Just put your inline tags as HTML:

.content
  %p
    Lorem ipsum <em>dolor</em> sit amet.

Or else use a filter:

.content
  :markdown
    Lorem ipsum *dolor* sit amet.