rdf-rdfxml 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/rdf/rdfxml/reader/nokogiri.rb +1 -1
- data/lib/rdf/rdfxml/writer.rb +13 -8
- data/lib/rdf/rdfxml/writer/haml_templates.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f0332cc835b70ad36d5ee0e1eb355bade399237
|
4
|
+
data.tar.gz: 288a1e274067f6d24accdef8dcf942a38e9a3577
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff585ff8d1613982db5cbbe3f1440b513692ab8fbacbbf58360d80d6f56cb5bcef3b89319d8a3c646585aa2284d6d29be357e97e4cd0173424f7814f42e98e43
|
7
|
+
data.tar.gz: 84711dfeb7846737eaafa9aca1acdf90cdf3e743ac1abb87049238818a0dfcfd9e5112aa75fa19ad313e5ac2b12984c346a07029362601c38eb3750e43618b7a
|
data/README.md
CHANGED
@@ -101,7 +101,7 @@ see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
|
101
101
|
[Ruby]: http://ruby-lang.org/
|
102
102
|
[RDF]: http://www.w3.org/RDF/
|
103
103
|
[RDF.rb]: http://rubygems.org/gems/rdf
|
104
|
-
[RDF/XML]:
|
104
|
+
[RDF/XML]: hhttp://www.w3.org/TR/rdf-syntax-grammar/ "RDF/XML Syntax Specification"
|
105
105
|
[YARD]: http://yardoc.org/
|
106
106
|
[YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
|
107
107
|
[PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.4
|
@@ -232,7 +232,7 @@ module RDF::RDFXML
|
|
232
232
|
options[:encoding] ||= 'utf-8'
|
233
233
|
options[:encoding] = options[:encoding].to_s if options[:encoding]
|
234
234
|
|
235
|
-
::Nokogiri::XML.parse(input, base_uri.to_s, options[:encoding]) do |config|
|
235
|
+
::Nokogiri::XML.parse(input.respond_to?(:read) ? input.read : input.to_s, base_uri.to_s, options[:encoding]) do |config|
|
236
236
|
config.noent
|
237
237
|
end
|
238
238
|
end
|
data/lib/rdf/rdfxml/writer.rb
CHANGED
@@ -65,6 +65,8 @@ module RDF::RDFXML
|
|
65
65
|
# the prefix mappings to use (not supported by all writers)
|
66
66
|
# @option options [#to_s] :base_uri (nil)
|
67
67
|
# the base URI to use when constructing relative URIs
|
68
|
+
# @option options [Integer] :max_depth (10)
|
69
|
+
# Maximum depth for recursively defining resources
|
68
70
|
# @option options [#to_s] :lang (nil)
|
69
71
|
# Output as root xml:lang attribute, and avoid generation _xml:lang_ where possible
|
70
72
|
# @option options [Symbol] :attributes (nil)
|
@@ -92,7 +94,8 @@ module RDF::RDFXML
|
|
92
94
|
|
93
95
|
def write_epilogue
|
94
96
|
@force_RDF_about = {}
|
95
|
-
@
|
97
|
+
@max_depth = @options.fetch(:max_depth, 10)
|
98
|
+
@attributes = @options.fetch(:attributes, :none)
|
96
99
|
|
97
100
|
super
|
98
101
|
end
|
@@ -151,7 +154,7 @@ module RDF::RDFXML
|
|
151
154
|
{}
|
152
155
|
end
|
153
156
|
|
154
|
-
predicates -= attr_props.keys
|
157
|
+
predicates -= attr_props.keys.map {|k| expand_curie(k).to_s}
|
155
158
|
super(subject, predicates, options.merge(:attr_props => attr_props), &block)
|
156
159
|
end
|
157
160
|
# See if we can serialize as attribute.
|
@@ -259,9 +262,10 @@ module RDF::RDFXML
|
|
259
262
|
raise RDF::WriterError, "Missing property template" if template.nil?
|
260
263
|
|
261
264
|
options = {
|
262
|
-
:
|
263
|
-
:
|
264
|
-
:
|
265
|
+
object: objects.first,
|
266
|
+
predicate: predicate,
|
267
|
+
property: get_qname(predicate),
|
268
|
+
recurse: @depth <= @max_depth
|
265
269
|
}.merge(options)
|
266
270
|
hamlify(template, options, &block)
|
267
271
|
end
|
@@ -285,9 +289,10 @@ module RDF::RDFXML
|
|
285
289
|
template = options[:haml] || haml_template[:collection]
|
286
290
|
|
287
291
|
options = {
|
288
|
-
:
|
289
|
-
:
|
290
|
-
:
|
292
|
+
list: list,
|
293
|
+
predicate: predicate,
|
294
|
+
property: get_qname(predicate),
|
295
|
+
recurse: @depth <= @max_depth,
|
291
296
|
}.merge(options)
|
292
297
|
hamlify(template, options) do |object|
|
293
298
|
yield object
|
@@ -49,7 +49,7 @@ module RDF::RDFXML
|
|
49
49
|
# If nil is returned, render as a leaf
|
50
50
|
# Otherwise, render result
|
51
51
|
:property_value => %q(
|
52
|
-
- if res = yield(object)
|
52
|
+
- if recurse && res = yield(object)
|
53
53
|
- haml_tag(property) do
|
54
54
|
= res
|
55
55
|
- elsif object.literal? && object.datatype == RDF.XMLLiteral
|
@@ -57,7 +57,7 @@ module RDF::RDFXML
|
|
57
57
|
= object.value
|
58
58
|
- elsif object.literal?
|
59
59
|
- haml_tag(property, :"<", "xml:lang" => object.language, "rdf:datatype" => (object.datatype unless object.plain?)) do
|
60
|
-
= object.value
|
60
|
+
= object.value.to_s.encode(xml: :text)
|
61
61
|
- elsif object.node?
|
62
62
|
- haml_tag(property, :"/", "rdf:nodeID" => object.id)
|
63
63
|
- else
|
@@ -72,7 +72,7 @@ module RDF::RDFXML
|
|
72
72
|
:collection => %q(
|
73
73
|
- haml_tag(property, get_qname(RDF.parseType) => "Collection") do
|
74
74
|
- list.each do |object|
|
75
|
-
- if res = yield(object)
|
75
|
+
- if recurse && res = yield(object)
|
76
76
|
= res
|
77
77
|
- elsif object.node?
|
78
78
|
- haml_tag(get_qname(RDF.Description), :"/", "rdf:nodeID" => (object.id if ref_count(object) > 1))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-rdfxml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdf
|
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
253
|
version: '0'
|
254
254
|
requirements: []
|
255
255
|
rubyforge_project: rdf-rdfxml
|
256
|
-
rubygems_version: 2.
|
256
|
+
rubygems_version: 2.4.3
|
257
257
|
signing_key:
|
258
258
|
specification_version: 4
|
259
259
|
summary: RDF/XML reader/writer for RDF.rb.
|