【发布时间】:2018-02-09 11:12:33
【问题描述】:
我有这个 HAML 代码:
%p
This page is for our staff. If you came here by mistake,
%a(href="index.html") you can go back
\.
孤立的\. 存在是因为我不希望句号 (.) 成为链接的一部分。
这几乎可以工作,但back 和. 之间有一个空格;自然地,HAML 是在 HTML 渲染文件的 HAML 源代码中插入换行符。
换句话说,这是生成的 HTML:
<p>
This page is for our staff. If you came here by mistake,
<a href="index.html">you can go back</a>
. <!-- I want the period to be on the previous line -->
</p>
因为<p> 标签内的单词是用空格隔开的,所以back 和. 之间有一个空格。如何删除这个空间?
我找到了一种方法来做到这一点,但它很难看(或者我不会问这个问题):
%p
This page is for our staff. If you came here by mistake,
%a(href="index.html") you can go back
%span>\.
有没有更好的方法来做到这一点?
【问题讨论】: