ttl2html 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ttl2html/template.rb +12 -0
- data/lib/ttl2html/version.rb +1 -1
- data/lib/ttl2html.rb +17 -1
- data/templates/about.html.erb +10 -6
- data/templates/triples.html.erb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7291dd5276af9d25f9c91f5d798a1ad7614abe6d35ccf36aaa35beceb523d0ae
|
4
|
+
data.tar.gz: baca08577305a96a85b7c18015181a578dfbfc70344c73a599ebab582a591a69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd0e4667b20caaa5444bf8c5013e8e2d9fabc944628201a340c33865f3ae747def16b4860a70eb11dad6da9b5db014bb2aeb48d8a00ef9a48ea0aa1b3bf6db84
|
7
|
+
data.tar.gz: 8e85d33dabd668ce182e0d10483ae95f46c44bb3a421d5153823ae6df6d0768d9ce00b8f0f010f219a8861aaa3f5349c20e1727ac3742383e22be518d2d3cebc
|
data/lib/ttl2html/template.rb
CHANGED
@@ -234,6 +234,18 @@ module TTL2HTML
|
|
234
234
|
end
|
235
235
|
end
|
236
236
|
end
|
237
|
+
if @param[:orders_with_class] and triples["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
|
238
|
+
@param[:orders_with_class].reverse_each do |k, v|
|
239
|
+
triples["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"].each do |entity_class|
|
240
|
+
if entity_class == k
|
241
|
+
v.each do |property, order|
|
242
|
+
param_local[:orders] ||= {}
|
243
|
+
param_local[:orders][property] = order || Float::INFINITY
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
237
249
|
to_html_raw("triples.html.erb", param_local)
|
238
250
|
end
|
239
251
|
end
|
data/lib/ttl2html/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
TTL2HTML::VERSION = "1.3.
|
1
|
+
TTL2HTML::VERSION = "1.3.1"
|
data/lib/ttl2html.rb
CHANGED
@@ -128,6 +128,7 @@ module TTL2HTML
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
131
|
+
@config[:orders_with_class] = shapes2orders(shapes)
|
131
132
|
progressbar = ProgressBar.create(title: :output_html_files,
|
132
133
|
total: @data.size,
|
133
134
|
format: "(%t) %a %e %P% Processed: %c from %C")
|
@@ -186,7 +187,7 @@ module TTL2HTML
|
|
186
187
|
target_class = target_class.first
|
187
188
|
if @data[target_class]
|
188
189
|
label = template.get_title(@data[target_class], nil)
|
189
|
-
comment = @data[target_class]["http://www.w3.org/2000/01/rdf-schema#comment"]
|
190
|
+
comment = template.get_language_literal(@data[target_class]["http://www.w3.org/2000/01/rdf-schema#comment"]) if @data[target_class]["http://www.w3.org/2000/01/rdf-schema#comment"]
|
190
191
|
else
|
191
192
|
label = template.format_property(target_class)
|
192
193
|
end
|
@@ -248,6 +249,21 @@ module TTL2HTML
|
|
248
249
|
end
|
249
250
|
labels
|
250
251
|
end
|
252
|
+
def shapes2orders(shapes)
|
253
|
+
orders = {}
|
254
|
+
shapes.subjects.each do |shape|
|
255
|
+
target_class = @data[shape.to_s]["http://www.w3.org/ns/shacl#targetClass"]&.first
|
256
|
+
if target_class
|
257
|
+
@data[shape.to_s]["http://www.w3.org/ns/shacl#property"].each do |property|
|
258
|
+
path = @data[property]["http://www.w3.org/ns/shacl#path"].first
|
259
|
+
order = @data[property]["http://www.w3.org/ns/shacl#order"]
|
260
|
+
orders[target_class] ||= {}
|
261
|
+
orders[target_class][path] = order&.first&.to_i
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
orders
|
266
|
+
end
|
251
267
|
|
252
268
|
def output_turtle_files
|
253
269
|
progressbar = ProgressBar.create(title: :output_turtle_files,
|
data/templates/about.html.erb
CHANGED
@@ -3,13 +3,16 @@
|
|
3
3
|
<h1><%=h t("about.title", title: param[:site_title]) %></h1>
|
4
4
|
</div>
|
5
5
|
</div>
|
6
|
-
<nav aria-label="breadcrumb">
|
7
|
-
<ol class="breadcrumb">
|
8
|
-
<li class="breadcrumb-item"><a href="./"><i class="bi bi-house-door-fill"></i> Home</a></li>
|
9
|
-
<li class="breadcrumb-item active" aria-current="page"><%=h t("about.title", title: param[:site_title]) %></li>
|
10
|
-
</ol>
|
11
|
-
</nav>
|
12
6
|
<div class="container">
|
7
|
+
<div class="row">
|
8
|
+
<div class="col-md-12">
|
9
|
+
<nav aria-label="breadcrumb">
|
10
|
+
<ol class="breadcrumb">
|
11
|
+
<li class="breadcrumb-item"><a href="./"><i class="bi bi-house-door-fill"></i> Home</a></li>
|
12
|
+
<li class="breadcrumb-item active" aria-current="page"><%=h t("about.title", title: param[:site_title]) %></li>
|
13
|
+
</ol>
|
14
|
+
</nav>
|
15
|
+
</div>
|
13
16
|
<div class="row">
|
14
17
|
<div class="col-md">
|
15
18
|
<%- param[:content].keys.sort.each do |shape| -%>
|
@@ -21,3 +24,4 @@
|
|
21
24
|
</div>
|
22
25
|
</div>
|
23
26
|
</div>
|
27
|
+
|
data/templates/triples.html.erb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
<dl class="row">
|
2
|
-
<%- param[:data].
|
2
|
+
<%- param[:data].sort_by{|k, v|
|
3
|
+
order = param[:orders][k] if param[:orders] and param[:orders][k]
|
4
|
+
order = Float::INFINITY if order.nil?
|
5
|
+
[ order, k ]
|
6
|
+
}.each do |k, v| -%>
|
3
7
|
<%- if param[:type] == :inverse -%>
|
4
8
|
<dt class="col-sm-3"><%=h t('triples.inverse_refered', property: format_property(k, param[:labels])) %></dt>
|
5
9
|
<%- else -%>
|