相关疑难解决方法(0)

Haml:控制文本周围的空白

在我的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
Run Code Online (Sandbox Code Playgroud)

接近的模板:

I will first
= link_to 'link somewhere', 'http://example.com'
- if @condition
  , then render this half of the sentence if a condition is met
Run Code Online (Sandbox Code Playgroud)

但是,您可能会注意到这会在链接和逗号之间产生一个空格.有没有实用的方法来避免这个空白?我知道有删除标签周围空格的语法,但这种语法是否只能应用于文本?我真的不喜欢额外标记的解决方案来实现这一目标.

haml ruby-on-rails

96
推荐指数
6
解决办法
4万
查看次数

标签 统计

haml ×1

ruby-on-rails ×1