-1

How write this ERB code in HAML:

<head>
  <meta charset="utf-8">
  <title><%= title %></title>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  <%== meta_data_tags %>
  <%= favicon_link_tag image_path('favicon.ico') %>
  <link rel="apple-touch-icon" href="apple-touch-icon.png">
  <link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-72x72.png">
  <link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon-114x114.png">
  <%= stylesheet_link_tag 'store/all', :media => 'screen' %>
  <%= csrf_meta_tags %>
  <%= javascript_include_tag 'store/all' %>
  <!--[if lt IE 9]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6/html5shiv.min.js"></script>
  <![endif]-->
  <%= render "spree/shared/routes" %>
  <%= yield :head %>
</head>

particularly interested in this

<%== meta_data_tags %>

code snippet.

Rustery
  • 125
  • 10

2 Answers2

2

I found answer for my question:

= raw(meta_data_tags)

<%== %> is the same as <%= raw() %>. It's just a fast helper to achieve same result.

Thank you all for help. =)

Rustery
  • 125
  • 10
1

In Erubis (whch Rails uses) the <%== ... %> syntax escapes the result of the expression. Haml has a similar feature using &=.

So a Haml version of <%== meta_data_tags %> might look something like:

&= meta_data_tags
matt
  • 78,533
  • 8
  • 163
  • 197
  • Yes, it is an option. But it will display html as a string. I answered my question below. Thank you! – Rustery Oct 21 '13 at 19:50