我正在尝试格式化一个简单的句子,如下所示:
当我的 haml 看起来像这样时:
%a{:href => "link", :target=> '_blank'} x,
%a{:href => "link", :target=> '_blank'} y,
and
%a{:href => "link", :target=> '_blank'} z.
我明白了
当我的 haml 看起来有点不同时::
%a{:href => "link", :target=> '_blank'} x
,
%a{:href => "link", :target=> '_blank'} y
, and
%a{:href => "link", :target=> '_blank'} z
.
我明白了
...而且空格看起来不对。
如何让它看起来像我想要的样子?
我希望它看起来像
...逗号和句号不是链接,也没有奇怪的额外空格。
最佳答案
试试这个,我希望这会有所帮助
= link_to "x", "Your-url", target: "_blank"
,
= link_to "y", "Your-url", target: "_blank"
= "and"
= link_to "z", "Your-url", target: "_blank"
关于ruby - 如何摆脱 Haml & Ruby 渲染的 html 中的多余空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30589495/