如何在 HAML 中应用指向多行文本字符串的链接?

发布于 2024-12-21 04:52:38 字数 438 浏览 0 评论 0原文

我有一个像这样的多行块:

%li
  =link_to image_tag("image.jpg", :size => "48x48", :alt => "Something", :title => "Something", :class => "some-class"), some_path
  %p.testi
    "Some text right here that is divided up onto multiple lines & 
    %br
    and just won't stop running on!”

我需要一个链接来包围图像和文本。目前图像链接工作正常,但是在文本链接上,我相信我必须从 link_to 块开始,但我没有看到我应该遵循的语法。

如何正确完成此操作,以便所有多行文本也应用了链接?

I have a multiline chunk such as this:

%li
  =link_to image_tag("image.jpg", :size => "48x48", :alt => "Something", :title => "Something", :class => "some-class"), some_path
  %p.testi
    "Some text right here that is divided up onto multiple lines & 
    %br
    and just won't stop running on!”

I need a link to surround both the image and the text. Presently the image link works fine, however on the text link, I believe I have to start with a link_to block, but I'm not seeing the syntax that I should follow there.

How is this correctly done so that all of the multiple lines of text also have a link applied?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

李白 2024-12-28 04:52:38

在 slim 中(应该类似):

= link_to some_path, class: "some-class" do
    h2 = "#{some_object.title}"
    p.testi
      "Some text right here that is divided up onto multiple lines & 
    br/
    and just won't stop running on!”

In slim (wich should be similar):

= link_to some_path, class: "some-class" do
    h2 = "#{some_object.title}"
    p.testi
      "Some text right here that is divided up onto multiple lines & 
    br/
    and just won't stop running on!”
掩饰不了的爱 2024-12-28 04:52:38

参阅HAML 中的多行字符串

请 在您换行的每一行的末尾。

See Multiline string in HAML

You want to use the | at the end of each line you are wrapping.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文