2011-09-27 45 views
13

如何在slim模板语言中编写以下内容?如何使用slim模板语言在段落中间放置超链接?

<p>Join the <a href="">Google group</a> and let us know what you think, or what other features you’d like to see.</p> 

我试过如下:

p 
    ' Join the 
    a href="" Google Group 
    ' and let us know what you think, or what other features you’d like to see 

但是由于单词“集团”和“和”没有他们之间的空白不起作用。

回答

21

显然,你可以报价后添加额外的空格:

p 
    ' Join the 
    a href="" Google Group 
    ' and let us know what you think, or what other features you’d like to see 
+1

这是正确的。报价后的空格成为您的左边距。您可以随意添加尽可能多的空间,只要您喜欢到行的开头。 – stonean

+6

这个语法让我想呕吐一点点。 – DickieBoy

6

你可以做

p This is a paragraph with a link #{link_to 'embedded', 'http://google.com'}. 

Rails的标签助手只是方法,这样你就可以应用逻辑里面的意见等方法。