将haml标签放在link_to帮助器中 [英] put haml tags inside link_to helper

查看:103
本文介绍了将haml标签放在link_to帮助器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在HAML中的link_to帮助器中添加html内容?

is it possible to add html-content inside a link_to helper in HAML?

我试过这个,但我得到的只是语法错误:

i tried this, but all i get is a syntax error:

= link_to "Other page", "path/to/page.html"
    %span.icon Arrow

预期产出:

<a href="path/to/page.html">Other Page<span class="icon">Arrow</span></a>


推荐答案

你应该使用块

= link_to "path/to/page.html" do
  Other page
  %span.icon Arrow

这篇关于将haml标签放在link_to帮助器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆