该行比前一行缩进了 2 级。哈姆雷
=image_tag('/images/public_stream_page/overlay_image.png',
:onload=>"document.getElementById('dd_mid_right_box_public').style.background='url(#{stream.asset.url(:normal)})';")
这是我用来显示图像的 haml 代码
所以我收到此错误
The line was indented 2 levels deeper than the previous line.
如何解决?
=image_tag('/images/public_stream_page/overlay_image.png',
:onload=>"document.getElementById('dd_mid_right_box_public').style.background='url(#{stream.asset.url(:normal)})';")
This is my haml code to display an image
so am getting this error
The line was indented 2 levels deeper than the previous line.
How to resolve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能不是OP问题的直接答案,但我遇到了这个错误,因为我的HAML的前几行仅缩进一个空格,然后它遇到了使用两个空格缩进的文档部分。显然,HAML 处理器使用前几行来计算缩进中有多少空格,然后在整个过程中强制执行。
Probably not the direct answer to OP's question, but I ran into this error because the first few lines of my HAML were only indented by one space, and then it ran into a section of the document that was indented using two spaces. Apparently the HAML processor uses the first couple of lines to figure out how many spaces are in an indent, and then it enforces that throughout.
对于与空格缩进相关的问题,您没有以正确的方式显示代码......
行号也会有所帮助。
您应该有这样的内容:
第二行缩进的间距与您在模板的其余部分中使用的间距相同,而也许您有一行(错误中的数字未显示)缩进了 2 倍。
You're not displaying the code in a correct way for a problem that relates to space indentation...
Also line numbers would help.
You should have something like this:
With the second line indented with the same number of spacing you use in the rest of your templeate, while perhaps you have one line (number in the error not shown) 2 times more indented.