开发者

Symbols near HAML expressions

In HAML I often want to use a tag with punctuation following immediately after the tag. For example, I might want to put somet开发者_如何转开发hing in bold but have a closing bracket. The formatting would look like this: (Example sentence with bold text.)

Note that the 'bold text' is in bold but the period and closing bracket '.)' are not.

The obvious HAML is like this:

(Example sentence with
%span.important bold text
\.)

but this causes an extra space between 'bold text' and '.)'. Here's one way of doing it instead:

(Example sentence with
%span.important bold text
%span>\.)

Where enclosing the '.)' in a span with > makes the space disappear. However, this requires an unnecessary span.

Is there any way of getting the desired output, without the extra span?


That initial code snippet shouldn't work in HAML at all:

(Example sentence with
%b bold text
.)

The third line would result in an Illegal element: classes and ids must have values error. It should be:

(Example sentence with
%b bold text
\.)

However, that just fixes the code error. It still displays the way you're complaining about. I only know of two ways to address it:

  1. Just use inline HTML tags in your HAML file: (Example sentence with <b>bold text</b>.)
  2. Install maruku (or another markdown gem) and do the following:
:markdown  
  (Example sentence with **bold text**.)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜