开发者

HAML's way of removing the white space can be "%span><=", but not "><="?

I have used

%span><=

and it can eat up the white space between this line and the next, and also outside of the span tag, but it seems like an element needs to be used. 开发者_如何学编程 The form

><=

or

<=

or

>=

can't be used to eat the space. Or is there some ways to make them work?

some docs at:

http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#whitespace_removal__and_


You can avoid HAML and write the span tag directly, here is an example:

%p
  My paragraph text<span style="color:#5555FF">Span Text</span>

This way there won't be an empty character before the span text


Unfortunately, I believe the answer is "no." I've experimented with HAML quite a bit, trying to get it to do nice things with white space, but the > and < operators only work when placed directly after an element.

My (perhaps not so eloquent) way around this is to use :markdown, :maruku, or :textile filters and write the problematic content as one line of markdown code. This ends up being easier to read, which, in my opinion, is at least half the point of HAML.

That's probably more simplistic an answer than you were hoping for, but HAML seems best for structure, and falls down a bit for content. I could reference http://chriseppstein.github.com/blog/2010/02/08/haml-sucks-for-content/ but you've probably already read it :-)

Cheers!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜