summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-23 17:44:50 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-23 17:44:50 +0000
commitc3e9fe6a3a4a1ab3fdb6d2e5629a329cbdf7fc47 (patch)
treeb50070c2b88d1ee7f6400bb531701c418828ebd9
parentf9593a4fc4a68f0a48d6182c5183b701eb583776 (diff)
merge revision(s) 21432:
* lib/erb.rb (PercentScanner): remove PercentScanner. fixed % after %> bug. [ruby-dev:37751] [Bug #997] * test/erb/test_erb.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@22583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--lib/erb.rb34
-rw-r--r--test/erb/test_erb.rb4
-rw-r--r--version.h2
4 files changed, 12 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index e33b6d2..a2529c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Feb 24 02:44:39 2009 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb (PercentScanner): remove PercentScanner. fixed % after
+ %> bug. [ruby-dev:37751] [Bug #997]
+
+ * test/erb/test_erb.rb: ditto
+
Tue Feb 24 02:35:29 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* hash.c (rb_hash_s_create): set nil as the value if assoc length
diff --git a/lib/erb.rb b/lib/erb.rb
index f1661f9..1ed3c60 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -426,40 +426,6 @@ class ERB
end
Scanner.regist_scanner(SimpleScanner2, nil, false)
- class PercentScanner < Scanner # :nodoc:
- def scan(&blk)
- stag_reg = /(.*?)(^%%|^%|<%%|<%=|<%#|<%|\z)/m
- etag_reg = /(.*?)(%%>|%>|\z)/m
- scanner = StringScanner.new(@src)
- while ! scanner.eos?
- scanner.scan(@stag ? etag_reg : stag_reg)
- yield(scanner[1])
-
- elem = scanner[2]
- if elem == '%%'
- yield('%')
- inline_scan(scanner.scan(/.*?(\n|\z)/), &blk)
- elsif elem == '%'
- yield(PercentLine.new(scanner.scan(/.*?(\n|\z)/).chomp))
- else
- yield(elem)
- end
- end
- end
-
- def inline_scan(line)
- stag_reg = /(.*?)(<%%|<%=|<%#|<%|\z)/m
- etag_reg = /(.*?)(%%>|%>|\z)/m
- scanner = StringScanner.new(line)
- while ! scanner.eos?
- scanner.scan(@stag ? etag_reg : stag_reg)
- yield(scanner[1])
- yield(scanner[2])
- end
- end
- end
- Scanner.regist_scanner(PercentScanner, nil, true)
-
class ExplicitScanner < Scanner # :nodoc:
def scan
stag_reg = /(.*?)(^[ \t]*<%-|<%%|<%=|<%#|<%-|<%|\z)/m
diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb
index 9359984..4f2f5be 100644
--- a/test/erb/test_erb.rb
+++ b/test/erb/test_erb.rb
@@ -410,6 +410,10 @@ EOS
assert_equal(ans, ERB.new(src, nil, '-').result)
assert_equal(ans, ERB.new(src, nil, '-%').result)
end
+
+ def test_percent_after_etag
+ assert_equal("1%", @erb.new("<%= 1 %>%", nil, "%").result)
+ end
end
class TestERBCoreWOStrScan < TestERBCore
diff --git a/version.h b/version.h
index 3ce8307..fd28143 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2009-02-24"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20090224
-#define RUBY_PATCHLEVEL 140
+#define RUBY_PATCHLEVEL 141
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8