scaml “illegal nesting” error

隐身守侯 提交于 2019-12-24 00:30:04

问题


Hi I'm a total Noob at scalate/scaml (I tagged haml since scaml & haml are similar). I have some template that looks like this:

-@ var customer : com.x.model.Customer
!!!
%html
    %body
        %p Contact:
            %a{:href => 'mailto:#{customer.email}'}=customer.contact

The %p line is flagged with this error:

org.fusesource.scalate.InvalidSyntaxException: Illegal nesting: content can't be given on the same line as html element or nested within it if the tag is closed at 16.17

回答1:


In HAML, you can't provide content both on the same line and indented.

So, if you write %p Contact:, you can't add anything else to the <p>. You have to move everything to the next indentation level:

    %p
      Contact:
      %a{:href => 'mailto:#{customer.email}'}=customer.contact


来源:https://stackoverflow.com/questions/5918684/scaml-illegal-nesting-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!