小编Roo*_* V.的帖子

如何在rails上的.yml本地化文件中打破行?

我有一个带有一些本地化的terms.en.yml文件,例如:

en:
  devise:
    registrations:
      terms:
        text: 'This agreement was written in English (US). To the extent any translated version of this agreement conflicts with the English version, the English version controls.  Please note that Section 16 contains certain changes to the general terms for users outside the United States.\n\ Some new line'
Run Code Online (Sandbox Code Playgroud)

我怎么能在那里打破一条线或创建一个段落?

这里有一些信息,但它对我没有帮助,我做错了什么.http://yaml.org/spec/1.1/#b-paragraph-separator

yaml localization ruby-on-rails

26
推荐指数
3
解决办法
2万
查看次数

一种缩小或丑化ES6模板字符串的方法

就像是

var tpl = `
<div> 
   template
   <span>string</span>
</div>
`
Run Code Online (Sandbox Code Playgroud)

会产生:

var tpl = "\n<div> \n  template\n  <span>string</span>\n</div>\n";
Run Code Online (Sandbox Code Playgroud)

我需要的是摆脱额外的空间和可能的换行符,就像所有其他html缩小工具一样.

所以它应该变得类似于:

"<div>template<span>string</span></div>"
Run Code Online (Sandbox Code Playgroud)

有没有什么方法能够明智地实现这一目标并且坚不可摧?

javascript ecmascript-6 template-strings

5
推荐指数
1
解决办法
2230
查看次数