rdf-microdata 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -1
- data/README +2 -2
- data/VERSION +1 -1
- data/etc/doap.html +4 -4
- data/lib/rdf/microdata.rb +1 -1
- data/lib/rdf/microdata/format.rb +5 -1
- data/lib/rdf/microdata/reader.rb +11 -10
- data/lib/rdf/microdata/reader/nokogiri.rb +2 -2
- data/lib/rdf/microdata/reader/rexml.rb +2 -2
- metadata +87 -27
data/AUTHORS
CHANGED
@@ -1 +1 @@
|
|
1
|
-
* Gregg Kellogg <gregg@
|
1
|
+
* Gregg Kellogg <gregg@greggkellogg.net>
|
data/README
CHANGED
@@ -60,7 +60,7 @@ Full documentation available on [Rubydoc.info][Microdata doc]
|
|
60
60
|
* [Microdata RDF][]
|
61
61
|
|
62
62
|
## Author
|
63
|
-
* [Gregg Kellogg](http://github.com/gkellogg) - <http://
|
63
|
+
* [Gregg Kellogg](http://github.com/gkellogg) - <http://greggkellogg.net/>
|
64
64
|
|
65
65
|
## Contributing
|
66
66
|
|
@@ -83,7 +83,7 @@ see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
|
83
83
|
|
84
84
|
## FEEDBACK
|
85
85
|
|
86
|
-
* gregg@
|
86
|
+
* gregg@greggkellogg.net
|
87
87
|
* <http://rubygems.org/rdf-microdata>
|
88
88
|
* <http://github.com/ruby-rdf/rdf-microdata>
|
89
89
|
* <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
data/etc/doap.html
CHANGED
@@ -16,8 +16,8 @@
|
|
16
16
|
<dt>Created</dt><time itemprop="created" datetime="2011-08-29"/></dd>
|
17
17
|
<dt>Blog</dt><dd><a href="http://greggkellogg.net/" itemprop="blog">http://greggkellogg.net/</a></dd>
|
18
18
|
<dt>Bug DB</dt><dd>
|
19
|
-
<a href="http://github.com/
|
20
|
-
http://github.com/
|
19
|
+
<a href="http://github.com/ruby-rdf/rdf-microdata/issues" itemprop="bug-database">
|
20
|
+
http://github.com/ruby-rdf/rdf-microdata/issues
|
21
21
|
</a>
|
22
22
|
</dd>
|
23
23
|
<dt>Category</dt><dd itemprop="category">
|
@@ -28,8 +28,8 @@
|
|
28
28
|
<dt>Download</dt><dd><a href="http://rubygems.org/gems/rdf-microdata" itemprop="download-page">
|
29
29
|
http://rubygems.org/gems/rdf-microdata
|
30
30
|
</a></dd>
|
31
|
-
<dt>Home Page</dt><dd><a href="http://github.com/
|
32
|
-
http://github.com/
|
31
|
+
<dt>Home Page</dt><dd><a href="http://github.com/ruby-rdf/rdf-microdata" itemprop="homepage">
|
32
|
+
http://github.com/ruby-rdf/rdf-microdata
|
33
33
|
</a></dd>
|
34
34
|
<dt>License</dt><dd>
|
35
35
|
<a href="http://creativecommons.org/licenses/publicdomain/" itemprop="license">Public Domain</a>
|
data/lib/rdf/microdata.rb
CHANGED
@@ -18,7 +18,7 @@ module RDF
|
|
18
18
|
# @see http://rdf.rubyforge.org/
|
19
19
|
# @see http://www.w3.org/TR/2011/WD-microdata-20110525/
|
20
20
|
#
|
21
|
-
# @author [Gregg Kellogg](http://
|
21
|
+
# @author [Gregg Kellogg](http://greggkellogg.net/)
|
22
22
|
module Microdata
|
23
23
|
require 'rdf/microdata/format'
|
24
24
|
require 'rdf/microdata/vocab'
|
data/lib/rdf/microdata/format.rb
CHANGED
@@ -15,7 +15,11 @@ module RDF::Microdata
|
|
15
15
|
# @see http://www.w3.org/TR/rdf-testcases/#ntriples
|
16
16
|
class Format < RDF::Format
|
17
17
|
content_encoding 'utf-8'
|
18
|
-
|
18
|
+
|
19
|
+
# Only define content type if RDFa is not available.
|
20
|
+
# The Microdata processor will be launched from there
|
21
|
+
# otherwise.
|
22
|
+
content_type 'text/html', :extension => :html unless RDF::Format.for(:rdfa)
|
19
23
|
reader { RDF::Microdata::Reader }
|
20
24
|
|
21
25
|
##
|
data/lib/rdf/microdata/reader.rb
CHANGED
@@ -14,7 +14,7 @@ module RDF::Microdata
|
|
14
14
|
# Based on processing rules, amended with the following:
|
15
15
|
#
|
16
16
|
# @see https://dvcs.w3.org/hg/htmldata/raw-file/0d6b89f5befb/microdata-rdf/index.html
|
17
|
-
# @author [Gregg Kellogg](http://
|
17
|
+
# @author [Gregg Kellogg](http://greggkellogg.net/)
|
18
18
|
class Reader < RDF::Reader
|
19
19
|
format Format
|
20
20
|
URL_PROPERTY_ELEMENTS = %w(a area audio embed iframe img link object source track video)
|
@@ -81,7 +81,8 @@ module RDF::Microdata
|
|
81
81
|
@properties = properties
|
82
82
|
if @scheme == :vocabulary
|
83
83
|
@property_base = prefixURI.to_s
|
84
|
-
|
84
|
+
# Append a '#' for fragment if necessary
|
85
|
+
@property_base += '#' unless %w(/ #).include?(@property_base[-1,1])
|
85
86
|
else
|
86
87
|
@property_base = 'http://www.w3.org/ns/md?type='
|
87
88
|
end
|
@@ -283,8 +284,8 @@ module RDF::Microdata
|
|
283
284
|
|
284
285
|
# Add debug event to debug array, if specified
|
285
286
|
#
|
286
|
-
# @param [Nokogiri::XML::Node, #to_s] node
|
287
|
-
# @param [String] message
|
287
|
+
# @param [Nokogiri::XML::Node, #to_s] node XML Node or string for showing context
|
288
|
+
# @param [String] message
|
288
289
|
# @yieldreturn [String] appended to message, to allow for lazy-evaulation of message
|
289
290
|
def add_debug(node, message = "")
|
290
291
|
return unless ::RDF::Microdata.debug? || @debug
|
@@ -300,12 +301,12 @@ module RDF::Microdata
|
|
300
301
|
|
301
302
|
# add a statement, object can be literal or URI or bnode
|
302
303
|
#
|
303
|
-
# @param [Nokogiri::XML::Node, any] node
|
304
|
-
# @param [URI, BNode] subject
|
305
|
-
# @param [URI] predicate
|
306
|
-
# @param [URI, BNode, Literal] object
|
307
|
-
# @return [Statement]
|
308
|
-
# @raise [ReaderError]
|
304
|
+
# @param [Nokogiri::XML::Node, any] node XML Node or string for showing context
|
305
|
+
# @param [URI, BNode] subject the subject of the statement
|
306
|
+
# @param [URI] predicate the predicate of the statement
|
307
|
+
# @param [URI, BNode, Literal] object the object of the statement
|
308
|
+
# @return [Statement] Added statement
|
309
|
+
# @raise [ReaderError] Checks parameter types and raises if they are incorrect if parsing mode is _validate_.
|
309
310
|
def add_triple(node, subject, predicate, object)
|
310
311
|
statement = RDF::Statement.new(subject, predicate, object)
|
311
312
|
add_debug(node) {"statement: #{RDF::NTriples.serialize(statement)}"}
|
@@ -141,7 +141,7 @@ module RDF::Microdata
|
|
141
141
|
|
142
142
|
##
|
143
143
|
# Add NodeSetProxys
|
144
|
-
# @param [NodeSetProxy, Nokogiri::XML::Node]
|
144
|
+
# @param [NodeSetProxy, Nokogiri::XML::Node] other
|
145
145
|
# @return [NodeSetProxy]
|
146
146
|
def +(other)
|
147
147
|
NodeSetProxy.new(self.node_set + other.node_set, parent)
|
@@ -149,7 +149,7 @@ module RDF::Microdata
|
|
149
149
|
|
150
150
|
##
|
151
151
|
# Add a NodeProxy
|
152
|
-
# @param [NodeProxy, Nokogiri::XML::Node]
|
152
|
+
# @param [NodeProxy, Nokogiri::XML::Node] elem
|
153
153
|
# @return [NodeSetProxy]
|
154
154
|
def <<(elem)
|
155
155
|
node_set << (elem.is_a?(NodeProxy) ? elem.node : elem)
|
@@ -179,7 +179,7 @@ module RDF::Microdata
|
|
179
179
|
|
180
180
|
##
|
181
181
|
# Add NodeSetProxys
|
182
|
-
# @param [NodeSetProxy, Nokogiri::XML::Node]
|
182
|
+
# @param [NodeSetProxy, Nokogiri::XML::Node] other
|
183
183
|
# @return [NodeSetProxy]
|
184
184
|
def +(other)
|
185
185
|
new_ns = node_set.clone
|
@@ -189,7 +189,7 @@ module RDF::Microdata
|
|
189
189
|
|
190
190
|
##
|
191
191
|
# Add a NodeProxy
|
192
|
-
# @param [NodeProxy, Nokogiri::XML::Node]
|
192
|
+
# @param [NodeProxy, Nokogiri::XML::Node] elem
|
193
193
|
# @return [NodeSetProxy]
|
194
194
|
def <<(elem)
|
195
195
|
node_set << (elem.is_a?(NodeProxy) ? elem.node : elem)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-microdata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-08-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rdf
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,15 @@ dependencies:
|
|
22
22
|
version: 0.3.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.3.4
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: json
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,10 +38,15 @@ dependencies:
|
|
33
38
|
version: 1.6.1
|
34
39
|
type: :runtime
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.6.1
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: rdf-xsd
|
39
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
52
|
- - ! '>='
|
@@ -44,10 +54,15 @@ dependencies:
|
|
44
54
|
version: 0.3.4
|
45
55
|
type: :runtime
|
46
56
|
prerelease: false
|
47
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.3.4
|
48
63
|
- !ruby/object:Gem::Dependency
|
49
64
|
name: htmlentities
|
50
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
51
66
|
none: false
|
52
67
|
requirements:
|
53
68
|
- - ! '>='
|
@@ -55,10 +70,15 @@ dependencies:
|
|
55
70
|
version: 4.3.0
|
56
71
|
type: :runtime
|
57
72
|
prerelease: false
|
58
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 4.3.0
|
59
79
|
- !ruby/object:Gem::Dependency
|
60
80
|
name: nokogiri
|
61
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
62
82
|
none: false
|
63
83
|
requirements:
|
64
84
|
- - ! '>='
|
@@ -66,10 +86,15 @@ dependencies:
|
|
66
86
|
version: 1.5.0
|
67
87
|
type: :development
|
68
88
|
prerelease: false
|
69
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.5.0
|
70
95
|
- !ruby/object:Gem::Dependency
|
71
96
|
name: equivalent-xml
|
72
|
-
requirement:
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
73
98
|
none: false
|
74
99
|
requirements:
|
75
100
|
- - ! '>='
|
@@ -77,10 +102,15 @@ dependencies:
|
|
77
102
|
version: 0.2.8
|
78
103
|
type: :development
|
79
104
|
prerelease: false
|
80
|
-
version_requirements:
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.2.8
|
81
111
|
- !ruby/object:Gem::Dependency
|
82
112
|
name: yard
|
83
|
-
requirement:
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
84
114
|
none: false
|
85
115
|
requirements:
|
86
116
|
- - ! '>='
|
@@ -88,10 +118,15 @@ dependencies:
|
|
88
118
|
version: 0.6.0
|
89
119
|
type: :development
|
90
120
|
prerelease: false
|
91
|
-
version_requirements:
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 0.6.0
|
92
127
|
- !ruby/object:Gem::Dependency
|
93
128
|
name: spira
|
94
|
-
requirement:
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
95
130
|
none: false
|
96
131
|
requirements:
|
97
132
|
- - ! '>='
|
@@ -99,10 +134,15 @@ dependencies:
|
|
99
134
|
version: 0.0.12
|
100
135
|
type: :development
|
101
136
|
prerelease: false
|
102
|
-
version_requirements:
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 0.0.12
|
103
143
|
- !ruby/object:Gem::Dependency
|
104
144
|
name: rspec
|
105
|
-
requirement:
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
106
146
|
none: false
|
107
147
|
requirements:
|
108
148
|
- - ! '>='
|
@@ -110,10 +150,15 @@ dependencies:
|
|
110
150
|
version: 2.8.0
|
111
151
|
type: :development
|
112
152
|
prerelease: false
|
113
|
-
version_requirements:
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: 2.8.0
|
114
159
|
- !ruby/object:Gem::Dependency
|
115
160
|
name: rdf-spec
|
116
|
-
requirement:
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
117
162
|
none: false
|
118
163
|
requirements:
|
119
164
|
- - ! '>='
|
@@ -121,10 +166,15 @@ dependencies:
|
|
121
166
|
version: 0.3.4
|
122
167
|
type: :development
|
123
168
|
prerelease: false
|
124
|
-
version_requirements:
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ! '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: 0.3.4
|
125
175
|
- !ruby/object:Gem::Dependency
|
126
176
|
name: rdf-turtle
|
127
|
-
requirement:
|
177
|
+
requirement: !ruby/object:Gem::Requirement
|
128
178
|
none: false
|
129
179
|
requirements:
|
130
180
|
- - ! '>='
|
@@ -132,10 +182,15 @@ dependencies:
|
|
132
182
|
version: 0.1.0
|
133
183
|
type: :development
|
134
184
|
prerelease: false
|
135
|
-
version_requirements:
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: 0.1.0
|
136
191
|
- !ruby/object:Gem::Dependency
|
137
192
|
name: rdf-isomorphic
|
138
|
-
requirement:
|
193
|
+
requirement: !ruby/object:Gem::Requirement
|
139
194
|
none: false
|
140
195
|
requirements:
|
141
196
|
- - ! '>='
|
@@ -143,7 +198,12 @@ dependencies:
|
|
143
198
|
version: 0.3.4
|
144
199
|
type: :development
|
145
200
|
prerelease: false
|
146
|
-
version_requirements:
|
201
|
+
version_requirements: !ruby/object:Gem::Requirement
|
202
|
+
none: false
|
203
|
+
requirements:
|
204
|
+
- - ! '>='
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 0.3.4
|
147
207
|
description: Microdata reader for Ruby.
|
148
208
|
email: public-rdf-ruby@w3.org
|
149
209
|
executables: []
|
@@ -184,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
244
|
version: '0'
|
185
245
|
requirements: []
|
186
246
|
rubyforge_project: rdf-microdata
|
187
|
-
rubygems_version: 1.8.
|
247
|
+
rubygems_version: 1.8.24
|
188
248
|
signing_key:
|
189
249
|
specification_version: 3
|
190
250
|
summary: Microdata reader for Ruby.
|