如何将此 haml 代码转换为 erb?
How do I convert this haml code to erb?
需要将此 HAML 代码转换为 ERB。使用 HamltoErb 转换器时出现错误。任何帮助将不胜感激。
%header.main{:class => @full_header ? 'full' : 'basic'}
.inner
/ Primary navigation
%nav.main
%ul
%li= link_to "Home", root_path, :nav_item => :home
%li
= link_to "Our catalogue", catalogue_path, :nav_item => :catalogue, :class => 'noborder'
%ul
- for category in Shoppe::ProductCategory.ordered
%li= link_to category.name, products_path(category.permalink)
%li= link_to "Why shop with us?", page_path(:why), :nav_item => :why
%li= link_to "FAQs", page_path(:faqs), :nav_item => :faqs
%li= link_to "Get in touch", page_path(:contact), :nav_item => :contact
%h1= link_to Shoppe.settings.store_name, root_path
- if @full_header
%h2 Welcome to our <em>shoppe</em>.
%p.intro Check out our lovely products on this page and then you can buy them through the website with just a few clicks using our supremely simple ordering system.
- if @full_header
.bar
.inner
%p.call Call us today on <b>01202 901 101</b> if you have any questions.
%p.offer <b>This week only!</b> FREE next day shipping on all orders over £30.
首先google搜索转换器:https://haml2erb.org/
转换returns错误:
(line 1, column 37):
unexpected "?"
expecting space, "(" or "["
意思是他不理解 ?
在那种情况下。第一个猜测是将第一行更改为:
%header.main{:class => (@full_header ? 'full' : 'basic')}
Ohmygoditworks.
在此处发布之前,请尝试投入一些精力
需要将此 HAML 代码转换为 ERB。使用 HamltoErb 转换器时出现错误。任何帮助将不胜感激。
%header.main{:class => @full_header ? 'full' : 'basic'}
.inner
/ Primary navigation
%nav.main
%ul
%li= link_to "Home", root_path, :nav_item => :home
%li
= link_to "Our catalogue", catalogue_path, :nav_item => :catalogue, :class => 'noborder'
%ul
- for category in Shoppe::ProductCategory.ordered
%li= link_to category.name, products_path(category.permalink)
%li= link_to "Why shop with us?", page_path(:why), :nav_item => :why
%li= link_to "FAQs", page_path(:faqs), :nav_item => :faqs
%li= link_to "Get in touch", page_path(:contact), :nav_item => :contact
%h1= link_to Shoppe.settings.store_name, root_path
- if @full_header
%h2 Welcome to our <em>shoppe</em>.
%p.intro Check out our lovely products on this page and then you can buy them through the website with just a few clicks using our supremely simple ordering system.
- if @full_header
.bar
.inner
%p.call Call us today on <b>01202 901 101</b> if you have any questions.
%p.offer <b>This week only!</b> FREE next day shipping on all orders over £30.
首先google搜索转换器:https://haml2erb.org/
转换returns错误:
(line 1, column 37):
unexpected "?"
expecting space, "(" or "["
意思是他不理解 ?
在那种情况下。第一个猜测是将第一行更改为:
%header.main{:class => (@full_header ? 'full' : 'basic')}
Ohmygoditworks.
在此处发布之前,请尝试投入一些精力