gpt4 book ai didi

ruby-on-rails - rails : Tilde usage in HAML

转载 作者:行者123 更新时间:2023-12-03 18:17:57 40 4
gpt4 key购买 nike

我只是在 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>

关于ruby-on-rails - rails : Tilde usage in HAML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40887338/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com