rdf-rdfa 3.2.0 → 3.2.1

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
  SHA256:
3
- metadata.gz: 1607516f63a1cce40c7ddc6b5a17ad311673f8b8d621bb371f01919e2a138f44
4
- data.tar.gz: e7768c0968243e1cdb2054ff13107d52cff292889213f7103d2c8e0098f92c75
3
+ metadata.gz: 57e75308db5870f193ff4ab962820fa3ba1e416b40d6df62b9bc54bd1045c430
4
+ data.tar.gz: b9f761b04ff31f928a61be7790a9c60c7d79090fd0664977893c533b46941bfb
5
5
  SHA512:
6
- metadata.gz: d019f203248eff7ab6d138291b715cf8b803059cc7f1619dea2fb677d0001d4f4804e2b1d39e718cd6c5d05ec7cb43aabf16e08520ba5cdccf95f208ff900875
7
- data.tar.gz: c735757bbf56431c7a3add53a5b05de4f75bd86c95d2ea4f170ea6be5b8a14d62a2f42f5888940b2d27d133e7dc4ce8814da44c4c63d80ca2e5ad3753367f1f2
6
+ metadata.gz: 9707d86f3ffac0558c8308718235b4f3db79783466b656776ee8ddc78517923134fb3e1b92b6c744cb2ddb1769df96c930bcea0fd9e23d9b835fa3ca01ed64d6
7
+ data.tar.gz: 397fdcb1ecf2b4d0777328c5999748dfad58f9a56f6a95f39d42c3e8cfec4eb510731199cc6cb3feb087c572f127f24ba4f0c6a27cff8cefbcc136dd7996d13a
data/README.md CHANGED
@@ -399,7 +399,7 @@ The template hash defines four Haml templates:
399
399
  ## Dependencies
400
400
  * [Ruby](https://ruby-lang.org/) (>= 2.6)
401
401
  * [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.2)
402
- * [Haml](https://rubygems.org/gems/haml) (~> 5.2)
402
+ * [Haml](https://rubygems.org/gems/haml) (>- 5.2, < 7)
403
403
  * [HTMLEntities](https://rubygems.org/gems/htmlentities) (~> 4.3)
404
404
  * Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (~> 1.12)
405
405
 
@@ -473,7 +473,7 @@ see <https://unlicense.org/> or the accompanying [UNLICENSE](UNLICENSE) file.
473
473
  [HTML+RDFa 1.1]: https://www.w3.org/TR/rdfa-in-html/ "HTML+RDFa 1.1"
474
474
  [RDFa-test-suite]: https://rdfa.info/test-suite/ "RDFa test suite"
475
475
  [Role Attr]: https://www.w3.org/TR/role-attribute/ "Role Attribute"
476
- [RDFa doc]: https://rubydoc.info/github/ruby-rdf/rdf-rdfa/frames
476
+ [RDFa doc]: https://ruby-rdf.github.io/rdf-rdfa/frames
477
477
  [Haml]: https://haml-lang.com/
478
478
  [Turtle]: https://www.w3.org/TR/2011/WD-turtle-20110809/
479
479
  [Nokogiri]: https://www.nokogiri.org
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.0
1
+ 3.2.1
@@ -21,7 +21,8 @@ module RDF::RDFa
21
21
  content_encoding 'utf-8'
22
22
  content_type 'text/html;q=0.5',
23
23
  aliases: %w(application/xhtml+xml;q=0.7 image/svg+xml;q=0.4),
24
- extensions: [:html, :xhtml, :svg]
24
+ extensions: [:html, :xhtml, :svg],
25
+ uri: 'http://www.w3.org/ns/formats/RDFa'
25
26
  reader { RDF::RDFa::Reader }
26
27
  writer { RDF::RDFa::Writer }
27
28
 
@@ -245,7 +245,7 @@ module RDF::RDFa
245
245
 
246
246
  ##
247
247
  # RDFa Reader options
248
- # @see https://www.rubydoc.info/github/ruby-rdf/rdf/RDF/Reader#options-class_method
248
+ # @see https://ruby-rdf.github.io/rdf/RDF/Reader#options-class_method
249
249
  def self.options
250
250
  super + [
251
251
  RDF::CLI::Option.new(
@@ -10,11 +10,11 @@ module RDF::RDFa
10
10
  doc: %q(
11
11
  !!! XML
12
12
  !!! 5
13
- %html{xmlns: "http://www.w3.org/1999/xhtml", lang: lang, prefix: prefix}
13
+ %html{**{xmlns: "http://www.w3.org/1999/xhtml", lang: lang, prefix: prefix}.compact}
14
14
  - if base || title
15
15
  %head
16
16
  - if base
17
- %base{href: base}
17
+ %base{**{href: base}.compact}
18
18
  - if title
19
19
  %title= title
20
20
  %body
@@ -33,13 +33,13 @@ module RDF::RDFa
33
33
  # Yield: predicates.each
34
34
  subject: %q(
35
35
  - if element == :li
36
- %li{rel: rel, resource: (about || resource), typeof: typeof, inlist: inlist}
36
+ %li{**{rel: rel, resource: (about || resource), typeof: typeof, inlist: inlist}.compact}
37
37
  - if typeof
38
38
  %span.type!= typeof
39
39
  - predicates.each do |predicate|
40
40
  != yield(predicate)
41
41
  - else
42
- %div{rel: rel, resource: (about || resource), typeof: typeof, inlist: inlist}
42
+ %div{**{rel: rel, resource: (about || resource), typeof: typeof, inlist: inlist}.compact}
43
43
  - if typeof
44
44
  %span.type!= typeof
45
45
  - predicates.each do |predicate|
@@ -53,7 +53,7 @@ module RDF::RDFa
53
53
  # Otherwise, render result
54
54
  property_value: %q(
55
55
  - if heading_predicates.include?(predicate) && object.literal?
56
- %h1{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}= escape_entities(get_value(object))
56
+ %h1{**{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}.compact}= escape_entities(get_value(object))
57
57
  - else
58
58
  %div.property
59
59
  %span.label
@@ -63,13 +63,13 @@ module RDF::RDFa
63
63
  - elsif get_curie(object) == 'rdf:nil'
64
64
  %span{rel: get_curie(predicate), inlist: ''}
65
65
  - elsif object.node?
66
- %span{property: get_curie(predicate), resource: get_curie(object), inlist: inlist}= get_curie(object)
66
+ %span{**{property: get_curie(predicate), resource: get_curie(object), inlist: inlist}.compact}= get_curie(object)
67
67
  - elsif object.uri?
68
- %a{property: get_curie(predicate), href: object.to_s, inlist: inlist}= object.to_s
68
+ %a{**{property: get_curie(predicate), href: object.to_s, inlist: inlist}.compact}= object.to_s
69
69
  - elsif object.datatype == RDF.XMLLiteral
70
- %span{property: get_curie(predicate), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}<!= get_value(object)
70
+ %span{**{property: get_curie(predicate), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}.compact}<!= get_value(object)
71
71
  - else
72
- %span{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}= escape_entities(get_value(object))
72
+ %span{**{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}.compact}= escape_entities(get_value(object))
73
73
  ),
74
74
 
75
75
  # Output for multi-valued properties
@@ -84,14 +84,14 @@ module RDF::RDFa
84
84
  - if res = yield(object)
85
85
  != res
86
86
  - elsif object.node?
87
- %li{property: get_curie(predicate), resource: get_curie(object), inlist: inlist}= get_curie(object)
87
+ %li{**{property: get_curie(predicate), resource: get_curie(object), inlist: inlist}.compact}= get_curie(object)
88
88
  - elsif object.uri?
89
89
  %li
90
- %a{property: get_curie(predicate), href: object.to_s, inlist: inlist}= object.to_s
90
+ %a{**{property: get_curie(predicate), href: object.to_s, inlist: inlist}.compact}= object.to_s
91
91
  - elsif object.datatype == RDF.XMLLiteral
92
- %li{property: get_curie(predicate), lang: get_lang(object), datatype: get_curie(object.datatype), inlist: inlist}<!= get_value(object)
92
+ %li{**{property: get_curie(predicate), lang: get_lang(object), datatype: get_curie(object.datatype), inlist: inlist}.compact}<!= get_value(object)
93
93
  - else
94
- %li{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}= escape_entities(get_value(object))
94
+ %li{**{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}.compact}= escape_entities(get_value(object))
95
95
  ),
96
96
  }
97
97
 
@@ -106,10 +106,10 @@ module RDF::RDFa
106
106
  doc: %q(
107
107
  !!! XML
108
108
  !!! 5
109
- %html{xmlns: "http://www.w3.org/1999/xhtml", lang: lang, prefix: prefix}
109
+ %html{**{xmlns: "http://www.w3.org/1999/xhtml", lang: lang, prefix: prefix}.compact}
110
110
  - if base
111
111
  %head
112
- %base{href: base}
112
+ %base{*{href: base}.compact}
113
113
  %body
114
114
  - subjects.each do |subject|
115
115
  != yield(subject)
@@ -121,7 +121,7 @@ module RDF::RDFa
121
121
  # Locals: about, typeof, predicates, :inlist
122
122
  # Yield: predicates.each
123
123
  subject: %q(
124
- %div{rel: rel, resource: (about || resource), typeof: typeof}
124
+ %div{**{rel: rel, resource: (about || resource), typeof: typeof}.compact}
125
125
  - predicates.each do |predicate|
126
126
  != yield(predicate)
127
127
  ),
@@ -138,13 +138,13 @@ module RDF::RDFa
138
138
  - elsif get_curie(object) == 'rdf:nil'
139
139
  %span{rel: get_curie(predicate), inlist: ''}
140
140
  - elsif object.node?
141
- %span{property: get_curie(predicate), resource: get_curie(object), inlist: inlist}= get_curie(object)
141
+ %span{**{property: get_curie(predicate), resource: get_curie(object), inlist: inlist}.compact}= get_curie(object)
142
142
  - elsif object.uri?
143
- %a{property: get_curie(predicate), href: object.to_s, inlist: inlist}= object.to_s
143
+ %a{**{property: get_curie(predicate), href: object.to_s, inlist: inlist}.compact}= object.to_s
144
144
  - elsif object.datatype == RDF.XMLLiteral
145
- %span{property: get_curie(predicate), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}<!= get_value(object)
145
+ %span{**{property: get_curie(predicate), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}.compact}<!= get_value(object)
146
146
  - else
147
- %span{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}= escape_entities(get_value(object))
147
+ %span{**{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}.compact}= escape_entities(get_value(object))
148
148
  )
149
149
  }
150
150
 
@@ -156,7 +156,7 @@ module RDF::RDFa
156
156
  doc: %q(
157
157
  !!! XML
158
158
  !!! 5
159
- %html{xmlns: "http://www.w3.org/1999/xhtml", lang: lang, prefix: prefix}
159
+ %html{**{xmlns: "http://www.w3.org/1999/xhtml", lang: lang, prefix: prefix}.compact}
160
160
  - if base || title
161
161
  %head
162
162
  - if base
@@ -189,21 +189,21 @@ module RDF::RDFa
189
189
  # Yield: predicates.each
190
190
  subject: %q(
191
191
  - if element == :li
192
- %li{rel: rel, resource: (about || resource), typeof: typeof, inlist: inlist}
192
+ %li{**{rel: rel, resource: (about || resource), typeof: typeof, inlist: inlist}.compact}
193
193
  - if typeof
194
194
  %span.type!= typeof
195
195
  %table.properties
196
196
  - predicates.each do |predicate|
197
197
  != yield(predicate)
198
198
  - elsif rel
199
- %td{rel: rel, resource: (about || resource), typeof: typeof, inlist: inlist}
199
+ %td{**{rel: rel, resource: (about || resource), typeof: typeof, inlist: inlist}.compact}
200
200
  - if typeof
201
201
  %span.type!= typeof
202
202
  %table.properties
203
203
  - predicates.each do |predicate|
204
204
  != yield(predicate)
205
205
  - else
206
- %div{resource: (about || resource), typeof: typeof, inlist: inlist}
206
+ %div{**{resource: (about || resource), typeof: typeof, inlist: inlist}.compact}
207
207
  - if typeof
208
208
  %span.type!= typeof
209
209
  %table.properties
@@ -218,7 +218,7 @@ module RDF::RDFa
218
218
  # Otherwise, render result
219
219
  property_value: %q(
220
220
  - if heading_predicates.include?(predicate) && object.literal?
221
- %h1{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}= escape_entities(get_value(object))
221
+ %h1{**{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}.compact}= escape_entities(get_value(object))
222
222
  - else
223
223
  %tr.property
224
224
  %td.label
@@ -228,14 +228,14 @@ module RDF::RDFa
228
228
  - elsif get_curie(object) == 'rdf:nil'
229
229
  %td{rel: get_curie(predicate), inlist: ''}= "Empty"
230
230
  - elsif object.node?
231
- %td{property: get_curie(predicate), resource: get_curie(object), inlist: inlist}= get_curie(object)
231
+ %td{**{property: get_curie(predicate), resource: get_curie(object), inlist: inlist}.compact}= get_curie(object)
232
232
  - elsif object.uri?
233
233
  %td
234
- %a{property: get_curie(predicate), href: object.to_s, inlist: inlist}= object.to_s
234
+ %a{**{property: get_curie(predicate), href: object.to_s, inlist: inlist}.compact}= object.to_s
235
235
  - elsif object.datatype == RDF.XMLLiteral
236
- %td{property: get_curie(predicate), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}<!= get_value(object)
236
+ %td{**{property: get_curie(predicate), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}.compact}<!= get_value(object)
237
237
  - else
238
- %td{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}= escape_entities(get_value(object))
238
+ %td{**{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}.compact}= escape_entities(get_value(object))
239
239
  ),
240
240
 
241
241
  # Output for multi-valued properties
@@ -251,14 +251,14 @@ module RDF::RDFa
251
251
  - if res = yield(object)
252
252
  != res
253
253
  - elsif object.node?
254
- %li{property: get_curie(predicate), resource: get_curie(object), inlist: inlist}= get_curie(object)
254
+ %li{**{property: get_curie(predicate), resource: get_curie(object), inlist: inlist}.compact}= get_curie(object)
255
255
  - elsif object.uri?
256
256
  %li
257
- %a{property: get_curie(predicate), href: object.to_s, inlist: inlist}= object.to_s
257
+ %a{**{property: get_curie(predicate), href: object.to_s, inlist: inlist}.compact}= object.to_s
258
258
  - elsif object.datatype == RDF.XMLLiteral
259
- %li{property: get_curie(predicate), lang: get_lang(object), datatype: get_curie(object.datatype), inlist: inlist}<!= get_value(object)
259
+ %li{**{property: get_curie(predicate), lang: get_lang(object), datatype: get_curie(object.datatype), inlist: inlist}.compact}<!= get_value(object)
260
260
  - else
261
- %li{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}= escape_entities(get_value(object))
261
+ %li{**{property: get_curie(predicate), content: get_content(object), lang: get_lang(object), datatype: get_dt_curie(object), inlist: inlist}.compact}= escape_entities(get_value(object))
262
262
  ),
263
263
  }
264
264
  HAML_TEMPLATES = {base: BASE_HAML, min: MIN_HAML, distiller: DISTILLER_HAML}
@@ -75,7 +75,7 @@ module RDF::RDFa
75
75
 
76
76
  ##
77
77
  # RDFa Writer options
78
- # @see https://www.rubydoc.info/github/ruby-rdf/rdf/RDF/Writer#options-class_method
78
+ # @see https://ruby-rdf.github.io/rdf/RDF/Writer#options-class_method
79
79
  def self.options
80
80
  super + [
81
81
  RDF::CLI::Option.new(
@@ -721,6 +721,8 @@ module RDF::RDFa
721
721
  # @return [String]
722
722
  # Entity-encoded string
723
723
  def escape_entities(str)
724
+ # Haml 6 does escaping
725
+ return str if Haml.const_defined?(:Template)
724
726
  CGI.escapeHTML(str).gsub(/[\n\r]/) {|c| '&#x' + c.unpack('h').first + ';'}
725
727
  end
726
728
 
@@ -761,7 +763,13 @@ module RDF::RDFa
761
763
  template = template.align_left
762
764
  log_debug {"hamlify locals: #{locals.inspect}"}
763
765
 
764
- Haml::Engine.new(template, @options[:haml_options] || HAML_OPTIONS).render(self, locals) do |*args|
766
+ haml_opts = @options[:haml_options] || HAML_OPTIONS
767
+ haml_runner = if Haml.const_defined?(:Template)
768
+ Haml::Template.new(**haml_opts) {template}
769
+ else
770
+ Haml::Engine.new(template, **haml_opts)
771
+ end
772
+ haml_runner.render(self, locals) do |*args|
765
773
  yield(*args) if block_given?
766
774
  end
767
775
  rescue Haml::Error => e
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: 3.2.0
4
+ version: 3.2.1
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: 2021-12-08 00:00:00.000000000 Z
12
+ date: 2023-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdf
@@ -43,16 +43,22 @@ dependencies:
43
43
  name: haml
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '5.2'
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: '7'
49
52
  type: :runtime
50
53
  prerelease: false
51
54
  version_requirements: !ruby/object:Gem::Requirement
52
55
  requirements:
53
- - - "~>"
56
+ - - ">="
54
57
  - !ruby/object:Gem::Version
55
58
  version: '5.2'
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: '7'
56
62
  - !ruby/object:Gem::Dependency
57
63
  name: rdf-xsd
58
64
  requirement: !ruby/object:Gem::Requirement
@@ -264,7 +270,12 @@ files:
264
270
  homepage: https://github.com/ruby-rdf/rdf-rdfa
265
271
  licenses:
266
272
  - Unlicense
267
- metadata: {}
273
+ metadata:
274
+ documentation_uri: https://ruby-rdf.github.io/rdf-rdfa
275
+ bug_tracker_uri: https://github.com/ruby-rdf/rdf-rdfa/issues
276
+ homepage_uri: https://github.com/ruby-rdf/rdf-rdfa
277
+ mailing_list_uri: https://lists.w3.org/Archives/Public/public-rdf-ruby/
278
+ source_code_uri: https://github.com/ruby-rdf/rdf-rdfa
268
279
  post_install_message:
269
280
  rdoc_options: []
270
281
  require_paths:
@@ -280,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
291
  - !ruby/object:Gem::Version
281
292
  version: '0'
282
293
  requirements: []
283
- rubygems_version: 3.3.3
294
+ rubygems_version: 3.4.6
284
295
  signing_key:
285
296
  specification_version: 4
286
297
  summary: RDFa reader/writer for RDF.rb.