Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

inline tag in haml

Tags:

haml

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?

like image 918
Matt Briggs Avatar asked Sep 24 '10 03:09

Matt Briggs


People also ask

How do I add a script tag to Haml?

There are mainly two ways to include JavaScript in HTML: Internal/Inline: By using “script” element in the “head” or “body” section. External: By using an external JavaScript file.

How to comment in Haml?

Haml Comments: -#The hyphen followed immediately by the pound sign signifies a silent comment. Any text following this isn't rendered in the resulting document at all.

What is in Haml?

Haml is a markup language predominantly used with Ruby that cleanly and simply describes the HTML of any web document without the use of inline code. It is a popular alternative to using Rails templating language (. erb) and allows you to embed Ruby code into your markup.


1 Answers

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. 
like image 116
Andrew Vit Avatar answered Oct 05 '22 15:10

Andrew Vit