rdf-rdfa 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01d81ec1f8d8b64791be947449c08434ed7c6114
4
- data.tar.gz: 0ff8146b753c38d5cedc50774d2bf28c445489d7
3
+ metadata.gz: 584df353c1c28e5928ef57e6bec1702b9bc8cfb2
4
+ data.tar.gz: d0cf8f481a3656f58a6f33c9328e8573680248b0
5
5
  SHA512:
6
- metadata.gz: 0c3a56592cb54716af54e48aae735a03301cd160a05e32e183b4a467ae8d57496d6653970e17cef280df52e076e5fa8325acf6ffac45125976d262c40d1a1c70
7
- data.tar.gz: 2f366a57af1e44246482fa5ad810ac5983b8b6a69bbc9e50b08d79d56f8147611d40d4767568a01d07493e5f5a8d93263c892d304fd107b752e8d90091971443
6
+ metadata.gz: fcfa4f91f203b424b64c31fc7964fd91ddd9d3d47df45ae3ad73ef756a455ee38213a1b3bada828d06111035799c74bd188489a8db0e2000fa10a10dfeecfa48
7
+ data.tar.gz: 4658e9dd89b9cd349a067be9ffcae9ee7314df85894e4b489874785522d55e09d6821f4381bbab137eee0929f6da4926c2b19e6eb8f9656e637b08d2bf4c5c9a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.2
1
+ 2.2.3
@@ -31,9 +31,9 @@ module RDF
31
31
  autoload :Reader, 'rdf/rdfa/reader'
32
32
  autoload :Writer, 'rdf/rdfa/writer'
33
33
  autoload :VERSION, 'rdf/rdfa/version'
34
-
34
+
35
35
  HTML_RDFA_CONTEXT = "http://www.w3.org/2011/rdfa-context/html-rdfa-1.1"
36
36
  XHTML_RDFA_CONTEXT = "http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1"
37
37
  XML_RDFA_CONTEXT = "http://www.w3.org/2011/rdfa-context/rdfa-1.1"
38
38
  end
39
- end
39
+ end
@@ -19,7 +19,7 @@ module RDF::RDFa
19
19
  # @!attribute [r] terms
20
20
  # @return [Hash{Symbol => RDF::URI}]
21
21
  attr_reader :terms
22
-
22
+
23
23
  # Default URI defined for this vocabulary
24
24
  # @!attribute [r] vocabulary
25
25
  # @return [RDF::URI]
@@ -29,7 +29,7 @@ module RDF::RDFa
29
29
  # @!attribute [r] uri
30
30
  # @return [RDF::URI]
31
31
  attr_reader :uri
32
-
32
+
33
33
  ##
34
34
  # Initialize a new context from the given URI.
35
35
  #
@@ -46,11 +46,11 @@ module RDF::RDFa
46
46
  @terms = options.fetch(:terms, {})
47
47
  @vocabulary = options[:vocabulary]
48
48
  @options = options.dup
49
-
49
+
50
50
  yield(self) if block_given?
51
51
  self
52
52
  end
53
-
53
+
54
54
  ##
55
55
  # @return [RDF::Util::Cache]
56
56
  # @private
@@ -67,7 +67,7 @@ module RDF::RDFa
67
67
  def self.repository
68
68
  @repository ||= RDF::Repository.new(title: "RDFa Contexts")
69
69
  end
70
-
70
+
71
71
  ##
72
72
  # Set repository used for saving contexts
73
73
  # @param [RDF::Repository] repo
@@ -82,14 +82,14 @@ module RDF::RDFa
82
82
  end
83
83
  @repository = repo
84
84
  end
85
-
85
+
86
86
  # Return a context faulting through the cache
87
87
  # @return [RDF::RDFa::Context]
88
88
  def self.find(uri)
89
89
  uri = RDF::URI.intern(uri)
90
-
90
+
91
91
  return cache[uri] unless cache[uri].nil?
92
-
92
+
93
93
  # Two part creation to prevent re-entrancy problems if p1 => p2 and p2 => p1
94
94
  # Return something to make the caller happy if we're re-entered
95
95
  cache[uri] = Struct.new(:prefixes, :terms, :vocabulary).new({}, {}, nil)
@@ -112,12 +112,12 @@ module RDF::RDFa
112
112
  uri = RDF::URI.intern(uri)
113
113
  repository.load(uri.to_s, base_uri: uri, graph_name: uri) unless repository.has_graph?(uri)
114
114
  end
115
-
115
+
116
116
  # @return [RDF::Repository]
117
117
  def repository
118
118
  Context.repository
119
119
  end
120
-
120
+
121
121
  ##
122
122
  # Defines the given named URI prefix for this context.
123
123
  #
@@ -151,7 +151,7 @@ module RDF::RDFa
151
151
  name = name.to_s.empty? ? nil : (name.respond_to?(:to_sym) ? name.to_sym : name.to_s.to_sym)
152
152
  uri.nil? ? terms[name] : terms[name] = uri
153
153
  end
154
-
154
+
155
155
  ##
156
156
  # Extract vocabulary, prefix mappings and terms from a enumerable object into an instance
157
157
  #
@@ -179,14 +179,14 @@ module RDF::RDFa
179
179
  log_debug("process_context: uri=#{uri.inspect}, term=#{term.inspect}, prefix=#{prefix.inspect}, vocabulary=#{vocab.inspect}") if respond_to?(:log_debug)
180
180
 
181
181
  @vocabulary = vocab if vocab
182
-
182
+
183
183
  # For every extracted triple that is the common subject of an rdfa:prefix and an rdfa:uri
184
184
  # predicate, create a mapping from the object literal of the rdfa:prefix predicate to the
185
185
  # object literal of the rdfa:uri predicate. Add or update this mapping in the local list of
186
186
  # URI mappings after transforming the 'prefix' component to lower-case.
187
187
  # For every extracted
188
188
  prefix(prefix.downcase, uri) if uri && prefix && prefix != "_"
189
-
189
+
190
190
  # triple that is the common subject of an rdfa:term and an rdfa:uri predicate, create a
191
191
  # mapping from the object literal of the rdfa:term predicate to the object literal of the
192
192
  # rdfa:uri predicate. Add or update this mapping in the local term mappings.
@@ -108,7 +108,7 @@ module RDF::RDFa
108
108
  def consequent(subject, prediate, object)
109
109
  consequents << RDF::Query::Pattern.new(subject, prediate, object)
110
110
  end
111
-
111
+
112
112
  ##
113
113
  # Execute the rule against queryable, yielding each consequent with bindings
114
114
  #
@@ -227,7 +227,7 @@ module RDF::RDFa
227
227
  to_add << statement
228
228
  end
229
229
  end
230
-
230
+
231
231
  repository.insert(*to_add)
232
232
  end
233
233
  end
@@ -250,7 +250,7 @@ module RDF::RDFa
250
250
  to_add << statement
251
251
  end
252
252
  end
253
-
253
+
254
254
  repository.insert(*to_add)
255
255
  end
256
256
 
@@ -6,4 +6,4 @@ class ::String
6
6
  ws = str.match(/^(\s*)\S/m) ? $1 : ''
7
7
  str.gsub(/^#{ws}/m, '')
8
8
  end
9
- end
9
+ end
@@ -31,7 +31,7 @@ module RDF::RDFa
31
31
  include RDF::Util::Logger
32
32
 
33
33
  XHTML = "http://www.w3.org/1999/xhtml"
34
-
34
+
35
35
  # Content model for @about and @resource. In RDFa 1.0, this was URIorSafeCURIE
36
36
  SafeCURIEorCURIEorIRI = {
37
37
  :"rdfa1.0" => [:safe_curie, :uri, :bnode],
@@ -83,17 +83,17 @@ module RDF::RDFa
83
83
  # @!attribute [r] host_language
84
84
  # @return [:xml, :xhtml1, :xhtml5, :html4, :html5, :svg]
85
85
  attr_reader :host_language
86
-
86
+
87
87
  # Version
88
88
  # @!attribute [r] version
89
89
  # @return [:"rdfa1.0", :"rdfa1.1"]
90
90
  attr_reader :version
91
-
91
+
92
92
  # Repository used for collecting triples.
93
93
  # @!attribute [r] repository
94
94
  # @return [RDF::Repository]
95
95
  attr_reader :repository
96
-
96
+
97
97
  # Returns the XML implementation module for this reader instance.
98
98
  #
99
99
  # @!attribute [rw] implementation
@@ -124,7 +124,7 @@ module RDF::RDFa
124
124
  # @!attribute [rw] parent_subject
125
125
  # @return [RDF::URI]
126
126
  attr_accessor :parent_subject
127
-
127
+
128
128
  ##
129
129
  # The parent object.
130
130
  #
@@ -138,14 +138,14 @@ module RDF::RDFa
138
138
  # @!attribute [rw] parent_object
139
139
  # @return [RDF::URI]
140
140
  attr_accessor :parent_object
141
-
141
+
142
142
  ##
143
143
  # A list of current, in-scope URI mappings.
144
144
  #
145
145
  # @!attribute [rw] uri_mappings
146
146
  # @return [Hash{Symbol => String}]
147
147
  attr_accessor :uri_mappings
148
-
148
+
149
149
  ##
150
150
  # A list of current, in-scope Namespaces. This is the subset of uri_mappings
151
151
  # which are defined using xmlns.
@@ -153,7 +153,7 @@ module RDF::RDFa
153
153
  # @!attribute [rw] namespaces
154
154
  # @return [Hash{String => Namespace}]
155
155
  attr_accessor :namespaces
156
-
156
+
157
157
  ##
158
158
  # A list of incomplete triples.
159
159
  #
@@ -165,14 +165,14 @@ module RDF::RDFa
165
165
  # @!attribute [rw] incomplete_triples
166
166
  # @return [Array<Array<RDF::URI, RDF::Resource>>]
167
167
  attr_accessor :incomplete_triples
168
-
168
+
169
169
  ##
170
170
  # The language. Note that there is no default language.
171
171
  #
172
172
  # @!attribute [rw] language
173
173
  # @return [Symbol]
174
174
  attr_accessor :language
175
-
175
+
176
176
  ##
177
177
  # The term mappings, a list of terms and their associated URIs.
178
178
  #
@@ -183,7 +183,7 @@ module RDF::RDFa
183
183
  # @!attribute [rw] term_mappings
184
184
  # @return [Hash{Symbol => RDF::URI}]
185
185
  attr_accessor :term_mappings
186
-
186
+
187
187
  ##
188
188
  # The default vocabulary
189
189
  #
@@ -230,7 +230,7 @@ module RDF::RDFa
230
230
  @namespaces = from.namespaces.clone
231
231
  @list_mapping = from.list_mapping # Don't clone
232
232
  end
233
-
233
+
234
234
  def inspect
235
235
  v = ['base', 'parent_subject', 'parent_object', 'language', 'default_vocabulary'].map do |a|
236
236
  "#{a}=#{o = self.send(a); o.respond_to?(:to_ntriples) ? o.to_ntriples : o.inspect}"
@@ -329,7 +329,19 @@ module RDF::RDFa
329
329
 
330
330
  detect_host_language_version(input, options)
331
331
 
332
- add_info(@doc, "version = #{@version}, host_language = #{@host_language}, library = #{@library}, rdfagraph = #{@options[:rdfagraph].inspect}, expand = #{@options[:vocab_expansion]}")
332
+ parse_lib = if @library == :nokogiri && @host_language == :html5
333
+ begin
334
+ require 'nokogumbo' unless defined?(::Nokogumbo)
335
+ :nokobumbo
336
+ rescue LoadError
337
+ :nokogiri
338
+ end
339
+ else
340
+ @library
341
+ end
342
+
343
+ parse_lib = @library == :nokogiri && defined?(::Nokogumbo) ? :nokogumbo : @library
344
+ add_info(@doc, "version = #{@version}, host_language = #{@host_language}, library = #{parse_lib}, rdfagraph = #{@options[:rdfagraph].inspect}, expand = #{@options[:vocab_expansion]}")
333
345
 
334
346
  begin
335
347
  initialize_xml(input, options)
@@ -419,7 +431,7 @@ module RDF::RDFa
419
431
  add_debug(el, "=> no reader found")
420
432
  end
421
433
  end
422
-
434
+
423
435
  # Look for Embedded RDF/XML
424
436
  unless @root.xpath("//rdf:RDF", "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#").empty?
425
437
  extract_script(@root, @doc, "application/rdf+xml", @options) do |statement|
@@ -437,7 +449,7 @@ module RDF::RDFa
437
449
  @repository << statement
438
450
  end
439
451
  end
440
-
452
+
441
453
  # Look for Embedded microdata
442
454
  unless @root.xpath("//@itemscope").empty?
443
455
  begin
@@ -454,7 +466,7 @@ module RDF::RDFa
454
466
 
455
467
  # Perform vocabulary expansion
456
468
  expand(@repository) if @options[:vocab_expansion]
457
-
469
+
458
470
  @processed = true
459
471
  end
460
472
 
@@ -493,7 +505,7 @@ module RDF::RDFa
493
505
  end
494
506
  enum_for(:each_triple)
495
507
  end
496
-
508
+
497
509
  private
498
510
 
499
511
  # Keep track of allocated BNodes
@@ -501,12 +513,12 @@ module RDF::RDFa
501
513
  @bnode_cache ||= {}
502
514
  @bnode_cache[value.to_s] ||= RDF::Node.new(value)
503
515
  end
504
-
516
+
505
517
  # Figure out the document path, if it is an Element or Attribute
506
518
  def node_path(node)
507
519
  "<#{base_uri}>#{node.respond_to?(:display_path) ? node.display_path : node}"
508
520
  end
509
-
521
+
510
522
  # Add debug event to debug array, if specified
511
523
  #
512
524
  # @param [#display_path, #to_s] node XML Node or string for showing context
@@ -519,15 +531,15 @@ module RDF::RDFa
519
531
  def add_info(node, message, process_class = RDF::RDFA.Info, &block)
520
532
  add_processor_message(node, message, process_class, &block)
521
533
  end
522
-
534
+
523
535
  def add_warning(node, message, process_class = RDF::RDFA.Warning)
524
536
  add_processor_message(node, message, process_class)
525
537
  end
526
-
538
+
527
539
  def add_error(node, message, process_class = RDF::RDFA.Error)
528
540
  add_processor_message(node, message, process_class)
529
541
  end
530
-
542
+
531
543
  def add_processor_message(node, message, process_class, &block)
532
544
  case process_class
533
545
  when RDF::RDFA.Error then log_error(node_path(node), message, &block)
@@ -552,7 +564,7 @@ module RDF::RDFa
552
564
  RDF::Statement.new(nc, RDF::PTR.expression, node.path, graph_name: RDF::RDFA.ProcessorGraph)
553
565
  ]
554
566
  end
555
-
567
+
556
568
  @repository.insert(*processor_statements)
557
569
  if cb = @options[:processor_callback]
558
570
  processor_statements.each {|s| cb.call(s)}
@@ -591,7 +603,7 @@ module RDF::RDFa
591
603
 
592
604
  # initialize the evaluation context with the appropriate base
593
605
  evaluation_context = EvaluationContext.new(base, @host_defaults)
594
-
606
+
595
607
  if @version != :"rdfa1.0"
596
608
  # Process default vocabularies
597
609
  load_initial_contexts(@host_defaults[:initial_contexts]) do |which, value|
@@ -603,11 +615,11 @@ module RDF::RDFa
603
615
  end
604
616
  end
605
617
  end
606
-
618
+
607
619
  traverse(root, evaluation_context)
608
620
  add_debug("", "parse_whole_doc: traversal complete'")
609
621
  end
610
-
622
+
611
623
  # Parse and process URI mappings, Term mappings and a default vocabulary from @context
612
624
  #
613
625
  # Yields each mapping
@@ -725,7 +737,7 @@ module RDF::RDFa
725
737
  add_error(element, "Can't parse nil element")
726
738
  return nil
727
739
  end
728
-
740
+
729
741
  add_debug(element) { "ec: #{evaluation_context.inspect}" }
730
742
 
731
743
  # local variables [7.5 Step 1]
@@ -807,12 +819,12 @@ module RDF::RDFa
807
819
  "[Step 2] default_vocaulary: #{default_vocabulary.inspect}"
808
820
  }
809
821
  end
810
-
822
+
811
823
  # Local term mappings [7.5 Step 3]
812
824
  # Next, the current element is then examined for URI mapping s and these are added to the local list of URI mappings.
813
825
  # Note that a URI mapping will simply overwrite any current mapping in the list that has the same name
814
826
  extract_mappings(element, uri_mappings, namespaces)
815
-
827
+
816
828
  # Language information [7.5 Step 4]
817
829
  language = element.language || language
818
830
  language = nil if language.to_s.empty?
@@ -844,14 +856,14 @@ module RDF::RDFa
844
856
  term_mappings: term_mappings,
845
857
  vocab: default_vocabulary,
846
858
  restrictions: TERMorCURIEorAbsIRI.fetch(@version, []))
847
-
859
+
848
860
  add_debug(element) do
849
861
  "rels: #{rels.join(" ")}, revs: #{revs.join(" ")}"
850
862
  end unless (rels + revs).empty?
851
863
 
852
864
  if !(attrs[:rel] || attrs[:rev])
853
865
  # Establishing a new subject if no rel/rev [7.5 Step 5]
854
-
866
+
855
867
  if @version == :"rdfa1.0"
856
868
  new_subject = if attrs[:about]
857
869
  process_uri(element, attrs[:about], evaluation_context, base,
@@ -989,7 +1001,7 @@ module RDF::RDFa
989
1001
  new_subject ||= process_uri(element, attrs[:src], evaluation_context, base,
990
1002
  uri_mappings: uri_mappings,
991
1003
  restrictions: [:uri]) if @version == :"rdfa1.0"
992
-
1004
+
993
1005
  # if the @typeof attribute is present, set typed resource to new subject
994
1006
  typed_resource = new_subject if attrs[:typeof]
995
1007
 
@@ -1008,7 +1020,7 @@ module RDF::RDFa
1008
1020
  evaluation_context.parent_object
1009
1021
  # no skip flag set this time
1010
1022
  end
1011
-
1023
+
1012
1024
  # Then the current object resource is set to the URI obtained from the first match from the following rules:
1013
1025
  current_object_resource = process_uri(element, attrs[:resource], evaluation_context, base,
1014
1026
  uri_mappings: uri_mappings,
@@ -1034,7 +1046,7 @@ module RDF::RDFa
1034
1046
  "typed_resource: #{typed_resource.to_ntriples rescue 'nil'}, "
1035
1047
  }
1036
1048
  end
1037
-
1049
+
1038
1050
  # [Step 7] If in any of the previous steps a typed resource was set to a non-null value, it is now used to provide a subject for type values;
1039
1051
  if typed_resource
1040
1052
  # Typeof is TERMorCURIEorAbsIRIs
@@ -1082,7 +1094,7 @@ module RDF::RDFa
1082
1094
  add_triple(element, new_subject, r, current_object_resource)
1083
1095
  end
1084
1096
  end
1085
-
1097
+
1086
1098
  revs.each do |r|
1087
1099
  add_triple(element, current_object_resource, r, new_subject)
1088
1100
  end
@@ -1090,7 +1102,7 @@ module RDF::RDFa
1090
1102
  # Incomplete triples and bnode creation [Step 10]
1091
1103
  add_debug(element) {"[Step 10] incompletes: rels: #{rels}, revs: #{revs}"}
1092
1104
  current_object_resource = RDF::Node.new
1093
-
1105
+
1094
1106
  # predicate: full IRI
1095
1107
  # direction: forward/reverse
1096
1108
  # lists: Save into list, don't generate triple
@@ -1108,12 +1120,12 @@ module RDF::RDFa
1108
1120
  incomplete_triples << {predicate: r, direction: :forward}
1109
1121
  end
1110
1122
  end
1111
-
1123
+
1112
1124
  revs.each do |r|
1113
1125
  incomplete_triples << {predicate: r, direction: :reverse}
1114
1126
  end
1115
1127
  end
1116
-
1128
+
1117
1129
  # Establish current object literal [Step 11]
1118
1130
  #
1119
1131
  # If the current element has a @inlist attribute, add the property to the
@@ -1267,11 +1279,11 @@ module RDF::RDFa
1267
1279
  add_debug(element) {"[Step 11] add #{current_property_value.to_ntriples} to #{p.to_ntriples} #{list_mapping[p].inspect}"}
1268
1280
  list_mapping[p] << current_property_value
1269
1281
  elsif new_subject
1270
- add_triple(element, new_subject, p, current_property_value)
1282
+ add_triple(element, new_subject, p, current_property_value)
1271
1283
  end
1272
1284
  end
1273
1285
  end
1274
-
1286
+
1275
1287
  if !skip and new_subject && !evaluation_context.incomplete_triples.empty?
1276
1288
  # Complete the incomplete triples from the evaluation context [Step 12]
1277
1289
  add_debug(element) do
@@ -1329,12 +1341,12 @@ module RDF::RDFa
1329
1341
  new_ec.list_mapping = list_mapping
1330
1342
  add_debug(element, "[Step 13] new ec")
1331
1343
  end
1332
-
1344
+
1333
1345
  element.children.each do |child|
1334
1346
  # recurse only if it's an element
1335
1347
  traverse(child, new_ec) if child.element?
1336
1348
  end
1337
-
1349
+
1338
1350
  # Step 14: after traversing through child elements, for each list associated with
1339
1351
  # a property
1340
1352
  (list_mapping || {}).each do |p, l|
@@ -1444,7 +1456,7 @@ module RDF::RDFa
1444
1456
  add_warning(element, "Relative URI #{value}")
1445
1457
  end
1446
1458
  end
1447
-
1459
+
1448
1460
  # [7.4.3] General Use of Terms in Attributes
1449
1461
  def process_term(element, value, options)
1450
1462
  if options[:vocab]
@@ -1453,7 +1465,7 @@ module RDF::RDFa
1453
1465
  elsif options[:term_mappings].is_a?(Hash)
1454
1466
  # If the term is in the local term mappings, use the associated URI (case sensitive).
1455
1467
  return uri(options[:term_mappings][value.to_s.to_sym]) if options[:term_mappings].has_key?(value.to_s.to_sym)
1456
-
1468
+
1457
1469
  # Otherwise, check for case-insensitive match
1458
1470
  options[:term_mappings].each_pair do |term, uri|
1459
1471
  return uri(uri) if term.to_s.downcase == value.to_s.downcase
@@ -82,7 +82,7 @@ module RDF::RDFa
82
82
  def namespaces
83
83
  @node.namespace_definitions.inject({}) {|memo, ns| memo[ns.prefix] = ns.href.to_s; memo }
84
84
  end
85
-
85
+
86
86
  ##
87
87
  # Children of this node
88
88
  #
@@ -168,7 +168,7 @@ module RDF::RDFa
168
168
  else
169
169
  # Try to detect charset from input
170
170
  options[:encoding] ||= input.charset if input.respond_to?(:charset)
171
-
171
+
172
172
  # Otherwise, default is utf-8
173
173
  options[:encoding] ||= 'utf-8'
174
174
  options[:encoding] = options[:encoding].to_s if options[:encoding]
@@ -277,13 +277,13 @@ module RDF::RDFa
277
277
  end
278
278
 
279
279
  # Accessor methods to mask native elements & attributes
280
-
280
+
281
281
  ##
282
282
  # Return proxy for document root
283
283
  def root
284
284
  @root ||= NodeProxy.new(@doc.root) if @doc && @doc.root
285
285
  end
286
-
286
+
287
287
  ##
288
288
  # Document errors
289
289
  def doc_errors
@@ -295,7 +295,7 @@ module RDF::RDFa
295
295
  @doc.errors.reject {|e| e.to_s =~ /(?:Tag \w+ invalid)|(?:Missing attribute name)/}
296
296
  end
297
297
  end
298
-
298
+
299
299
  ##
300
300
  # Find value of document base
301
301
  #
@@ -305,13 +305,13 @@ module RDF::RDFa
305
305
  # find if the document has a base element
306
306
  case @host_language
307
307
  when :xhtml1, :xhtml5, :html4, :html5
308
- base_el = @doc.at_css("html>head>base")
308
+ base_el = @doc.at_css("html>head>base")
309
309
  base = base_el.attribute("href").to_s.split("#").first if base_el
310
310
  else
311
311
  xml_base = root.attribute_with_ns("base", RDF::XML.to_s) if root
312
312
  base = xml_base if xml_base
313
313
  end
314
-
314
+
315
315
  base
316
316
  end
317
317
  end
@@ -85,7 +85,7 @@ module RDF::RDFa
85
85
  end
86
86
  ns_decls
87
87
  end
88
-
88
+
89
89
  ##
90
90
  # Children of this node
91
91
  #
@@ -93,7 +93,7 @@ module RDF::RDFa
93
93
  def children
94
94
  NodeSetProxy.new(@node.children, self)
95
95
  end
96
-
96
+
97
97
  # Ancestors of this element, in order
98
98
  def ancestors
99
99
  @ancestors ||= parent ? parent.ancestors + [parent] : []
@@ -166,7 +166,7 @@ module RDF::RDFa
166
166
  @node.send(method, *args)
167
167
  end
168
168
  end
169
-
169
+
170
170
  ##
171
171
  # NodeSet proxy
172
172
  class NodeSetProxy
@@ -214,7 +214,7 @@ module RDF::RDFa
214
214
  else
215
215
  # Try to detect charset from input
216
216
  options[:encoding] ||= input.charset if input.respond_to?(:charset)
217
-
217
+
218
218
  # Otherwise, default is utf-8
219
219
  options[:encoding] ||= 'utf-8'
220
220
 
@@ -306,19 +306,19 @@ module RDF::RDFa
306
306
  end
307
307
 
308
308
  # Accessor methods to mask native elements & attributes
309
-
309
+
310
310
  ##
311
311
  # Return proxy for document root
312
312
  def root
313
313
  @root ||= NodeProxy.new(@doc.root) if @doc && @doc.root
314
314
  end
315
-
315
+
316
316
  ##
317
317
  # Document errors
318
318
  def doc_errors
319
319
  []
320
320
  end
321
-
321
+
322
322
  ##
323
323
  # Find value of document base
324
324
  #
@@ -334,7 +334,7 @@ module RDF::RDFa
334
334
  xml_base = root.attribute("base", RDF::XML.to_s) if root
335
335
  base = xml_base if xml_base
336
336
  end
337
-
337
+
338
338
  base || @base_uri
339
339
  end
340
340
  end
@@ -63,7 +63,9 @@ module RDF::RDFa
63
63
  # @return [Array<URI>]
64
64
  attr :heading_predicates
65
65
 
66
- HAML_OPTIONS = {}
66
+ HAML_OPTIONS = {
67
+ format: :xhtml
68
+ }
67
69
 
68
70
  # @return [Graph] Graph of statements serialized
69
71
  attr_accessor :graph
@@ -629,7 +631,7 @@ module RDF::RDFa
629
631
  end
630
632
  end
631
633
 
632
- # Haml rendering helper. Display value for object, may be humanized into a non-canonical form
634
+ # Haml rendering helper. Display value for object, may be humanized into a non-canonical form
633
635
  #
634
636
  # @param [RDF::Literal] literal
635
637
  # @return [String]
@@ -3,7 +3,7 @@ module RDF::RDFa
3
3
  class Writer
4
4
  # The default set of HAML templates used for RDFa code generation
5
5
  BASE_HAML = {
6
- identifier: "base",
6
+ identifier: "base",
7
7
  # Document
8
8
  # Locals: language, title, prefix, base, subjects
9
9
  # Yield: subjects.each
@@ -99,7 +99,7 @@ module RDF::RDFa
99
99
  # This version does not perform recursive object generation and does not attempt
100
100
  # to create human readable output.
101
101
  MIN_HAML = {
102
- identifier: "min",
102
+ identifier: "min",
103
103
  # Document
104
104
  # Locals: language, title, prefix, base, subjects
105
105
  # Yield: subjects.each
@@ -149,7 +149,7 @@ module RDF::RDFa
149
149
  }
150
150
 
151
151
  DISTILLER_HAML = {
152
- identifier: "distiller",
152
+ identifier: "distiller",
153
153
  # Document
154
154
  # Locals: language, title, prefix, base, subjects
155
155
  # Yield: subjects.each
@@ -264,4 +264,4 @@ module RDF::RDFa
264
264
  HAML_TEMPLATES = {base: BASE_HAML, min: MIN_HAML, distiller: DISTILLER_HAML}
265
265
  DEFAULT_HAML = BASE_HAML
266
266
  end
267
- end
267
+ end
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: 2.2.2
4
+ version: 2.2.3
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: 2017-05-18 00:00:00.000000000 Z
12
+ date: 2017-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdf
@@ -81,26 +81,6 @@ dependencies:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '4.3'
84
- - !ruby/object:Gem::Dependency
85
- name: open-uri-cached
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - "~>"
89
- - !ruby/object:Gem::Version
90
- version: '0.0'
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- version: 0.0.5
94
- type: :development
95
- prerelease: false
96
- version_requirements: !ruby/object:Gem::Requirement
97
- requirements:
98
- - - "~>"
99
- - !ruby/object:Gem::Version
100
- version: '0.0'
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: 0.0.5
104
84
  - !ruby/object:Gem::Dependency
105
85
  name: json-ld
106
86
  requirement: !ruby/object:Gem::Requirement
@@ -301,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
281
  version: '0'
302
282
  requirements: []
303
283
  rubyforge_project: rdf-rdfa
304
- rubygems_version: 2.6.11
284
+ rubygems_version: 2.6.12
305
285
  signing_key:
306
286
  specification_version: 4
307
287
  summary: RDFa reader/writer for RDF.rb.