Project

General

Profile

Feature #11936

Allow ERB subclass to add token easily

Added by k0kubun (Takashi Kokubun) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:72647]

Description

While I want to use ERB in Rails, escape token "<%==" is not available in ERB and we can't add a new token to ERB easily.
To allow ERB subclass to add a new token easily, I splitted ERB::Compiler#compile to some small methods and created ERB::Compiler::Scanner#stags and ERB::Compiler::Scanner#etags.

With this patch, we'll be able to add a new stag or etag by overriding these methods.
sample.rb is a sample to create ERB subclass with "<%==" token.


Files

sample.rb (882 Bytes) sample.rb Sample code to add a new token k0kubun (Takashi Kokubun), 01/01/2016 06:34 AM
0001-Allow-ERB-subclass-to-add-token-easily.patch (8.98 KB) 0001-Allow-ERB-subclass-to-add-token-easily.patch k0kubun (Takashi Kokubun), 01/01/2016 11:04 AM

Associated revisions

Revision 32b4a8b3
Added by seki (Masatoshi Seki) almost 4 years ago

Allow ERB subclass to add token easily. [Feature #11936]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 53412
Added by seki (Masatoshi Seki) almost 4 years ago

Allow ERB subclass to add token easily. [Feature #11936]

Revision 53412
Added by seki (Masatoshi Seki) almost 4 years ago

Allow ERB subclass to add token easily. [Feature #11936]

Revision 53412
Added by seki (Masatoshi Seki) almost 4 years ago

Allow ERB subclass to add token easily. [Feature #11936]

Revision 53412
Added by seki (Masatoshi Seki) almost 4 years ago

Allow ERB subclass to add token easily. [Feature #11936]

History

Updated by k0kubun (Takashi Kokubun) almost 4 years ago

I fixed a patch to reduce times to compile the same regexp in TrimScanner.

#2

Updated by k0kubun (Takashi Kokubun) almost 4 years ago

  • File deleted (0001-Allow-ERB-subclass-to-add-token-easily.patch)
#3

Updated by seki (Masatoshi Seki) almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset r53412.


Allow ERB subclass to add token easily. [Feature #11936]

Also available in: Atom PDF