Skip to content

Commit

Permalink
Decoding of entities with numbers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Yorick Peterse committed Jun 7, 2015
1 parent f814ec7 commit af7f267
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/oga/xml/entities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module Entities
#
# @return [Regexp]
#
REGULAR_ENTITY = /&[a-zA-Z]+;/
REGULAR_ENTITY = /&[a-zA-Z0-9]+;/

##
# Regexp for matching XML/HTML entities such as "&".
Expand Down
4 changes: 4 additions & 0 deletions spec/oga/html/entities_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@
it 'decodes λ into λ' do
described_class.decode('λ').should == 'λ'
end

it 'decodes ½ into ½' do
described_class.decode('½').should == '½'
end
end
end

0 comments on commit af7f267

Please sign in to comment.