* lib/rexml/text.rb (REXML::Text.normalize): Fix a bug that all
entity filters are ignored. [ruby-dev:47278] [Bug #8302] Patch by Ippei Obayashi. Thanks!!! * test/rexml/test_entity.rb (EntityTester#test_entity_filter): Add a test of the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
562648e48c
commit
4e44eeaeb1
@ -1,3 +1,11 @@
|
|||||||
|
Fri Apr 26 23:34:59 2013 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
|
* lib/rexml/text.rb (REXML::Text.normalize): Fix a bug that all
|
||||||
|
entity filters are ignored. [ruby-dev:47278] [Bug #8302]
|
||||||
|
Patch by Ippei Obayashi. Thanks!!!
|
||||||
|
* test/rexml/test_entity.rb (EntityTester#test_entity_filter): Add
|
||||||
|
a test of the above change.
|
||||||
|
|
||||||
Fri Apr 26 22:53:55 2013 Kouhei Sutou <kou@cozmixng.org>
|
Fri Apr 26 22:53:55 2013 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rexml/element.rb (REXML::Attributes#to_a): Support
|
* lib/rexml/element.rb (REXML::Attributes#to_a): Support
|
||||||
|
@ -368,7 +368,7 @@ module REXML
|
|||||||
doctype.entities.each_value do |entity|
|
doctype.entities.each_value do |entity|
|
||||||
copy = copy.gsub( entity.value,
|
copy = copy.gsub( entity.value,
|
||||||
"&#{entity.name};" ) if entity.value and
|
"&#{entity.name};" ) if entity.value and
|
||||||
not( entity_filter and entity_filter.include?(entity) )
|
not( entity_filter and entity_filter.include?(entity.name) )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Replace all ampersands that aren't part of an entity
|
# Replace all ampersands that aren't part of an entity
|
||||||
|
@ -164,4 +164,24 @@ class EntityTester < Test::Unit::TestCase
|
|||||||
def test_single_pass_unnormalization # ticket 123
|
def test_single_pass_unnormalization # ticket 123
|
||||||
assert_equal '&&', REXML::Text::unnormalize('&amp;&')
|
assert_equal '&&', REXML::Text::unnormalize('&amp;&')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_entity_filter
|
||||||
|
document = REXML::Document.new(<<-XML)
|
||||||
|
<!DOCTYPE root [
|
||||||
|
<!ENTITY copy "(c)">
|
||||||
|
<!ENTITY release-year "2013">
|
||||||
|
]>
|
||||||
|
<root/>
|
||||||
|
XML
|
||||||
|
respect_whitespace = false
|
||||||
|
parent = document.root
|
||||||
|
raw = false
|
||||||
|
entity_filter = ["copy"]
|
||||||
|
assert_equal("(c) &release-year;",
|
||||||
|
REXML::Text.new("(c) 2013",
|
||||||
|
respect_whitespace,
|
||||||
|
parent,
|
||||||
|
raw,
|
||||||
|
entity_filter).to_s)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user