Question

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.

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?

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.

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top