oga 2.10-java → 2.11-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/ext/c/extconf.rb +1 -1
- data/ext/c/lexer.c +6 -6
- data/lib/liboga.jar +0 -0
- data/lib/oga/version.rb +1 -1
- data/lib/oga/xml/attribute.rb +5 -4
- data/lib/oga/xml/element.rb +5 -4
- data/lib/oga/xml/sax_parser.rb +18 -14
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 814a8ba9ee851b03332f3f8352541f9c1b4bd736
|
4
|
+
data.tar.gz: d9bf12771f42a3d2663b0549e947e6630eb16853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a562435afc458fec249431e5f753db2344751bfbdf7b1c35a3446a77dcbf5a70376e0a180544814f94cbd39254c56800c4795949abddd8bb6a1ae0d2915aedda
|
7
|
+
data.tar.gz: c3b48773ee20c6ba918581c681301cdb94407bda894973d687709c7d6396bb0a923a3401d1631832ab22ec01c78ba718109580f301294432b86dcf5336b8162f
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Oga
|
2
2
|
|
3
|
+
**NOTE:** my spare time is limited which means I am unable to dedicate a lot of
|
4
|
+
time on Oga. If you're interested in contributing to FOSS, please take a look at
|
5
|
+
the open issues and submit a pull request to address them where possible.
|
6
|
+
|
3
7
|
Oga is an XML/HTML parser written in Ruby. It provides an easy to use API for
|
4
8
|
parsing, modifying and querying documents (using XPath expressions). Oga does
|
5
9
|
not require system libraries such as libxml, making it easier and faster to
|
@@ -287,7 +291,7 @@ Currently there are a few existing parser out there, the most famous one being
|
|
287
291
|
|
288
292
|
The sad truth is that these existing libraries are problematic in their own
|
289
293
|
ways. Nokogiri for example is extremely unstable on Rubinius. On MRI it works
|
290
|
-
because of the non
|
294
|
+
because of the non concurrent nature of MRI, on JRuby it works because it's
|
291
295
|
implemented as Java. Nokogiri also uses libxml2 which is a massive beast of a
|
292
296
|
library, is not thread-safe and problematic to install on certain platforms
|
293
297
|
(apparently). I don't want to compile libxml2 every time I install Nokogiri
|
data/ext/c/extconf.rb
CHANGED
data/ext/c/lexer.c
CHANGED
@@ -1097,7 +1097,7 @@ tr79:
|
|
1097
1097
|
{te = p+1;{
|
1098
1098
|
callback_simple(id_on_string_dquote);
|
1099
1099
|
|
1100
|
-
{( state->stack)[( state->top)++] = 55;
|
1100
|
+
{( state->stack)[( state->top)++] = 55;goto st51;}
|
1101
1101
|
}}
|
1102
1102
|
goto st55;
|
1103
1103
|
tr80:
|
@@ -1105,7 +1105,7 @@ tr80:
|
|
1105
1105
|
{te = p+1;{
|
1106
1106
|
callback_simple(id_on_string_squote);
|
1107
1107
|
|
1108
|
-
{( state->stack)[( state->top)++] = 55;
|
1108
|
+
{( state->stack)[( state->top)++] = 55;goto st49;}
|
1109
1109
|
}}
|
1110
1110
|
goto st55;
|
1111
1111
|
tr81:
|
@@ -1450,7 +1450,7 @@ tr99:
|
|
1450
1450
|
{te = p+1;{
|
1451
1451
|
callback_simple(id_on_string_dquote);
|
1452
1452
|
|
1453
|
-
{( state->stack)[( state->top)++] = 68;
|
1453
|
+
{( state->stack)[( state->top)++] = 68;goto st51;}
|
1454
1454
|
}}
|
1455
1455
|
#line 61 "ext/ragel/base_lexer.rl"
|
1456
1456
|
{
|
@@ -1462,7 +1462,7 @@ tr100:
|
|
1462
1462
|
{te = p+1;{
|
1463
1463
|
callback_simple(id_on_string_squote);
|
1464
1464
|
|
1465
|
-
{( state->stack)[( state->top)++] = 68;
|
1465
|
+
{( state->stack)[( state->top)++] = 68;goto st49;}
|
1466
1466
|
}}
|
1467
1467
|
#line 61 "ext/ragel/base_lexer.rl"
|
1468
1468
|
{
|
@@ -1914,7 +1914,7 @@ tr128:
|
|
1914
1914
|
tr131:
|
1915
1915
|
#line 525 "ext/ragel/base_lexer.rl"
|
1916
1916
|
{te = p+1;{
|
1917
|
-
{( state->stack)[( state->top)++] = 80;
|
1917
|
+
{( state->stack)[( state->top)++] = 80;goto st75;}
|
1918
1918
|
}}
|
1919
1919
|
goto st80;
|
1920
1920
|
tr132:
|
@@ -2033,7 +2033,7 @@ tr140:
|
|
2033
2033
|
tr143:
|
2034
2034
|
#line 525 "ext/ragel/base_lexer.rl"
|
2035
2035
|
{te = p+1;{
|
2036
|
-
{( state->stack)[( state->top)++] = 84;
|
2036
|
+
{( state->stack)[( state->top)++] = 84;goto st75;}
|
2037
2037
|
}}
|
2038
2038
|
goto st84;
|
2039
2039
|
tr144:
|
data/lib/liboga.jar
CHANGED
Binary file
|
data/lib/oga/version.rb
CHANGED
data/lib/oga/xml/attribute.rb
CHANGED
@@ -34,10 +34,11 @@ module Oga
|
|
34
34
|
# @option options [String] :value
|
35
35
|
# @option options [Oga::XML::Element] :element
|
36
36
|
def initialize(options = {})
|
37
|
-
@name
|
38
|
-
@value
|
39
|
-
@element
|
40
|
-
|
37
|
+
@name = options[:name]
|
38
|
+
@value = options[:value]
|
39
|
+
@element = options[:element]
|
40
|
+
@decoded = false
|
41
|
+
@namespace = nil
|
41
42
|
@namespace_name = options[:namespace_name]
|
42
43
|
end
|
43
44
|
|
data/lib/oga/xml/element.rb
CHANGED
@@ -34,10 +34,11 @@ module Oga
|
|
34
34
|
def initialize(options = {})
|
35
35
|
super
|
36
36
|
|
37
|
-
@name
|
38
|
-
@namespace_name
|
39
|
-
@attributes
|
40
|
-
@namespaces
|
37
|
+
@name = options[:name]
|
38
|
+
@namespace_name = options[:namespace_name]
|
39
|
+
@attributes = options[:attributes] || []
|
40
|
+
@namespaces = options[:namespaces] || {}
|
41
|
+
@available_namespaces = nil
|
41
42
|
|
42
43
|
link_attributes
|
43
44
|
register_namespaces_from_attributes
|
data/lib/oga/xml/sax_parser.rb
CHANGED
@@ -74,18 +74,7 @@ module Oga
|
|
74
74
|
super(*args)
|
75
75
|
end
|
76
76
|
|
77
|
-
#
|
78
|
-
instance_methods.grep(/^(on_|after_)/).each do |method|
|
79
|
-
eval <<-EOF, nil, __FILE__, __LINE__ + 1
|
80
|
-
def #{method}(*args)
|
81
|
-
run_callback(:#{method}, *args)
|
82
|
-
|
83
|
-
return
|
84
|
-
end
|
85
|
-
EOF
|
86
|
-
end
|
87
|
-
|
88
|
-
# Manually overwrite `on_element` so we can ensure that `after_element`
|
77
|
+
# Manually define `on_element` so we can ensure that `after_element`
|
89
78
|
# always receives the namespace and name.
|
90
79
|
#
|
91
80
|
# @see [Oga::XML::Parser#on_element]
|
@@ -96,7 +85,7 @@ module Oga
|
|
96
85
|
[namespace, name]
|
97
86
|
end
|
98
87
|
|
99
|
-
# Manually
|
88
|
+
# Manually define `after_element` so it can take a namespace and name.
|
100
89
|
# This differs a bit from the regular `after_element` which only takes an
|
101
90
|
# {Oga::XML::Element} instance.
|
102
91
|
#
|
@@ -107,7 +96,7 @@ module Oga
|
|
107
96
|
return
|
108
97
|
end
|
109
98
|
|
110
|
-
# Manually
|
99
|
+
# Manually define this method since for this one we _do_ want the
|
111
100
|
# return value so it can be passed to `on_element`.
|
112
101
|
#
|
113
102
|
# @see [Oga::XML::Parser#on_attribute]
|
@@ -157,6 +146,21 @@ module Oga
|
|
157
146
|
return
|
158
147
|
end
|
159
148
|
|
149
|
+
# Delegate remaining callbacks to the handler object.
|
150
|
+
existing_methods = instance_methods(false)
|
151
|
+
|
152
|
+
instance_methods.grep(/^(on_|after_)/).each do |method|
|
153
|
+
next if existing_methods.include?(method)
|
154
|
+
|
155
|
+
eval <<-EOF, nil, __FILE__, __LINE__ + 1
|
156
|
+
def #{method}(*args)
|
157
|
+
run_callback(:#{method}, *args)
|
158
|
+
|
159
|
+
return
|
160
|
+
end
|
161
|
+
EOF
|
162
|
+
end
|
163
|
+
|
160
164
|
private
|
161
165
|
|
162
166
|
# @return [TrueClass|FalseClass]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.11'
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Yorick Peterse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,9 +226,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
226
|
version: '0'
|
227
227
|
requirements: []
|
228
228
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.
|
229
|
+
rubygems_version: 2.6.8
|
230
230
|
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: Oga is an XML/HTML parser written in Ruby.
|
233
233
|
test_files: []
|
234
|
-
has_rdoc: yard
|