Rails:波浪号在 HAML 中的用法

Rails: Tilde usage in HAML

我刚刚以 HAML/Rails 形式偶然发现了这一行:

~ f.input :content, label: false

代字号有什么作用?

Whitespace Preservation: ~:

~ works just like =, except that it runs Haml::Helpers#find_and_preserve on its input. For example,

~ "Foo\n<pre>Bar\nBaz</pre>"

is the same as:

= find_and_preserve("Foo\n<pre>Bar\nBaz</pre>")

and is compiled to:

Foo <pre>Bar&#x000A;Baz</pre>