开发者

Using HAML elements inside a block of text

开发者 https://www.devze.com 2022-12-13 23:33 出处:网络
I often want some html like this: (<span id=\"items_shown\">all</span> items shown) which I end up getting by using haml like this:

I often want some html like this:

(<span id="items_shown">all</span> items shown)

which I end up getting by using haml like this:

%span><
  (
%span#items_shown><
  all
%span
  items shown)

Note that I end up having to create extra spans, and then having to control for the whitespace around those spans, in order to get the exact syntax that I want, without extra spaces between the first ( and the all.

So here's the question. What's the best way of having the exact html above, to display (all items shown) with all in a span? Is there something mo开发者_JS百科re elegant than my haml?


Check out the FAQ to this effect. The short answer is that Haml's not optimized for inline markup, and there's no shame in just using HTML if you need to.

0

精彩评论

暂无评论...
验证码 换一张
取 消