summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-23 17:43:45 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-23 17:43:45 +0000
commit3435f0c106fac2dda1d4869c9faf9bccded5678f (patch)
tree6fa3aba44035cbeb2f47191c1cb857c8547e9312
parent214d80f89cbeceab187600cbe495defd4147614d (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_6@22581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--lib/erb.rb28
-rw-r--r--test/erb/test_erb.rb4
-rw-r--r--version.h8
4 files changed, 15 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 1da88ac..316f812 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Feb 24 02:41:47 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
+
Sun Feb 22 22:05:44 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (stack_extend): streamlined rb_thread_restore_context()
diff --git a/lib/erb.rb b/lib/erb.rb
index d7c72b4..d111e8f 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -422,34 +422,6 @@ class ERB
end
Scanner.regist_scanner(SimpleScanner2, nil, false)
- class PercentScanner < Scanner # :nodoc:
- def scan
- new_line = true
- stag_reg = /(.*?)(<%%|<%=|<%#|<%|\n|\z)/
- etag_reg = /(.*?)(%%>|%>|\n|\z)/
- scanner = StringScanner.new(@src)
- while ! scanner.eos?
- if new_line && @stag.nil?
- if scanner.scan(/%%/)
- yield('%')
- new_line = false
- next
- elsif scanner.scan(/%/)
- yield(PercentLine.new(scanner.scan(/.*?(\n|\z)/).chomp))
- next
- end
- end
- scanner.scan(@stag ? etag_reg : stag_reg)
- text = scanner[1]
- elem = scanner[2]
- yield(text) unless text.empty?
- yield(elem) unless elem.empty?
- new_line = (elem == "\n")
- end
- end
- end
- Scanner.regist_scanner(PercentScanner, nil, true)
-
class ExplicitScanner < Scanner # :nodoc:
def scan
new_line = true
diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb
index 832c2f2..f4f9474 100644
--- a/test/erb/test_erb.rb
+++ b/test/erb/test_erb.rb
@@ -408,6 +408,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 e2cf7b6..125e2e5 100644
--- a/version.h
+++ b/version.h
@@ -1,15 +1,15 @@
#define RUBY_VERSION "1.8.6"
-#define RUBY_RELEASE_DATE "2009-02-22"
+#define RUBY_RELEASE_DATE "2009-02-24"
#define RUBY_VERSION_CODE 186
-#define RUBY_RELEASE_CODE 20090222
-#define RUBY_PATCHLEVEL 351
+#define RUBY_RELEASE_CODE 20090224
+#define RUBY_PATCHLEVEL 352
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
#define RUBY_VERSION_TEENY 6
#define RUBY_RELEASE_YEAR 2009
#define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 22
+#define RUBY_RELEASE_DAY 24
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];