Project

General

Profile

Actions

Feature #11936

closed

Allow ERB subclass to add token easily

Added by k0kubun (Takashi Kokubun) over 8 years ago. Updated over 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
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0