ttl2html 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d6db7238da3700fba83d389bdab577f9bacc2c5da65f993612731716ac4899a
4
- data.tar.gz: 1804e3b40f344e00618699202d331e03e2e5324519626df62389fc739925fe82
3
+ metadata.gz: 7291dd5276af9d25f9c91f5d798a1ad7614abe6d35ccf36aaa35beceb523d0ae
4
+ data.tar.gz: baca08577305a96a85b7c18015181a578dfbfc70344c73a599ebab582a591a69
5
5
  SHA512:
6
- metadata.gz: 7bbcc86b1acc04ad04c8a5f98b11fe020366630b7fc3ad99067e7de19853afd3311e7534fe80facc150490a784d2e96600b20e43e66f6da7aa1380a1fe8c2163
7
- data.tar.gz: c93964d3ef71fa6e300e8634ae49a3dd5f083f737ac3d0ae3224c9493b5d7bdb8846f6a95b1803110eab1b16971b951a38c802522c0a1099f30c16d11910632f
6
+ metadata.gz: fd0e4667b20caaa5444bf8c5013e8e2d9fabc944628201a340c33865f3ae747def16b4860a70eb11dad6da9b5db014bb2aeb48d8a00ef9a48ea0aa1b3bf6db84
7
+ data.tar.gz: 8e85d33dabd668ce182e0d10483ae95f46c44bb3a421d5153823ae6df6d0768d9ce00b8f0f010f219a8861aaa3f5349c20e1727ac3742383e22be518d2d3cebc
@@ -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
@@ -1 +1 @@
1
- TTL2HTML::VERSION = "1.3.0"
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"]&.first
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,
@@ -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
+
@@ -1,5 +1,9 @@
1
1
  <dl class="row">
2
- <%- param[:data].each do |k, v| -%>
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 -%>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ttl2html
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masao Takaku