在我的 Rails 模板中,我想使用 HAML 完成最终的 HTML:
I will first <a href="http://example.com">link somewhere</a>, then render this half of the sentence if a condition is met
接近的模板:
I will first
= link_to 'link somewhere', 'http://example.com'
- if @condition
, then render this half of the sentence if a condition is met
但是,您可能会注意到,这会在链接和逗号之间产生一个空格。有什么实用的方法可以避免这个空格吗?我知道有删除标签周围空格的语法,但是同样的语法可以应用于文本吗?我真的不喜欢额外标记的解决方案来实现这一点。