Decoding of entities with numbers
This ensures that entities such as "½" are decoded properly. Previously this would be ignored as the regular expression used for this only matched [a-zA-Z]. This was adapted from PR #111.
This commit is contained in:
parent
f814ec7170
commit
af7f2674af
|
@ -42,7 +42,7 @@ module Oga
|
||||||
#
|
#
|
||||||
# @return [Regexp]
|
# @return [Regexp]
|
||||||
#
|
#
|
||||||
REGULAR_ENTITY = /&[a-zA-Z]+;/
|
REGULAR_ENTITY = /&[a-zA-Z0-9]+;/
|
||||||
|
|
||||||
##
|
##
|
||||||
# Regexp for matching XML/HTML entities such as "&".
|
# Regexp for matching XML/HTML entities such as "&".
|
||||||
|
|
|
@ -11,5 +11,9 @@ describe Oga::HTML::Entities do
|
||||||
it 'decodes λ into λ' do
|
it 'decodes λ into λ' do
|
||||||
described_class.decode('λ').should == 'λ'
|
described_class.decode('λ').should == 'λ'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'decodes ½ into ½' do
|
||||||
|
described_class.decode('½').should == '½'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue