Project

General

Profile

Actions

Feature #11936

closed

Allow ERB subclass to add token easily

Added by k0kubun (Takashi Kokubun) about 8 years ago. Updated about 8 years ago.

Status:
Closed
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

Updated by k0kubun (Takashi Kokubun) about 8 years ago

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

Actions #2

Updated by k0kubun (Takashi Kokubun) about 8 years ago

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

Updated by seki (Masatoshi Seki) about 8 years ago

  • Status changed from Open to Closed

Applied in changeset r53412.


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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0