Pet*_*vin 13 ruby specifications ruby-on-rails erb
许多来源(例如erb的含义是什么?谷歌搜索的前四个结果中的三个)引用http://ruby-doc.org/stdlib-1.8.7/libdoc/erb/rdoc/ERB .html作为ERB格式的官方文档,但它实际上只是为您提供API而不是文件格式.
我在http://docs.puppetlabs.com/guides/templating.html#erb-template-syntax中找到了一个不错的小摘要,但是必须有更正式的东西,对吧?谁是"定义权威"?这是来自Rails吗?
由于一些人喜欢知道问题背后的动机,我正在寻找关于ERB标签不能跨越多条线的相当基本约束的文档,而这反过来又出现了最近看到多个SO问题,其中OP显然没有意识到这种约束.
更新:鉴于@ sawa的回答引用了日本传统,请允许我澄清一下我对文档的最官方"英文"版本感兴趣.
erb是由Masatoshi Seki开发的,是eRuby的Ruby实现,因此它的规范几乎遵循eRuby的规范.作者提到的一个区别是:
% cat hello.erb
Hello, <% print "World" %>.
% eruby hello.erb
Hello, World.
% erb hello.erb
WorldHello, .
Run Code Online (Sandbox Code Playgroud)
在这种情况下你可以这样做:
% cat hello2.erb
Hello, <%= "World" %>.
% eruby hello2.erb
Hello, World.
% erb hello2.erb
Hello, World.
Run Code Online (Sandbox Code Playgroud)
让他们以同样的方式工作.