rdf-rdfa 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-rdfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
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: 2011-09-14 00:00:00.000000000 Z
13
+ date: 2011-11-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdf
17
- requirement: &2165534840 !ruby/object:Gem::Requirement
17
+ requirement: &2161384300 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.3.3
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2165534840
25
+ version_requirements: *2161384300
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: haml
28
- requirement: &2165533600 !ruby/object:Gem::Requirement
28
+ requirement: &2161383420 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,32 +33,76 @@ dependencies:
33
33
  version: 3.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2165533600
36
+ version_requirements: *2161383420
37
37
  - !ruby/object:Gem::Dependency
38
- name: nokogiri
39
- requirement: &2165532460 !ruby/object:Gem::Requirement
38
+ name: facets
39
+ requirement: &2161370720 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
43
43
  - !ruby/object:Gem::Version
44
- version: 1.4.4
44
+ version: 2.9.1
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2165532460
47
+ version_requirements: *2161370720
48
48
  - !ruby/object:Gem::Dependency
49
- name: facets
50
- requirement: &2165508060 !ruby/object:Gem::Requirement
49
+ name: rdf-xsd
50
+ requirement: &2161369720 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
54
54
  - !ruby/object:Gem::Version
55
- version: 2.9.1
55
+ version: 0.3.5
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: *2161369720
59
+ - !ruby/object:Gem::Dependency
60
+ name: htmlentities
61
+ requirement: &2161368560 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: 4.3.0
56
67
  type: :runtime
57
68
  prerelease: false
58
- version_requirements: *2165508060
69
+ version_requirements: *2161368560
70
+ - !ruby/object:Gem::Dependency
71
+ name: nokogiri
72
+ requirement: &2161367940 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 1.4.4
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *2161367940
81
+ - !ruby/object:Gem::Dependency
82
+ name: equivalent-xml
83
+ requirement: &2161367160 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: 0.2.8
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *2161367160
92
+ - !ruby/object:Gem::Dependency
93
+ name: open-uri-cached
94
+ requirement: &2161366120 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: 0.0.4
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: *2161366120
59
103
  - !ruby/object:Gem::Dependency
60
104
  name: spira
61
- requirement: &2165506740 !ruby/object:Gem::Requirement
105
+ requirement: &2161365500 !ruby/object:Gem::Requirement
62
106
  none: false
63
107
  requirements:
64
108
  - - ! '>='
@@ -66,10 +110,10 @@ dependencies:
66
110
  version: 0.0.12
67
111
  type: :development
68
112
  prerelease: false
69
- version_requirements: *2165506740
113
+ version_requirements: *2161365500
70
114
  - !ruby/object:Gem::Dependency
71
115
  name: rspec
72
- requirement: &2165505420 !ruby/object:Gem::Requirement
116
+ requirement: &2161364820 !ruby/object:Gem::Requirement
73
117
  none: false
74
118
  requirements:
75
119
  - - ! '>='
@@ -77,10 +121,10 @@ dependencies:
77
121
  version: 2.5.0
78
122
  type: :development
79
123
  prerelease: false
80
- version_requirements: *2165505420
124
+ version_requirements: *2161364820
81
125
  - !ruby/object:Gem::Dependency
82
126
  name: rdf-spec
83
- requirement: &2165503180 !ruby/object:Gem::Requirement
127
+ requirement: &2161363480 !ruby/object:Gem::Requirement
84
128
  none: false
85
129
  requirements:
86
130
  - - ! '>='
@@ -88,10 +132,10 @@ dependencies:
88
132
  version: 0.3.2
89
133
  type: :development
90
134
  prerelease: false
91
- version_requirements: *2165503180
135
+ version_requirements: *2161363480
92
136
  - !ruby/object:Gem::Dependency
93
137
  name: rdf-turtle
94
- requirement: &2165501920 !ruby/object:Gem::Requirement
138
+ requirement: &2161361320 !ruby/object:Gem::Requirement
95
139
  none: false
96
140
  requirements:
97
141
  - - ! '>='
@@ -99,10 +143,10 @@ dependencies:
99
143
  version: 0.1.0
100
144
  type: :development
101
145
  prerelease: false
102
- version_requirements: *2165501920
146
+ version_requirements: *2161361320
103
147
  - !ruby/object:Gem::Dependency
104
148
  name: rdf-rdfxml
105
- requirement: &2165500860 !ruby/object:Gem::Requirement
149
+ requirement: &2161359740 !ruby/object:Gem::Requirement
106
150
  none: false
107
151
  requirements:
108
152
  - - ! '>='
@@ -110,10 +154,10 @@ dependencies:
110
154
  version: 0.3.4
111
155
  type: :development
112
156
  prerelease: false
113
- version_requirements: *2165500860
157
+ version_requirements: *2161359740
114
158
  - !ruby/object:Gem::Dependency
115
159
  name: rdf-isomorphic
116
- requirement: &2165495300 !ruby/object:Gem::Requirement
160
+ requirement: &2161358080 !ruby/object:Gem::Requirement
117
161
  none: false
118
162
  requirements:
119
163
  - - ! '>='
@@ -121,10 +165,10 @@ dependencies:
121
165
  version: 0.3.4
122
166
  type: :development
123
167
  prerelease: false
124
- version_requirements: *2165495300
168
+ version_requirements: *2161358080
125
169
  - !ruby/object:Gem::Dependency
126
170
  name: sparql
127
- requirement: &2165494580 !ruby/object:Gem::Requirement
171
+ requirement: &2161357100 !ruby/object:Gem::Requirement
128
172
  none: false
129
173
  requirements:
130
174
  - - ! '>='
@@ -132,10 +176,10 @@ dependencies:
132
176
  version: 0.0.2
133
177
  type: :development
134
178
  prerelease: false
135
- version_requirements: *2165494580
179
+ version_requirements: *2161357100
136
180
  - !ruby/object:Gem::Dependency
137
181
  name: yard
138
- requirement: &2165493880 !ruby/object:Gem::Requirement
182
+ requirement: &2161355420 !ruby/object:Gem::Requirement
139
183
  none: false
140
184
  requirements:
141
185
  - - ! '>='
@@ -143,7 +187,7 @@ dependencies:
143
187
  version: 0.6.0
144
188
  type: :development
145
189
  prerelease: false
146
- version_requirements: *2165493880
190
+ version_requirements: *2161355420
147
191
  description: RDF::RDFa is an RDFa reader/writer for Ruby using the RDF.rb library
148
192
  suite.
149
193
  email: public-rdf-ruby@w3.org
@@ -167,12 +211,12 @@ files:
167
211
  - lib/rdf/rdfa/expansion/v.rb
168
212
  - lib/rdf/rdfa/expansion.rb
169
213
  - lib/rdf/rdfa/format.rb
170
- - lib/rdf/rdfa/patches/literal_hacks.rb
171
- - lib/rdf/rdfa/patches/nokogiri_hacks.rb
172
214
  - lib/rdf/rdfa/patches/string_hacks.rb
173
215
  - lib/rdf/rdfa/profile/xhtml.rb
174
216
  - lib/rdf/rdfa/profile/xml.rb
175
217
  - lib/rdf/rdfa/profile.rb
218
+ - lib/rdf/rdfa/reader/nokogiri.rb
219
+ - lib/rdf/rdfa/reader/rexml.rb
176
220
  - lib/rdf/rdfa/reader.rb
177
221
  - lib/rdf/rdfa/version.rb
178
222
  - lib/rdf/rdfa/vocab.rb
@@ -205,3 +249,4 @@ signing_key:
205
249
  specification_version: 3
206
250
  summary: RDFa reader/writer for RDF.rb.
207
251
  test_files: []
252
+ has_rdoc: false
@@ -1,156 +0,0 @@
1
- # Use Nokogiri or LibXML when available, and REXML otherwise:
2
- begin
3
- require 'nokogiri'
4
- rescue LoadError => e
5
- begin
6
- require 'libxml'
7
- rescue LoadError => e
8
- :rexml
9
- end
10
- end
11
-
12
- module RDF; class Literal
13
- ##
14
- # An XML literal.
15
- #
16
- # @see http://www.w3.org/TR/rdf-concepts/#section-XMLLiteral
17
- # @see http://www.w3.org/TR/rdfa-core/#s_xml_literals
18
- # @since 0.2.1
19
- class XML < Literal
20
- ##
21
- # @param [Object] value
22
- # @option options [String] :lexical (nil)
23
- # @option options [Hash] :namespaces ({}) Use "" to declare default namespace
24
- # @option options [Symbol] :language (nil)
25
- # @option options [:nokogiri, :libxml, or :rexml] :library
26
- def initialize(value, options = {})
27
- options[:namespaces] ||= {}
28
-
29
- @library = case options[:library]
30
- when nil
31
- case
32
- when defined?(::Nokogiri) then :nokogiri
33
- when defined?(::LibXML) then :libxml
34
- else :rexml
35
- end
36
- when :nokogiri, :libxml, :rexml
37
- options[:library]
38
- else
39
- raise ArgumentError.new("expected :rexml, :libxml or :nokogiri, but got #{options[:library].inspect}")
40
- end
41
-
42
- @datatype = options[:datatype] || DATATYPE
43
- @string = options[:lexical] if options.has_key?(:lexical)
44
- @object = parse_value(value, options)
45
- @string = serialize_nodeset(@object)
46
- end
47
-
48
- ##
49
- # Converts the literal into its canonical lexical representation.
50
- #
51
- # @return [Literal]
52
- # @see http://www.w3.org/TR/xml-exc-c14n/
53
- def canonicalize
54
- # This is the opportunity to use exclusive canonicalization library
55
- self
56
- end
57
-
58
- ##
59
- # Returns the value as a string.
60
- #
61
- # @return [String]
62
- def to_s
63
- @string
64
- end
65
-
66
- private
67
-
68
- def parse_value(value, options)
69
- ns_hash = {}
70
- options[:namespaces].each_pair do |prefix, uri|
71
- prefix = prefix.to_s
72
- attr = prefix.empty? ? "xmlns" : "xmlns:#{prefix}"
73
- ns_hash[attr] = uri.to_s
74
- end
75
-
76
- case @library
77
- when :nokogiri then parse_value_nokogiri(value, ns_hash, options)
78
- when :libxml then parse_value_libxml(value, ns_hash, options)
79
- when :rexml then parse_value_rexml(value, ns_hash, options)
80
- else value.to_s
81
- end
82
- end
83
-
84
- def serialize_nodeset(object)
85
- case @library
86
- when :nokogiri then serialize_nodeset_nokogiri(object)
87
- when :libxml then serialize_nodeset_libxml(object)
88
- when :rexml then serialize_nodeset_rexml(object)
89
- else object
90
- end
91
- end
92
-
93
- # Nokogiri implementations
94
- if defined?(::Nokogiri)
95
- # A somewhat half-hearted attempt at C14N.
96
- # Main problem is that it promotes all namespaces to top element, instead of demoting them
97
- # to the required element, and does not properly order either namespaces or attributes.
98
- #
99
- # An open-issue in Nokogiri is to add support for C14N from the underlying libxml2 libraries.
100
- def parse_value_nokogiri(value, ns_hash, options)
101
- elements = if value.is_a?(Nokogiri::XML::NodeSet)
102
- value
103
- else
104
- ns_strs = []
105
- ns_hash.each_pair {|a, u| ns_strs << "#{a}=\"#{u}\""}
106
- # Add inherited namespaces to created root element so that they're inherited to sub-elements
107
- Nokogiri::XML::Document.parse("<foo #{ns_strs.join(" ")}>#{value.to_s}</foo>").root.children
108
- end
109
-
110
- elements.map do |c|
111
- if c.is_a?(Nokogiri::XML::Element)
112
- c = Nokogiri::XML.parse(c.dup.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS)).root
113
-
114
- # Apply defined namespaces
115
- ns_hash.each_pair do |prefix, href|
116
- c[prefix] = href unless c.namespaces[prefix]
117
- end
118
-
119
- # Add language
120
- if options[:language] && c["lang"].to_s.empty?
121
- c["xml:lang"] = options[:language].to_s
122
- end
123
- end
124
- c
125
- end
126
- end
127
-
128
- def serialize_nodeset_nokogiri(object)
129
- object.map {|c| c.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS)}.join("")
130
- end
131
- end # Nokogiri
132
-
133
- if defined?(::LibXML)
134
- # This should use Document#canonicalize if as and when it is available in libxml-ruby
135
- def parse_value_libxml(value, ns_strs, language)
136
- # Fixme
137
- end
138
-
139
- def serialize_nodeset_libxml(object)
140
- # Fixme
141
- end
142
- end # LibXML
143
-
144
- # REXML
145
- # This could make use of the XMLCanonicalizer gem (http://rubygems.org/gems/XMLCanonicalizer)
146
- # But, it hasn't been touched since 2007 and relies on log4r.
147
- def parse_value_rexml(value, ns_strs, language)
148
- # Fixme
149
- end
150
-
151
- def serialize_nodeset_rexml(object)
152
- # Fixme
153
- end
154
-
155
- end # class XML
156
- end; end
@@ -1,22 +0,0 @@
1
- require 'nokogiri'
2
- class Nokogiri::XML::Node
3
- # URI of namespace + node_name
4
- def uri
5
- ns = self.namespace ? self.namespace.href : RDF::XML.to_s
6
- RDF::URI.intern(ns + self.node_name)
7
- end
8
-
9
- def display_path
10
- @display_path ||= case self
11
- when Nokogiri::XML::Document then ""
12
- when Nokogiri::XML::Element then parent ? "#{parent.display_path}/#{name}" : name
13
- when Nokogiri::XML::Attr then "#{parent.display_path}@#{name}"
14
- end
15
- end
16
- end
17
-
18
- class Nokogiri::XML::Document
19
- def doctype
20
- self.children.first rescue false
21
- end
22
- end