如何在 .text.haml 文档中包含空行?

发布于 2025-01-07 02:43:32 字数 252 浏览 1 评论 0原文

我正在 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一桥轻雨一伞开 2025-01-14 02:43:32

.haml.text 文档中的空行可以通过将 \ 单独放置在一行上来创建。电子邮件形式的示例:

Dear #{@user.name},
\
Use a backslash for blank lines in haml text templates.
\
Thanks!

但是,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:

Dear #{@user.name},
\
Use a backslash for blank lines in haml text templates.
\
Thanks!

However, HAML is designed for creating HTML documents, not plaintext ones. You really would be better off using erb or something else for this.

旧时浪漫 2025-01-14 02:43:32

它看起来是这样的(检查两行中的空格):

== #{@variable.name} , you have a new update.
:preserve


There has been new activity.

但是 HAML 并不是真正为这种用途而设计的。

Here's how it would look like (check the whitespace in the two lines):

== #{@variable.name} , you have a new update.
:preserve


There has been new activity.

But HAML isn't really made for this kind of usage.

≈。彩虹 2025-01-14 02:43:32

我相信你可以做到这一点:

= "... a new update.\n\n"

\n 表示换行。我面前没有 HAML 来测试它。

如果它正在制作 HTML,您也可以只添加:

%br
%br

To make HTML newlines。

I believe you can do this:

= "... a new update.\n\n"

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:

%br
%br

To make HTML new lines.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文