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:
Yorick Peterse 2015-06-07 17:42:24 +02:00
parent f814ec7170
commit af7f2674af
2 changed files with 5 additions and 1 deletions

View File

@ -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 "&".

View File

@ -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