这是我的Haml代码:
%html
%head
%body
%table {'width' => 638, 'border' => 0, 'cellpadding' => 0, 'cellspacing' => 0}
%tr
%td {'width' => 27, 'height' => 100}
%td {'width' => 582, 'height' => 100}
%td {'width' => 29, 'height' => 100}
Run Code Online (Sandbox Code Playgroud)
当我进入时haml example.haml example.html,我收到以下错误:
Syntax error on line 5: Illegal nesting: content can't be both given on the same line as %table and nested within it.
我做错了什么?
你需要删除标签和大括号之间的空格,如下所示:
%html
%head
%body
%table{'width' => 638, 'border' => 0, 'cellpadding' => 0, 'cellspacing' => 0}
%tr
%td{'width' => 27, 'height' => 100}
%td{'width' => 582, 'height' => 100}
%td{'width' => 29, 'height' => 100}
Run Code Online (Sandbox Code Playgroud)