I seem to be having a problem with haml. Rails is rendering:
%span
stuff
#div_name
moar stuff
as
<span>stuff</span>
<div id='div_n开发者_如何学编程ame'></div>
moar stuff
any ideas? why isn't 'moar stuff' inside the span?
Works fine for me:
$ echo '%span\n stuff\n #div_name\n moar stuff' | haml
<span>
stuff
<div id='div_name'></div>
moar stuff
</span>
Try this:
%span
stuff
#div_name
moar stuff
The span only contains stuff
, so you have to undent after stuff
, so that other elements are not contained in the span.
You can also write it like this:
%span stuff
#div_name
moar stuff
Which gives exactly this:
<span>stuff</span>
<div id='div_name'></div>
moar stuff
精彩评论