rdf-rdfa 3.1.3 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -13
- data/VERSION +1 -1
- data/lib/rdf/rdfa/format.rb +2 -1
- data/lib/rdf/rdfa/reader/nokogiri.rb +1 -4
- data/lib/rdf/rdfa/reader.rb +2 -14
- data/lib/rdf/rdfa/writer/haml_templates.rb +33 -33
- data/lib/rdf/rdfa/writer.rb +10 -2
- metadata +40 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57e75308db5870f193ff4ab962820fa3ba1e416b40d6df62b9bc54bd1045c430
|
4
|
+
data.tar.gz: b9f761b04ff31f928a61be7790a9c60c7d79090fd0664977893c533b46941bfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9707d86f3ffac0558c8308718235b4f3db79783466b656776ee8ddc78517923134fb3e1b92b6c744cb2ddb1769df96c930bcea0fd9e23d9b835fa3ca01ed64d6
|
7
|
+
data.tar.gz: 397fdcb1ecf2b4d0777328c5999748dfad58f9a56f6a95f39d42c3e8cfec4eb510731199cc6cb3feb087c572f127f24ba4f0c6a27cff8cefbcc136dd7996d13a
|
data/README.md
CHANGED
@@ -16,15 +16,15 @@ RDF::RDFa parses [RDFa][RDFa 1.1 Core] into statements or triples.
|
|
16
16
|
* Fully compliant RDFa 1.1 parser.
|
17
17
|
* Template-based Writer to generate XHTML+RDFa.
|
18
18
|
* Writer uses user-replaceable [Haml][Haml] -based templates to generate RDFa.
|
19
|
-
* If available, uses [Nokogiri][] for parsing HTML/SVG, falls back to REXML otherwise.
|
19
|
+
* If available, uses [Nokogiri][] for parsing HTML/SVG, falls back to REXML otherwise.
|
20
20
|
|
21
21
|
Install with `gem install rdf-rdfa`
|
22
22
|
|
23
23
|
### Pure Ruby
|
24
|
-
In order to run as pure ruby (not requiring any C modules), this gem does not directly depend on [Nokogiri][]
|
25
|
-
and falls back to using REXML.
|
24
|
+
In order to run as pure ruby (not requiring any C modules), this gem does not directly depend on [Nokogiri][]
|
25
|
+
and falls back to using REXML.
|
26
26
|
As REXML is not really an HTML parsing library, the results will only be useful if the HTML is well-formed.
|
27
|
-
For best performance, install the [Nokogiri][]
|
27
|
+
For best performance, install the [Nokogiri][] gem as well.
|
28
28
|
|
29
29
|
### Important changes from previous versions
|
30
30
|
RDFa is an evolving standard, undergoing some substantial recent changes partly due to perceived competition
|
@@ -191,7 +191,7 @@ generates the following turtle:
|
|
191
191
|
dc:description "A yellow rectangle with sharp corners." .
|
192
192
|
|
193
193
|
### Support for embedded N-Triples or Turtle
|
194
|
-
If the document includes a `<script>` element having an `@type` attribute whose value matches that of a loaded RDF reader (text/ntriples and text/turtle are loaded if they are
|
194
|
+
If the document includes a `<script>` element having an `@type` attribute whose value matches that of a loaded RDF reader (text/ntriples and text/turtle are loaded if they are available), the data will be extracted and added to the default graph. For example:
|
195
195
|
|
196
196
|
<html>
|
197
197
|
<body>
|
@@ -397,12 +397,11 @@ The template hash defines four Haml templates:
|
|
397
397
|
}
|
398
398
|
|
399
399
|
## Dependencies
|
400
|
-
* [Ruby](https://ruby-lang.org/) (>= 2.
|
401
|
-
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.
|
402
|
-
* [Haml](https://rubygems.org/gems/haml) (
|
403
|
-
* [HTMLEntities](https://rubygems.org/gems/htmlentities) (
|
404
|
-
* Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (
|
405
|
-
* Soft dependency on [Nokogumbo](https://github.com/rubys/nokogumbo) (>= 2.0)
|
400
|
+
* [Ruby](https://ruby-lang.org/) (>= 2.6)
|
401
|
+
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.2)
|
402
|
+
* [Haml](https://rubygems.org/gems/haml) (>- 5.2, < 7)
|
403
|
+
* [HTMLEntities](https://rubygems.org/gems/htmlentities) (~> 4.3)
|
404
|
+
* Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (~> 1.12)
|
406
405
|
|
407
406
|
## Documentation
|
408
407
|
Full documentation available on [Rubydoc.info][RDFa doc]
|
@@ -474,8 +473,7 @@ see <https://unlicense.org/> or the accompanying [UNLICENSE](UNLICENSE) file.
|
|
474
473
|
[HTML+RDFa 1.1]: https://www.w3.org/TR/rdfa-in-html/ "HTML+RDFa 1.1"
|
475
474
|
[RDFa-test-suite]: https://rdfa.info/test-suite/ "RDFa test suite"
|
476
475
|
[Role Attr]: https://www.w3.org/TR/role-attribute/ "Role Attribute"
|
477
|
-
[RDFa doc]: https://
|
476
|
+
[RDFa doc]: https://ruby-rdf.github.io/rdf-rdfa/frames
|
478
477
|
[Haml]: https://haml-lang.com/
|
479
478
|
[Turtle]: https://www.w3.org/TR/2011/WD-turtle-20110809/
|
480
479
|
[Nokogiri]: https://www.nokogiri.org
|
481
|
-
[Nokogumbo]: https://github.com/rubys/nokogumbo/#readme
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1
|
1
|
+
3.2.1
|
data/lib/rdf/rdfa/format.rb
CHANGED
@@ -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
|
|
@@ -176,10 +176,9 @@ module RDF::RDFa
|
|
176
176
|
::Nokogiri::HTML.parse(input, base_uri.to_s, options[:encoding])
|
177
177
|
when :html5
|
178
178
|
begin
|
179
|
-
require 'nokogumbo' unless defined?(::Nokogumbo)
|
180
179
|
input = input.read if input.respond_to?(:read)
|
181
180
|
::Nokogiri::HTML5(input.force_encoding(options[:encoding]), max_parse_errors: 1000)
|
182
|
-
rescue LoadError
|
181
|
+
rescue LoadError, NoMethodError
|
183
182
|
::Nokogiri::HTML.parse(input, base_uri.to_s, options[:encoding])
|
184
183
|
end
|
185
184
|
else
|
@@ -283,8 +282,6 @@ module RDF::RDFa
|
|
283
282
|
##
|
284
283
|
# Document errors
|
285
284
|
def doc_errors
|
286
|
-
# FIXME: Nokogiri version 1.5 thinks many HTML5 elements are invalid, so just ignore all Tag errors.
|
287
|
-
# Nokogumbo might make this simpler
|
288
285
|
if @host_language == :html5
|
289
286
|
@doc.errors.reject do |e|
|
290
287
|
e.to_s =~ %r{(The doctype must be the first token in the document)|(Expected a doctype token)|(Unexpected '\?' where start tag name is expected)}
|
data/lib/rdf/rdfa/reader.rb
CHANGED
@@ -245,7 +245,7 @@ module RDF::RDFa
|
|
245
245
|
|
246
246
|
##
|
247
247
|
# RDFa Reader options
|
248
|
-
# @see https://
|
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(
|
@@ -329,19 +329,7 @@ module RDF::RDFa
|
|
329
329
|
|
330
330
|
detect_host_language_version(input, **options)
|
331
331
|
|
332
|
-
|
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]}")
|
332
|
+
add_info(@doc, "version = #{@version}, host_language = #{@host_language}, library = #{@library}, rdfagraph = #{@options[:rdfagraph].inspect}, expand = #{@options[:vocab_expansion]}")
|
345
333
|
|
346
334
|
begin
|
347
335
|
initialize_xml(input, **options)
|
@@ -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}
|
data/lib/rdf/rdfa/writer.rb
CHANGED
@@ -75,7 +75,7 @@ module RDF::RDFa
|
|
75
75
|
|
76
76
|
##
|
77
77
|
# RDFa Writer options
|
78
|
-
# @see https://
|
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
|
-
|
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.1
|
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:
|
12
|
+
date: 2023-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdf
|
@@ -17,82 +17,76 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '3.
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 3.1.13
|
20
|
+
version: '3.2'
|
24
21
|
type: :runtime
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
27
24
|
requirements:
|
28
25
|
- - "~>"
|
29
26
|
- !ruby/object:Gem::Version
|
30
|
-
version: '3.
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 3.1.13
|
27
|
+
version: '3.2'
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
29
|
name: rdf-vocab
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
37
31
|
requirements:
|
38
32
|
- - "~>"
|
39
33
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 3.1.11
|
34
|
+
version: '3.2'
|
44
35
|
type: :runtime
|
45
36
|
prerelease: false
|
46
37
|
version_requirements: !ruby/object:Gem::Requirement
|
47
38
|
requirements:
|
48
39
|
- - "~>"
|
49
40
|
- !ruby/object:Gem::Version
|
50
|
-
version: '3.
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 3.1.11
|
41
|
+
version: '3.2'
|
54
42
|
- !ruby/object:Gem::Dependency
|
55
43
|
name: haml
|
56
44
|
requirement: !ruby/object:Gem::Requirement
|
57
45
|
requirements:
|
58
|
-
- - "
|
46
|
+
- - ">="
|
59
47
|
- !ruby/object:Gem::Version
|
60
48
|
version: '5.2'
|
49
|
+
- - "<"
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '7'
|
61
52
|
type: :runtime
|
62
53
|
prerelease: false
|
63
54
|
version_requirements: !ruby/object:Gem::Requirement
|
64
55
|
requirements:
|
65
|
-
- - "
|
56
|
+
- - ">="
|
66
57
|
- !ruby/object:Gem::Version
|
67
58
|
version: '5.2'
|
59
|
+
- - "<"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '7'
|
68
62
|
- !ruby/object:Gem::Dependency
|
69
63
|
name: rdf-xsd
|
70
64
|
requirement: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
66
|
- - "~>"
|
73
67
|
- !ruby/object:Gem::Version
|
74
|
-
version: '3.
|
68
|
+
version: '3.2'
|
75
69
|
type: :runtime
|
76
70
|
prerelease: false
|
77
71
|
version_requirements: !ruby/object:Gem::Requirement
|
78
72
|
requirements:
|
79
73
|
- - "~>"
|
80
74
|
- !ruby/object:Gem::Version
|
81
|
-
version: '3.
|
75
|
+
version: '3.2'
|
82
76
|
- !ruby/object:Gem::Dependency
|
83
77
|
name: rdf-aggregate-repo
|
84
78
|
requirement: !ruby/object:Gem::Requirement
|
85
79
|
requirements:
|
86
80
|
- - "~>"
|
87
81
|
- !ruby/object:Gem::Version
|
88
|
-
version: '3.
|
82
|
+
version: '3.2'
|
89
83
|
type: :runtime
|
90
84
|
prerelease: false
|
91
85
|
version_requirements: !ruby/object:Gem::Requirement
|
92
86
|
requirements:
|
93
87
|
- - "~>"
|
94
88
|
- !ruby/object:Gem::Version
|
95
|
-
version: '3.
|
89
|
+
version: '3.2'
|
96
90
|
- !ruby/object:Gem::Dependency
|
97
91
|
name: htmlentities
|
98
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,14 +107,14 @@ dependencies:
|
|
113
107
|
requirements:
|
114
108
|
- - "~>"
|
115
109
|
- !ruby/object:Gem::Version
|
116
|
-
version: '3.
|
110
|
+
version: '3.2'
|
117
111
|
type: :development
|
118
112
|
prerelease: false
|
119
113
|
version_requirements: !ruby/object:Gem::Requirement
|
120
114
|
requirements:
|
121
115
|
- - "~>"
|
122
116
|
- !ruby/object:Gem::Version
|
123
|
-
version: '3.
|
117
|
+
version: '3.2'
|
124
118
|
- !ruby/object:Gem::Dependency
|
125
119
|
name: rspec
|
126
120
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,84 +149,84 @@ dependencies:
|
|
155
149
|
requirements:
|
156
150
|
- - "~>"
|
157
151
|
- !ruby/object:Gem::Version
|
158
|
-
version: '3.
|
152
|
+
version: '3.2'
|
159
153
|
type: :development
|
160
154
|
prerelease: false
|
161
155
|
version_requirements: !ruby/object:Gem::Requirement
|
162
156
|
requirements:
|
163
157
|
- - "~>"
|
164
158
|
- !ruby/object:Gem::Version
|
165
|
-
version: '3.
|
159
|
+
version: '3.2'
|
166
160
|
- !ruby/object:Gem::Dependency
|
167
161
|
name: rdf-turtle
|
168
162
|
requirement: !ruby/object:Gem::Requirement
|
169
163
|
requirements:
|
170
164
|
- - "~>"
|
171
165
|
- !ruby/object:Gem::Version
|
172
|
-
version: '3.
|
166
|
+
version: '3.2'
|
173
167
|
type: :development
|
174
168
|
prerelease: false
|
175
169
|
version_requirements: !ruby/object:Gem::Requirement
|
176
170
|
requirements:
|
177
171
|
- - "~>"
|
178
172
|
- !ruby/object:Gem::Version
|
179
|
-
version: '3.
|
173
|
+
version: '3.2'
|
180
174
|
- !ruby/object:Gem::Dependency
|
181
175
|
name: rdf-isomorphic
|
182
176
|
requirement: !ruby/object:Gem::Requirement
|
183
177
|
requirements:
|
184
178
|
- - "~>"
|
185
179
|
- !ruby/object:Gem::Version
|
186
|
-
version: '3.
|
180
|
+
version: '3.2'
|
187
181
|
type: :development
|
188
182
|
prerelease: false
|
189
183
|
version_requirements: !ruby/object:Gem::Requirement
|
190
184
|
requirements:
|
191
185
|
- - "~>"
|
192
186
|
- !ruby/object:Gem::Version
|
193
|
-
version: '3.
|
187
|
+
version: '3.2'
|
194
188
|
- !ruby/object:Gem::Dependency
|
195
189
|
name: rdf-tabular
|
196
190
|
requirement: !ruby/object:Gem::Requirement
|
197
191
|
requirements:
|
198
192
|
- - "~>"
|
199
193
|
- !ruby/object:Gem::Version
|
200
|
-
version: '3.
|
194
|
+
version: '3.2'
|
201
195
|
type: :development
|
202
196
|
prerelease: false
|
203
197
|
version_requirements: !ruby/object:Gem::Requirement
|
204
198
|
requirements:
|
205
199
|
- - "~>"
|
206
200
|
- !ruby/object:Gem::Version
|
207
|
-
version: '3.
|
201
|
+
version: '3.2'
|
208
202
|
- !ruby/object:Gem::Dependency
|
209
203
|
name: rdf-rdfxml
|
210
204
|
requirement: !ruby/object:Gem::Requirement
|
211
205
|
requirements:
|
212
206
|
- - "~>"
|
213
207
|
- !ruby/object:Gem::Version
|
214
|
-
version: '3.
|
208
|
+
version: '3.2'
|
215
209
|
type: :development
|
216
210
|
prerelease: false
|
217
211
|
version_requirements: !ruby/object:Gem::Requirement
|
218
212
|
requirements:
|
219
213
|
- - "~>"
|
220
214
|
- !ruby/object:Gem::Version
|
221
|
-
version: '3.
|
215
|
+
version: '3.2'
|
222
216
|
- !ruby/object:Gem::Dependency
|
223
217
|
name: sparql
|
224
218
|
requirement: !ruby/object:Gem::Requirement
|
225
219
|
requirements:
|
226
220
|
- - "~>"
|
227
221
|
- !ruby/object:Gem::Version
|
228
|
-
version: '3.
|
222
|
+
version: '3.2'
|
229
223
|
type: :development
|
230
224
|
prerelease: false
|
231
225
|
version_requirements: !ruby/object:Gem::Requirement
|
232
226
|
requirements:
|
233
227
|
- - "~>"
|
234
228
|
- !ruby/object:Gem::Version
|
235
|
-
version: '3.
|
229
|
+
version: '3.2'
|
236
230
|
- !ruby/object:Gem::Dependency
|
237
231
|
name: yard
|
238
232
|
requirement: !ruby/object:Gem::Requirement
|
@@ -276,7 +270,12 @@ files:
|
|
276
270
|
homepage: https://github.com/ruby-rdf/rdf-rdfa
|
277
271
|
licenses:
|
278
272
|
- Unlicense
|
279
|
-
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
|
280
279
|
post_install_message:
|
281
280
|
rdoc_options: []
|
282
281
|
require_paths:
|
@@ -285,14 +284,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
285
284
|
requirements:
|
286
285
|
- - ">="
|
287
286
|
- !ruby/object:Gem::Version
|
288
|
-
version: '2.
|
287
|
+
version: '2.6'
|
289
288
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
290
289
|
requirements:
|
291
290
|
- - ">="
|
292
291
|
- !ruby/object:Gem::Version
|
293
292
|
version: '0'
|
294
293
|
requirements: []
|
295
|
-
rubygems_version: 3.
|
294
|
+
rubygems_version: 3.4.6
|
296
295
|
signing_key:
|
297
296
|
specification_version: 4
|
298
297
|
summary: RDFa reader/writer for RDF.rb.
|