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