diff options
author | seki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-31 14:49:19 +0000 |
---|---|---|
committer | seki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-31 14:49:19 +0000 |
commit | 6b43c9bfbfea4d1fd6c82f1503510beadc0ff4ed (patch) | |
tree | 96a5f07c050f33d7c0be2e9847d66121f23e3928 /lib/erb.rb | |
parent | fabe115f9bb0e22afc7157483237295512581dcf (diff) |
import erb-2.0.4b4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/erb.rb')
-rw-r--r-- | lib/erb.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/erb.rb b/lib/erb.rb index 9c98ee154c..1b712c92c2 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -130,7 +130,7 @@ class ERB end end - ExplicitTrimRegexp = /(^[ \t]*<%-)|(-%>\n?$)|(<%-)|(-%>)|(<%%)|(%%>)|(<%=)|(<%#)|(<%)|(%>)|(\n)/ + ExplicitTrimRegexp = /(^[ \t]*<%-)|(-%>\n?\z)|(<%-)|(-%>)|(<%%)|(%%>)|(<%=)|(<%#)|(<%)|(%>)|(\n)/ def explicit_trim_line(line) line.split(ExplicitTrimRegexp).each do |token| next if token.empty? @@ -172,8 +172,8 @@ class ERB require 'strscan' class SimpleScanner2 < Scanner def scan - stag_reg = /(.*?)(<%%|<%=|<%#|<%|\n|$)/ - etag_reg = /(.*?)(%%>|%>|\n|$)/ + stag_reg = /(.*?)(<%%|<%=|<%#|<%|\n|\z)/ + etag_reg = /(.*?)(%%>|%>|\n|\z)/ scanner = StringScanner.new(@src) while ! scanner.eos? scanner.scan(@stag ? etag_reg : stag_reg) @@ -189,8 +189,8 @@ class ERB class PercentScanner < Scanner def scan new_line = true - stag_reg = /(.*?)(<%%|<%=|<%#|<%|\n|$)/ - etag_reg = /(.*?)(%%>|%>|\n|$)/ + stag_reg = /(.*?)(<%%|<%=|<%#|<%|\n|\z)/ + etag_reg = /(.*?)(%%>|%>|\n|\z)/ scanner = StringScanner.new(@src) while ! scanner.eos? if new_line && @stag.nil? @@ -199,7 +199,7 @@ class ERB new_line = false next elsif scanner.scan(/%/) - yield(PercentLine.new(scanner.scan(/.*?(\n|$)/).chomp)) + yield(PercentLine.new(scanner.scan(/.*?(\n|\z)/).chomp)) next end end @@ -217,8 +217,8 @@ class ERB class ExplicitScanner < Scanner def scan new_line = true - stag_reg = /(.*?)(<%%|<%=|<%#|<%-|<%|\n|$)/ - etag_reg = /(.*?)(%%>|-%>|%>|\n|$)/ + stag_reg = /(.*?)(<%%|<%=|<%#|<%-|<%|\n|\z)/ + etag_reg = /(.*?)(%%>|-%>|%>|\n|\z)/ scanner = StringScanner.new(@src) while ! scanner.eos? if new_line && @stag.nil? && scanner.scan(/[ \t]*<%-/) @@ -233,7 +233,7 @@ class ERB yield(text) unless text.empty? if elem == '-%>' yield('%>') - if scanner.scan(/(\n|$)/) + if scanner.scan(/(\n|\z)/) yield(:cr) new_line = true end |