How could I escape a & in Haml so that it compiles to & instead of &? (Haml noob)

前端 未结 3 934
轻奢々
轻奢々 2020-12-20 04:09

I am trying to use the Icomoon icon font with Haml and can\'t seem to find a way to escape the & so that it stays just an & instead of

3条回答
  •  独厮守ぢ
    2020-12-20 04:53

    I didn't like the top poster's way of completing this question. So far the best way I've found is to do:

    - foo = "&".html_safe
    %a(href='/posts' data-icon=foo aria-hidden='true')
    

    I'm not fully happy with this, but think it's better for rails apps rather than turning off HTML escaping everywhere.

提交回复
热议问题