如何在 .text.haml 文档中包含空行?
我正在 .text.haml
文档中创建电子邮件通知。如何表示一个空行?
= @variable.name + " , you have a new update."
=
=
= "There has been new activity."
在上面的示例中,我希望仅包含 HAML =
的两行为空行,但仅包含 =
符号会导致错误。我应该做什么?
I'm creating an email notification in a .text.haml
document. How does one denote a blank line?
= @variable.name + " , you have a new update."
=
=
= "There has been new activity."
In the above example I would like the two lines that have just the HAML =
on them to be blank lines but just having the =
signs causes an error. What should I be doing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
.haml.text 文档中的空行可以通过将 \ 单独放置在一行上来创建。电子邮件形式的示例:
但是,HAML 设计用于创建 HTML 文档,而不是纯文本文档。为此,您最好使用 erb 或其他东西。
Blank lines in a .haml.text document can be created by placing a \ on a line by itself. An example in the form of an email:
However, HAML is designed for creating HTML documents, not plaintext ones. You really would be better off using
erb
or something else for this.它看起来是这样的(检查两行中的空格):
但是 HAML 并不是真正为这种用途而设计的。
Here's how it would look like (check the whitespace in the two lines):
But HAML isn't really made for this kind of usage.
我相信你可以做到这一点:
\n
表示换行。我面前没有 HAML 来测试它。如果它正在制作 HTML,您也可以只添加:
To make HTML newlines。
I believe you can do this:
The
\n
means a new line. I don't have HAML before me to test it out.If it's making HTML, you can also just add:
To make HTML new lines.