Ruby的ERB格式“正式”在哪里?定义的? [英] Where is Ruby's ERB format "officially" defined?

查看:490
本文介绍了Ruby的ERB格式“正式”在哪里?定义的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大量资料(例如erb是什么意思?以及来自此Google搜索)引用 http://ruby-doc.org/stdlib-1.8.7/libdoc/erb/rdoc/ERB .html 作为ERB格式的官方文档,但这实际上只是为您提供API而不是文件格式。

A number of sources (e.g. What is the meaning of erb? and three out of the top four results from this google search) cite http://ruby-doc.org/stdlib-1.8.7/libdoc/erb/rdoc/ERB.html as the official documentation on the ERB format, but that really just gives you the API rather than the file format.

我发现了一个不错的摘要在 http://docs.puppetlabs.com/guides/templating.html中#erb-template-syntax ,但还有一些更正式的东西,righ ?谁是定义权威?

I found a nice little summary in http://docs.puppetlabs.com/guides/templating.html#erb-template-syntax, but there's got to be something more official, right? And who is the "defining authority"? Did this come out of Rails?

由于有些人想知道问题背后的动机,因此我正在寻找有关ERB标签不能跨越多行的基本限制的文档,这又是由于最近看到多个SO问题导致OP显然没有意识到这一限制。

Since some folks like to know motivation behind questions, I'm looking for documentation on the rather basic constraint that ERB tags cannot span multiple lines, which in turn arose from seeing multiple SO questions recently where the OP's were apparently unaware of this constraint.

更新:鉴于日本的传统在@sawa的答案中,请允许我澄清一下,我对文档的最正式的英语版本感兴趣。

Update: Given the Japanese heritage cited in @sawa's answer, allow me to clarify that I'm interested in the most official "English" version of the documentation.

推荐答案

erb是由Masatoshi Seki开发的,它是eRuby的Ruby实现,因此其规范几乎遵循eRuby的规范。作者提及的一个不同之处是:

erb was developed by Masatoshi Seki as a Ruby implementation of eRuby, so its specification almost follows that of eRuby. One difference the author mentions is:

% cat hello.erb
Hello, <% print "World" %>.

% eruby hello.erb
Hello, World.

% erb hello.erb
WorldHello, .

在这种情况下,您可以这样做:

in which case you can do:

% cat hello2.erb
Hello, <%= "World" %>.

% eruby hello2.erb 
Hello, World.

% erb hello2.erb
Hello, World.

让它们以相同的方式工作。

to let them work the same way.

此处是作者对此的解释,而此处此处是作者编写的文档。

Here is an explanation about it by the author, and here and here are documentation written by the author.

这篇关于Ruby的ERB格式“正式”在哪里?定义的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆