HAML:在"link_to"后删除空格 [英] HAML: remove white space after "link_to"

查看:70
本文介绍了HAML:在"link_to"后删除空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码在HTML中留有空白:

The following code leaves a white space in HTML:

= link_to "Login", "#"

通常,HAML允许通过在行末添加>"来删除它,例如:

Normally, HAML allows to remove it by putting ">" at the end of the line, for example:

%input#query{:type => "text", :value => "Search"}>

但是,当插入Rails代码时,这似乎是不可能的.

However, that seems to be impossible, when Rails code is inserted.

我该如何解决?

推荐答案

如何?

%span>= link_to "Login", "#"

它在链接周围增加了一个额外的跨度,但这些无害.

It adds an extra span around the link, but those are pretty harmless.

我发现haml对于其中一些极端情况可能会有些问题:(

I find haml can have a bit of a problem with some of these corner cases :(

这篇关于HAML:在"link_to"后删除空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆