【发布时间】:2012-06-10 22:48:25
【问题描述】:
我正在尝试输出一些类似的东西
<p>Hello, this is my text. <a href="#">Link here</a> This is more text</p>
但使用 HAML
如何做到这一点?我一直在寻找示例,但没有一个示例显示如何做到这一点,而是在链接的任一侧使用纯文本?
尼尔
【问题讨论】:
标签: ruby-on-rails views haml
我正在尝试输出一些类似的东西
<p>Hello, this is my text. <a href="#">Link here</a> This is more text</p>
但使用 HAML
如何做到这一点?我一直在寻找示例,但没有一个示例显示如何做到这一点,而是在链接的任一侧使用纯文本?
尼尔
【问题讨论】:
标签: ruby-on-rails views haml
如果你想做一个 1 班轮:
%p= "Hello, this is my text. #{link_to 'Link here', '#'} This is more text".html_safe
多行
%p
Hello, this is my text.
= link_to 'Link here', '#'
This is more text
【讨论】:
你应该能够做到这一点:
%p Hello, this is my text. <a href="#">Link here</a> This is more text
这也可以:
%p
Hello, this is my test.
%a{:href => '#'} Link here
This is more text
【讨论】: