rdf-rdfxml 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3ada350c5677d2a143dcbd5af7e789f22786b11
4
- data.tar.gz: 5e6a3a327cd63768c241c0f8c576d66846b83d1f
3
+ metadata.gz: 8f0332cc835b70ad36d5ee0e1eb355bade399237
4
+ data.tar.gz: 288a1e274067f6d24accdef8dcf942a38e9a3577
5
5
  SHA512:
6
- metadata.gz: f467b070afe52055efc33650615d87af8c73212416c2ec0525833b1516f1d32d40453471aa26d597cde600530cd49e3862c3b2088ce54b63eb62714819eb59e1
7
- data.tar.gz: ebfa2248b95722a2702c0b0c2742ec93be999c9846263dd336dadefb10596ac3cd1d57ff2d72b4854cc74820f8e7ea871f538b440791e79b5132fd0b3a161d85
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]: http://www.w3.org/TR/REC-rdf-syntax/ "RDF/XML Syntax Specification"
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.3
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
@@ -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
- @attributes = @options[:attributes] || :none
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
- :object => objects.first,
263
- :predicate => predicate,
264
- :property => get_qname(predicate),
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
- :list => list,
289
- :predicate => predicate,
290
- :property => get_qname(predicate),
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.3
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: 2014-10-06 00:00:00.000000000 Z
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.2.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.