HAML Help: Blending Text and Other HTML Tags

I am converting my ERB template to a HAML template.

<p> Welcome to <span><%= name1 %> </span>, <span> <%= name2 %></span> and <span><%= name3 %></span>. </p> 

Here is what I came up with

 %p Welcome to %span= name1 , %span= name2 and %span= name3 . 

I have a feeling that there is a much more elegant way to do this.

+7
ruby-on-rails haml
source share
1 answer

There is no reason why you should not use the embedded HTML tags in your Haml document. See this post for an explanation of why Haml is not suitable for inline markup.

 <p> Welcome to <span>#{name1}</span>, <span>#{name2}</span> and <span>#{name3}</span>. </p> 
+14
source share

All Articles