rdf-rdfxml 2.0.0 → 2.1.0
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.rb +2 -2
- data/lib/rdf/rdfxml/reader/nokogiri.rb +9 -1
- data/lib/rdf/rdfxml/writer/haml_templates.rb +10 -5
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c09e2c03981f607db89feff748f72476728de1c7
|
4
|
+
data.tar.gz: 671669e3b8643b452e928c50f5735f0a9af723af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4aea12d47881ae63f93c4a74d4dde1e5620ee1637031ca1315d11150d7bfe6565e1330a5171d1dae5764923d6beb94bcad7d6fc1a08616aa178bad8bceda2e48
|
7
|
+
data.tar.gz: ca9dc408d616e72c3a6f7e2fede59cc9971ed790620f27f1921c9c817ad87d1a0daf9971cd5ffa1c6c271b63d4ac48fed232aebd7f541b7638705f504422553c
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Install with `gem install rdf-rdfxml`
|
|
18
18
|
|
19
19
|
* 100% free and unencumbered [public domain](http://unlicense.org/) software.
|
20
20
|
* Implements a complete parser for [RDF/XML][].
|
21
|
-
* Compatible with Ruby >= 2.
|
21
|
+
* Compatible with Ruby >= 2.2.2.
|
22
22
|
|
23
23
|
## Usage:
|
24
24
|
Instantiate a parser and parse source, specifying type and base-URL
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1.0
|
data/lib/rdf/rdfxml/reader.rb
CHANGED
@@ -337,8 +337,8 @@ module RDF::RDFXML
|
|
337
337
|
# Determine the content type of this property element
|
338
338
|
log_fatal "child must be a proxy not a #{child.class}" unless child.is_a?(@implementation::NodeProxy)
|
339
339
|
|
340
|
-
text_nodes = child.children.select
|
341
|
-
element_nodes = child.children.select
|
340
|
+
text_nodes = child.children.select(&:text?)
|
341
|
+
element_nodes = child.children.select(&:element?)
|
342
342
|
add_debug(child) {"#{text_nodes.to_a.length} text nodes, #{element_nodes.to_a.length} element nodes"}
|
343
343
|
|
344
344
|
text_nodes.each do |node|
|
@@ -81,6 +81,14 @@ module RDF::RDFXML
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
+
##
|
85
|
+
# Return true of this is a text node
|
86
|
+
#
|
87
|
+
# @return [Array<:text, :element, :attribute>]
|
88
|
+
def text?
|
89
|
+
(@node.text? || @node.cdata?) && !@node.blank?
|
90
|
+
end
|
91
|
+
|
84
92
|
##
|
85
93
|
# Return true of all child elements are text
|
86
94
|
#
|
@@ -104,7 +112,7 @@ module RDF::RDFXML
|
|
104
112
|
def children
|
105
113
|
@children ||= NodeSetProxy.new(@node.children, self)
|
106
114
|
end
|
107
|
-
|
115
|
+
|
108
116
|
# Ancestors of this element, in order
|
109
117
|
def ancestors
|
110
118
|
@ancestors ||= parent ? parent.ancestors + [parent] : []
|
@@ -38,7 +38,8 @@ module RDF::RDFXML
|
|
38
38
|
- if expanded_type.start_with?('_:')
|
39
39
|
- haml_tag(get_qname(RDF.type), "rdf:nodeID" => expanded_type[2..-1])
|
40
40
|
-else
|
41
|
-
-
|
41
|
+
- # FIXME: closing tag forces close tag, as :/ is not honored in 5.0.1
|
42
|
+
- haml_tag(get_qname(RDF.type), "", "rdf:resource" => expanded_type)
|
42
43
|
- predicates.each do |p|
|
43
44
|
= yield(p)
|
44
45
|
),
|
@@ -59,9 +60,11 @@ module RDF::RDFXML
|
|
59
60
|
- haml_tag(property, :"<", "xml:lang" => object.language, "rdf:datatype" => (object.datatype unless object.plain?)) do
|
60
61
|
= object.value.to_s.encode(xml: :text)
|
61
62
|
- elsif object.node?
|
62
|
-
-
|
63
|
+
- # FIXME: closing tag forces close tag, as :/ is not honored in 5.0.1
|
64
|
+
- haml_tag(property, "", "rdf:nodeID" => object.id)
|
63
65
|
- else
|
64
|
-
-
|
66
|
+
- # FIXME: closing tag forces close tag, as :/ is not honored in 5.0.1
|
67
|
+
- haml_tag(property, "", "rdf:resource" => relativize(object))
|
65
68
|
),
|
66
69
|
|
67
70
|
# Outpust for a list
|
@@ -75,9 +78,11 @@ module RDF::RDFXML
|
|
75
78
|
- if recurse && res = yield(object)
|
76
79
|
= res
|
77
80
|
- elsif object.node?
|
78
|
-
-
|
81
|
+
- # FIXME: closing tag forces close tag, as :/ is not honored in 5.0.1
|
82
|
+
- haml_tag(get_qname(RDF.Description), "", "rdf:nodeID" => (object.id if ref_count(object) > 1))
|
79
83
|
- else
|
80
|
-
-
|
84
|
+
- # FIXME: closing tag forces close tag, as :/ is not honored in 5.0.1
|
85
|
+
- haml_tag(get_qname(RDF.Description), "", "rdf:about" => relativize(object))
|
81
86
|
),
|
82
87
|
}
|
83
88
|
HAML_TEMPLATES = {base: BASE_HAML}
|
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: 2.
|
4
|
+
version: 2.1.0
|
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: 2017-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdf
|
@@ -247,7 +247,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
247
247
|
requirements:
|
248
248
|
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
|
-
version:
|
250
|
+
version: 2.2.2
|
251
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
252
|
requirements:
|
253
253
|
- - ">="
|
@@ -255,9 +255,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
255
|
version: '0'
|
256
256
|
requirements: []
|
257
257
|
rubyforge_project: rdf-rdfxml
|
258
|
-
rubygems_version: 2.
|
258
|
+
rubygems_version: 2.6.12
|
259
259
|
signing_key:
|
260
260
|
specification_version: 4
|
261
261
|
summary: RDF/XML reader/writer for RDF.rb.
|
262
262
|
test_files: []
|
263
|
-
has_rdoc: false
|