Beginner Question - <% ... %>


#1

Regarding: <% (some code) %>

I have some suspicions/general ideas about what this contruct is
supposed to do, but can someone

a) tell me what it’s proper name is and
b) explain or point me to a resource which defines it in a formal way?

Thanks in advance,

Bihal


#2

On 4/27/06, Bihal removed_email_address@domain.invalid wrote:

Regarding: <% (some code) %>

I have some suspicions/general ideas about what this contruct is
supposed to do, but can someone

a) tell me what it’s proper name is and
b) explain or point me to a resource which defines it in a formal way?

Thanks in advance,

This (arbitrary, in a sense) syntax is used by ERb (Embedded Ruby), a
part of the Ruby standard library. The idea, basically, is to let you
run Ruby code inside of some other kind of document, be it HTML, plain
text, or even source code for another programming language, like
Javascript.
You can read the documentation here:
http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/index.html

The only name I’m aware of for <% %>, <%= %>, etc, is ‘ERb tag’.
If it has another name, I’m not aware of it.

Rails uses this system for its templates by default, but there are
other choices, including Markaby and Liquid.