【问题标题】:scaml "illegal nesting" error骗局“非法嵌套”错误
【发布时间】:2011-05-07 02:06:01
【问题描述】:

嗨,我是 scalate/scaml 的菜鸟(我标记了 haml,因为 scml 和 haml 是相似的)。我有一些看起来像这样的模板:

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

%p 行被标记为以下错误:

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

【问题讨论】:

  • 当我从 %p 行中删除 "Contact:" 时,它会使它进一步......成为其他一些语法错误。但我不明白为什么我做错了。我希望 html 是

    Contact: xxxx

  • 将“Contact:”放入 %span 似乎是一种解决方法...

标签: scala haml scalate


【解决方案1】:

在 HAML 中,您不能在同一行和缩进同时提供内容。

因此,如果您编写 %p Contact:,则无法在 <p> 中添加任何其他内容。您必须将所有内容移动到下一个缩进级别:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-19
    • 1970-01-01
    • 2015-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多