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 +4 -4
- data/lib/oga/version.rb +1 -1
- data/lib/oga/xml/entities.rb +17 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49e8bbac0a9f880b8e5b068bb4c9bf684af62124
|
4
|
+
data.tar.gz: 4dfb3b6c5cbd3c9de6bf0afef43545052386487f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e487af3bcad6f4e6e7a340a7709be355fa614c766fded6c8643befff56407c621710d00784394b277b59985e8c3b2d3d338606bd07864bdcc37cb5bd22cde46
|
7
|
+
data.tar.gz: 3d475e191270aab814a09e509cad56f1f0f57a8dd0c6ce3806625401384f586bbd661f2308a8e3f6339a6e1aa1dacc78bfd184d29f506f1c2f7db8fcfb986008
|
data/lib/oga/version.rb
CHANGED
data/lib/oga/xml/entities.rb
CHANGED
@@ -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
|
-
|
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(
|
93
|
-
[
|
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.
|
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.
|
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.
|