oga 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a5d490dd77a378cf8db7c889b464473e5bd81bd
4
- data.tar.gz: 6915b14d4f18766dd64c2fd406bd6ab46deae2f0
3
+ metadata.gz: 49e8bbac0a9f880b8e5b068bb4c9bf684af62124
4
+ data.tar.gz: 4dfb3b6c5cbd3c9de6bf0afef43545052386487f
5
5
  SHA512:
6
- metadata.gz: 8a76d088da06ba7a8c94daa9426c9adca6c97287d395c6c75dc0b22688160f231d996e65e8d76f7f9676920589eb4bb2b49e78a0536c5d6c02328c2d13821a9c
7
- data.tar.gz: 320041b05dcf0dbdc51b9696f67f7f1df16b5a713383a933ed724d46c1f78ae8e8700b438b298a7bbdef386b82f3d41803bfdfbe33e9fc314fffb969551fb9cb
6
+ metadata.gz: 3e487af3bcad6f4e6e7a340a7709be355fa614c766fded6c8643befff56407c621710d00784394b277b59985e8c3b2d3d338606bd07864bdcc37cb5bd22cde46
7
+ data.tar.gz: 3d475e191270aab814a09e509cad56f1f0f57a8dd0c6ce3806625401384f586bbd661f2308a8e3f6339a6e1aa1dacc78bfd184d29f506f1c2f7db8fcfb986008
@@ -1,3 +1,3 @@
1
1
  module Oga
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end # Oga
@@ -59,11 +59,18 @@ module Oga
59
59
  REGULAR_ENTITY = /&[a-zA-Z0-9]+;/
60
60
 
61
61
  ##
62
- # Regexp for matching XML/HTML entities such as "&".
62
+ # Regexp for matching XML/HTML numeric entities such as "&".
63
63
  #
64
64
  # @return [Regexp]
65
65
  #
66
- CODEPOINT_ENTITY = /&#(x)?([a-zA-Z0-9]+);/
66
+ NUMERIC_CODE_POINT_ENTITY = /&#(\d+);/
67
+
68
+ ##
69
+ # Regexp for matching XML/HTML hex entities such as "<".
70
+ #
71
+ # @return [Regexp]
72
+ #
73
+ HEX_CODE_POINT_ENTITY = /&#x([a-fA-F0-9]+);/
67
74
 
68
75
  ##
69
76
  # @return [Regexp]
@@ -89,8 +96,14 @@ module Oga
89
96
  input = input.gsub(REGULAR_ENTITY, mapping)
90
97
 
91
98
  if input.include?(AMPERSAND)
92
- input = input.gsub(CODEPOINT_ENTITY) do |match|
93
- [$1 ? Integer($2, 16) : Integer($2, 10)].pack('U*')
99
+ input = input.gsub(NUMERIC_CODE_POINT_ENTITY) do
100
+ [Integer($1, 10)].pack('U*')
101
+ end
102
+ end
103
+
104
+ if input.include?(AMPERSAND)
105
+ input = input.gsub(HEX_CODE_POINT_ENTITY) do
106
+ [Integer($1, 16)].pack('U*')
94
107
  end
95
108
  end
96
109
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oga
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yorick Peterse
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  version: '0'
220
220
  requirements: []
221
221
  rubyforge_project:
222
- rubygems_version: 2.4.5
222
+ rubygems_version: 2.4.8
223
223
  signing_key:
224
224
  specification_version: 4
225
225
  summary: Oga is an XML/HTML parser written in Ruby.