Ruby on rails en.yml中的新行不会在html页面上呈现

Ruby on rails en.yml中的新行不会在html页面上呈现,ruby-on-rails,ruby,ruby-on-rails-5,haml,Ruby On Rails,Ruby,Ruby On Rails 5,Haml,在en.yml中,我有带新行的字符串。当它们呈现在html页面上时,新行将消失——它呈现为一行 我的英语: test: |+ Something fdsafdsfd fdsafdsfd YAML为该测试键返回一个带\n的字符串。如果您想在html中显示它,您需要将新行转换为正确的html标记。您可以使用helper进行以下操作: simple_format("foo\nbar") # => "<p>foo\n<br />bar</p>" s

在en.yml中,我有带新行的字符串。当它们呈现在html页面上时,新行将消失——它呈现为一行

我的英语:

test: |+
  Something fdsafdsfd


  fdsafdsfd

YAML为该测试键返回一个带\n的字符串。如果您想在html中显示它,您需要将新行转换为正确的html标记。您可以使用helper进行以下操作:

simple_format("foo\nbar") # => "<p>foo\n<br />bar</p>"
simple_format("foo\n\nbar") # => "<p>foo</p>\n\n<p>bar</p>"