新手问题 用 Slim 如何将 link 嵌套在文本段落中?

evil850209 · February 01, 2013 · Last by blacktulip replied at February 01, 2013 · 2099 hits

想实现的 erb code 是这样的

<p>
Text1 <%=link_to "LINKA", "#" %> Text2 <%=link_to "LINKB", "#" %> Text3
</p>

现在我的做法是这样的

p
 | Text1 
 = link_to "LINKA", "#"
 | Text2  
 = link_to "LINKB", "#"
 | Text3

但总觉得怪怪的,请问大家有什么办法将这段代码写的更漂亮些。

此外也请大家讨论一下 Slim 和 Haml 的优缺点

hmm I only started looking Slim yesterday, I think you can do something like this

| Text1 #{ link_to 'LINKA', '#'} Text2 #{ link_to 'LINKB', '#' } Text3

However I have not tested it.

Slim renders faster than Haml, or so I was told.

You need to Sign in before reply, if you don't have an account, please Sign up first.