在 haml 中插入文本块
在我的 Jekyll 博客中,我使用 include 标签将文件的内容放入文档中。但是,如果我尝试使用基于 HAML 的文档执行此操作,则所包含文本的缩进是错误的。 :preserve
不起作用,因为它需要缩进。有没有一种方法可以在不依赖缩进的情况下指定文本块?
%html
%body
- preserve do
<strong>included text from file</strong>
- end
In my Jekyll blog I use the include tag to put the contents of a file into the document. However if I attempt to do this with a HAML based document the indentation of the included text is wrong. :preserve
does not work because it requires indentation. Is there a way to specify a block of text without depending on indentation?
%html
%body
- preserve do
<strong>included text from file</strong>
- end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来当前版本的 Haml
:text
过滤器已被删除。现在您可以使用:plain
过滤器。不会对该块内的文本执行任何处理。您可以在此处粘贴多行文本块或 HTML 代码。 HTML 将在未转义的页面上显示。It seems that in current version of Haml
:text
filter was removed. Now you can use:plain
filter. No processing is performed for the text inside this block. You can paste multiline blocks of text or HTML code there. HTML will appear on the page unescaped.对于文本,请使用过滤器:
http://haml-lang.com/文档/yardoc/file.HAML_REFERENCE.html#filters
For text, use filters:
http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#filters