ttl2html 1.3.0 → 1.3.4

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: 79231cafbf41d1d06149ccc0a101aae7ecc02f9ff554d542c36b3891b3943082
4
+ data.tar.gz: ba235231f54ff64003de2e397b8f4d55e7cfda909b2624cc8412cd37d51c6a3d
5
5
  SHA512:
6
- metadata.gz: 7bbcc86b1acc04ad04c8a5f98b11fe020366630b7fc3ad99067e7de19853afd3311e7534fe80facc150490a784d2e96600b20e43e66f6da7aa1380a1fe8c2163
7
- data.tar.gz: c93964d3ef71fa6e300e8634ae49a3dd5f083f737ac3d0ae3224c9493b5d7bdb8846f6a95b1803110eab1b16971b951a38c802522c0a1099f30c16d11910632f
6
+ metadata.gz: 22c589eb1d742d5ed17e18431b5b450336bf45216071d6ce7581e7cae9fb907077a67debc347d269c0e0ee10ca28adbb2ad087841cfb6fbc06734bdb266901db
7
+ data.tar.gz: a34e1c9af0e0ae65be8a0217425f47bd00a2500e0ce785fce8109b24dae671e1dd7cbb2c40063e93d7cce46689bb4ab43e8677f42bb0c84402d4e0a6434ce742
@@ -4,12 +4,14 @@ require "fileutils"
4
4
  require "pathname"
5
5
  require "erb"
6
6
  require "i18n"
7
+ require "action_view"
7
8
 
8
9
  module TTL2HTML
9
10
  class Template
10
11
  attr_reader :param
11
12
  include ERB::Util
12
13
  include I18n::Base
14
+ include ActionView::Helpers::NumberHelper
13
15
  def initialize(template, param = {})
14
16
  @template = template
15
17
  @param = param.dup
@@ -37,7 +39,7 @@ module TTL2HTML
37
39
  @param.update(param)
38
40
  template = find_template_path(template)
39
41
  tmpl = open(template){|io| io.read }
40
- erb = ERB.new(tmpl, nil, "-")
42
+ erb = ERB.new(tmpl, trim_mode: "-")
41
43
  erb.filename = template
42
44
  erb.result(binding)
43
45
  end
@@ -156,6 +158,16 @@ module TTL2HTML
156
158
  dest_uri
157
159
  end
158
160
  end
161
+ def html_title(param)
162
+ titles = []
163
+ if @template.start_with? "about.html"
164
+ titles << t("about.title", title: param[:site_title])
165
+ else
166
+ titles << param[:title]
167
+ titles << param[:site_title]
168
+ end
169
+ titles.compact.join(" - ")
170
+ end
159
171
  def shorten_title(title, length = 140)
160
172
  if title.length > length
161
173
  title[0..length] + "..."
@@ -234,7 +246,23 @@ module TTL2HTML
234
246
  end
235
247
  end
236
248
  end
249
+ if @param[:orders_with_class] and triples["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
250
+ @param[:orders_with_class].reverse_each do |k, v|
251
+ triples["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"].each do |entity_class|
252
+ if entity_class == k
253
+ v.each do |property, order|
254
+ param_local[:orders] ||= {}
255
+ param_local[:orders][property] = order || Float::INFINITY
256
+ end
257
+ end
258
+ end
259
+ end
260
+ end
237
261
  to_html_raw("triples.html.erb", param_local)
238
262
  end
263
+ def format_version_info(version)
264
+ param_local = @param.dup.merge(data: version)
265
+ to_html_raw("version.html.erb", param_local)
266
+ end
239
267
  end
240
- end
268
+ end
@@ -1 +1 @@
1
- TTL2HTML::VERSION = "1.3.0"
1
+ TTL2HTML::VERSION = "1.3.4"
data/lib/ttl2html.rb CHANGED
@@ -23,8 +23,10 @@ module TTL2HTML
23
23
 
24
24
  def load_config(file)
25
25
  config = {}
26
- YAML.load_file(file).each do |k, v|
27
- config[k.intern] = v
26
+ open(file) do |io|
27
+ YAML.safe_load(io, permitted_classes: [Regexp]).each do |k, v|
28
+ config[k.intern] = v
29
+ end
28
30
  end
29
31
  config
30
32
  end
@@ -105,11 +107,16 @@ module TTL2HTML
105
107
  result
106
108
  end
107
109
 
108
- def each_data
110
+ def each_data(label = :each_data)
111
+ progressbar = ProgressBar.create(title: label,
112
+ total: @data.size,
113
+ format: "(%t) %a %e %P% Processed: %c from %C")
109
114
  @data.each do |uri, v|
115
+ progressbar.increment
110
116
  next if not uri.start_with? @config[:base_uri]
111
117
  yield uri, v
112
118
  end
119
+ progressbar.finish
113
120
  end
114
121
  def output_html_files
115
122
  template = Template.new("", @config)
@@ -117,6 +124,8 @@ module TTL2HTML
117
124
  RDF::URI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
118
125
  RDF::URI("http://www.w3.org/ns/shacl#NodeShape")])
119
126
  labels = shapes2labels(shapes)
127
+ versions = extract_versions
128
+ toplevel = extract_toplevel
120
129
  @config[:labels_with_class] ||= {}
121
130
  labels.each do |klass, props|
122
131
  props.each do |property, label|
@@ -128,11 +137,8 @@ module TTL2HTML
128
137
  end
129
138
  end
130
139
  end
131
- progressbar = ProgressBar.create(title: :output_html_files,
132
- total: @data.size,
133
- format: "(%t) %a %e %P% Processed: %c from %C")
134
- each_data do |uri, v|
135
- progressbar.increment
140
+ @config[:orders_with_class] = shapes2orders(shapes)
141
+ each_data(:output_html_files) do |uri, v|
136
142
  template = Template.new("default.html.erb", @config)
137
143
  param = @config.dup
138
144
  param[:uri] = uri
@@ -151,7 +157,6 @@ module TTL2HTML
151
157
  end
152
158
  template.output_to(file, param)
153
159
  end
154
- progressbar.finish
155
160
  index_html = "index.html"
156
161
  index_html = File.join(@config[:output_dir], "index.html") if @config[:output_dir]
157
162
  if @config.has_key? :top_class
@@ -165,6 +170,8 @@ module TTL2HTML
165
170
  template = Template.new("index.html.erb", @config)
166
171
  param = @config.dup
167
172
  param[:data_global] = @data
173
+ param[:versions] = versions
174
+ param[:toplevel] = toplevel
168
175
  subjects.sort.each do |subject|
169
176
  param[:index_data] ||= []
170
177
  param[:index_data] << subject.to_s
@@ -172,13 +179,15 @@ module TTL2HTML
172
179
  template.output_to(index_html, param)
173
180
  end
174
181
  end
175
- if shapes.size > 0
182
+ if shapes.size > 0 or versions.size > 0 or toplevel.size > 0
176
183
  about_html = @config[:about_file] || "about.html"
177
184
  about_html = File.join(@config[:output_dir], about_html) if @config[:output_dir]
178
185
  template = Template.new("about.html.erb", @config)
179
186
  param = @config.dup
180
187
  param[:data_global] = @data
181
- param[:content] = {}
188
+ param[:versions] = versions
189
+ param[:toplevel] = toplevel
190
+ param[:shapes] = {}
182
191
  shapes.subjects.each do |subject|
183
192
  label = comment = nil
184
193
  target_class = @data[subject.to_s]["http://www.w3.org/ns/shacl#targetClass"]
@@ -186,14 +195,14 @@ module TTL2HTML
186
195
  target_class = target_class.first
187
196
  if @data[target_class]
188
197
  label = template.get_title(@data[target_class], nil)
189
- comment = @data[target_class]["http://www.w3.org/2000/01/rdf-schema#comment"]&.first
198
+ 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
199
  else
191
200
  label = template.format_property(target_class)
192
201
  end
193
202
  else
194
203
  label = template.get_title(@data[subject.to_s])
195
204
  end
196
- param[:content][subject] = {
205
+ param[:shapes][subject] = {
197
206
  label: label,
198
207
  comment: comment,
199
208
  html: template.expand_shape(@data, subject.to_s, @prefix),
@@ -248,13 +257,102 @@ module TTL2HTML
248
257
  end
249
258
  labels
250
259
  end
260
+ def shapes2orders(shapes)
261
+ orders = {}
262
+ shapes.subjects.each do |shape|
263
+ target_class = @data[shape.to_s]["http://www.w3.org/ns/shacl#targetClass"]&.first
264
+ if target_class
265
+ @data[shape.to_s]["http://www.w3.org/ns/shacl#property"].each do |property|
266
+ path = @data[property]["http://www.w3.org/ns/shacl#path"].first
267
+ order = @data[property]["http://www.w3.org/ns/shacl#order"]
268
+ orders[target_class] ||= {}
269
+ orders[target_class][path] = order&.first&.to_i
270
+ end
271
+ end
272
+ end
273
+ orders
274
+ end
275
+
276
+ def extract_versions
277
+ versions = []
278
+ ["http://purl.org/pav/hasVersion", "http://purl.org/pav/hasCurrentVersion", "http://purl.org/dc/terms/hasVersion"].each do |prop|
279
+ objects = @graph.query([nil, RDF::URI(prop), nil]).objects
280
+ objects.each do |o|
281
+ uri = o.to_s
282
+ version = @data[uri]
283
+ next if not version
284
+ next if not version["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"].include? "http://rdfs.org/ns/void#Dataset"
285
+ description = version["http://purl.org/dc/terms/description"]
286
+ if not description
287
+ qrev = version["http://www.w3.org/ns/prov#qualifiedRevision"]&.first
288
+ if description = @data[qrev]
289
+ description = @data[qrev]["http://www.w3.org/2000/01/rdf-schema#comment"]
290
+ end
291
+ end
292
+ subset = []
293
+ if version["http://rdfs.org/ns/void#subset"]
294
+ version["http://rdfs.org/ns/void#subset"].each do |s|
295
+ subset << @data[s]["http://rdfs.org/ns/void#dataDump"].first
296
+ end
297
+ end
298
+ date = version["http://purl.org/pav/createdOn"]&.first
299
+ date = version["http://purl.org/dc/terms/issued"]&.first if date.nil?
300
+ versions << {
301
+ uri: uri,
302
+ version: version["http://purl.org/pav/version"]&.first,
303
+ triples: version["http://rdfs.org/ns/void#triples"]&.first,
304
+ datadump: version["http://rdfs.org/ns/void#dataDump"]&.first,
305
+ bytesize: version["http://www.w3.org/ns/dcat#byteSize"]&.first,
306
+ date: date,
307
+ description: description,
308
+ subset: subset,
309
+ }
310
+ end
311
+ end
312
+ versions.sort_by{|v| [ v[:date], v[:uri] ] }
313
+ end
314
+ def extract_toplevel
315
+ result = {}
316
+ toplevel = @graph.query([nil, RDF::URI("http://purl.org/pav/hasCurrentVersion"), nil]).subjects.first
317
+ data = @data[toplevel.to_s]
318
+ if toplevel
319
+ license = {}
320
+ if data["http://purl.org/dc/terms/license"]
321
+ license_data = @data[data["http://purl.org/dc/terms/license"].first]
322
+ license[:url] = license_data["http://www.w3.org/1999/02/22-rdf-syntax-ns#value"]&.first
323
+ license[:icon] = license_data["http://xmlns.com/foaf/0.1/thumbnail"]&.first
324
+ license[:label] = license_data["http://www.w3.org/2000/01/rdf-schema#label"]
325
+ end
326
+ if data["http://purl.org/dc/terms/publisher"]
327
+ publisher_data = @data[data["http://purl.org/dc/terms/publisher"].first]
328
+ email = publisher_data["http://xmlns.com/foaf/0.1/mbox"]&.first
329
+ contact = { email: email }
330
+ name = publisher_data["http://xmlns.com/foaf/0.1/name"]
331
+ contact[:name] = name if name
332
+ members = []
333
+ if publisher_data["http://xmlns.com/foaf/0.1/member"]
334
+ publisher_data["http://xmlns.com/foaf/0.1/member"].each do |member|
335
+ member_data = @data[member]
336
+ members << {
337
+ name: member_data["http://xmlns.com/foaf/0.1/name"],
338
+ org: member_data["http://www.w3.org/2006/vcard/ns#organization-name"]
339
+ }
340
+ end
341
+ contact[:members] = members
342
+ end
343
+ end
344
+ result = {
345
+ uri: toplevel.to_s,
346
+ description: data["http://purl.org/dc/terms/description"],
347
+ license: license,
348
+ contact: contact,
349
+ }
350
+ end
351
+ result
352
+ end
251
353
 
252
354
  def output_turtle_files
253
- progressbar = ProgressBar.create(title: :output_turtle_files,
254
- total: @data.size,
255
- format: "(%t) %a %e %P% Processed: %c from %C")
256
- each_data do |uri, v|
257
- progressbar.increment
355
+ each_data(:output_turtle_files) do |uri, v|
258
356
  file = uri_mapping_to_path(uri, ".ttl")
259
357
  if @config[:output_dir]
260
358
  Dir.mkdir @config[:output_dir] if not File.exist? @config[:output_dir]
@@ -266,7 +364,6 @@ module TTL2HTML
266
364
  io.puts str.strip
267
365
  end
268
366
  end
269
- progressbar.finish
270
367
  end
271
368
  def uri_mapping_to_path(uri, suffix = ".html")
272
369
  path = nil
data/locales/en.yml CHANGED
@@ -3,11 +3,20 @@ en:
3
3
  title: "About %{title}"
4
4
  The properties for the textbook resources are as follows:
5
5
  shape-note: "The properties for the %{resource} resources are as follows:"
6
+ versions: Versions
7
+ version-release: "Version %{version} released."
8
+ version-triples: "%{triples} triples"
9
+ contact: Contact
10
+ contact-contribution: "This dataset was developed by %{name}"
11
+ contact-email: "For dataset inquiries, please contact at <a href=\"%{email}\">%{email}</a>"
6
12
  default:
7
13
  details: Details
8
14
  inverse_data: Referred resources
9
15
  index:
10
16
  list: "List of %{resource}"
17
+ latest-news: "Latest news"
18
+ past-versions: "Past versions"
19
+ license-text: "This dataset is freely usable as <a href=\"%{url}\">%{label}</a>"
11
20
  layout:
12
21
  rdf-data: RDF data
13
22
  shape-table:
data/locales/ja.yml CHANGED
@@ -2,11 +2,20 @@ ja:
2
2
  about:
3
3
  title: "%{title}について"
4
4
  shape-note: "%{resource}リソースが持つプロパティを下表に示します"
5
+ versions: 更新履歴
6
+ version-release: "バージョン%{version}を公開。"
7
+ version-triples: "%{triples}トリプル"
8
+ contact: 連絡先
9
+ contact-contribution: "本データセットは %{name} が開発したものです"
10
+ contact-email: "データセットに関する問い合わせは <a href=\"%{email}\">%{email}</a> までお問い合わせください。"
5
11
  default:
6
12
  details: 詳細情報
7
13
  inverse_data: 被参照情報
8
14
  index:
9
15
  list: "%{resource} 一覧"
16
+ latest-news: 最新のお知らせ
17
+ past-versions: 過去の更新履歴
18
+ license-text: "このデータセットは<a href=\"%{url}\">%{label}</a>として自由に利用できます。"
10
19
  layout:
11
20
  rdf-data: RDFデータ
12
21
  shape-table:
@@ -1,23 +1,67 @@
1
1
  <div class="jumbotron">
2
2
  <div class="container">
3
3
  <h1><%=h t("about.title", title: param[:site_title]) %></h1>
4
+ <%- if param[:toplevel] and param[:toplevel][:description] -%>
5
+ <p><%= get_language_literal(param[:toplevel][:description]) %></p>
6
+ <%- end -%>
4
7
  </div>
5
8
  </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
9
  <div class="container">
10
+ <div class="row">
11
+ <div class="col-md-12">
12
+ <nav aria-label="breadcrumb">
13
+ <ol class="breadcrumb">
14
+ <li class="breadcrumb-item"><a href="./"><i class="bi bi-house-door-fill"></i> Home</a></li>
15
+ <li class="breadcrumb-item active" aria-current="page"><%=h t("about.title", title: param[:site_title]) %></li>
16
+ </ol>
17
+ </nav>
18
+ </div>
19
+ </div>
20
+ <%- if param[:shapes] -%>
13
21
  <div class="row">
14
22
  <div class="col-md">
15
- <%- param[:content].keys.sort.each do |shape| -%>
16
- <h3><%=h param[:content][shape][:label] %></h3>
17
- <p><%= param[:content][shape][:comment] %></p>
18
- <p><%=h t("about.shape-note", resource: param[:content][shape][:label]) %></p>
19
- <%= param[:content][shape][:html] -%>
23
+ <%- param[:shapes].keys.sort.each do |shape| -%>
24
+ <h3><%=h param[:shapes][shape][:label] %></h3>
25
+ <p><%= param[:shapes][shape][:comment] %></p>
26
+ <p><%=h t("about.shape-note", resource: param[:shapes][shape][:label]) %></p>
27
+ <%= param[:shapes][shape][:html] -%>
20
28
  <%- end -%>
21
29
  </div>
22
30
  </div>
23
- </div>
31
+ <%- end -%>
32
+ <%- if param[:versions] -%>
33
+ <div class="row">
34
+ <div class="col-md">
35
+ <h2 id="versions"><%=h t("about.versions") %> <i class="bi bi-info-circle"></i></h2>
36
+ <dl>
37
+ <%- param[:versions].reverse_each do |version| -%>
38
+ <%= format_version_info(version) %>
39
+ <%- end -%>
40
+ </dl>
41
+ </div>
42
+ </div>
43
+ <%- end -%>
44
+ <%- if param[:toplevel] and param[:toplevel][:contact] -%>
45
+ <div class="row">
46
+ <div class="col-md">
47
+ <h2 id="contact"><%=h t("about.contact") %></h2>
48
+ <%- if param[:toplevel][:contact][:name] -%>
49
+ <p><%=h t("about.contact-contribution", name: get_language_literal(param[:toplevel][:contact][:name])) %></p>
50
+ <%- end -%>
51
+ <%- if param[:toplevel][:contact][:members] -%>
52
+ <ul>
53
+ <%- param[:toplevel][:contact][:members].each do |member| -%>
54
+ <li><%=h get_language_literal(member[:name]) %>
55
+ <%- if member[:org] -%>
56
+ (<%=h get_language_literal(member[:org]) %>)
57
+ <%- end -%>
58
+ <%- end -%>
59
+ </ul>
60
+ <%- end -%>
61
+ <%- if param[:toplevel][:contact][:email] -%>
62
+ <p><%= t("about.contact-email", email: param[:toplevel][:contact][:email]) %></p>
63
+ <%- end -%>
64
+ </div>
65
+ </div>
66
+ <%- end -%>
67
+ </div>
@@ -1,6 +1,9 @@
1
1
  <div class="jumbotron">
2
2
  <div class="container">
3
3
  <h1><%=h param[:site_title] %></h1>
4
+ <%- if param[:toplevel] and param[:toplevel][:description] -%>
5
+ <p><%= get_language_literal(param[:toplevel][:description]) %></p>
6
+ <%- end -%>
4
7
  <p><i class="bi bi-link-45deg"></i> <a href="<%=h param[:base_uri] %>"><%=h param[:base_uri] %></a></p>
5
8
  </div>
6
9
  </div>
@@ -9,10 +12,31 @@
9
12
  <div class="col-md-12">
10
13
  <h2><%=h t("index.list", resource: param[:class_label]) %></h2>
11
14
  <ul>
12
- <% param[:index_data].each do |e| %>
15
+ <%- param[:index_data].each do |e| -%>
13
16
  <li><%= format_object(e, param[:data_global]) %></li>
14
- <% end %>
17
+ <%- end -%>
15
18
  </ul>
16
19
  </div>
17
20
  </div>
18
- </div>
21
+ <%- if param[:versions].size > 0 -%>
22
+ <div class="row">
23
+ <div class="col-md">
24
+ <h2 id="versions"><%=h t("index.latest-news") %> <i class="bi bi-info-circle"></i></h2>
25
+ <dl>
26
+ <%= format_version_info(param[:versions].last) %>
27
+ </dl>
28
+ <%- if param[:versions].size > 1 -%>
29
+ <p><a href="about#versions">&raquo; <%=h t("index.past-versions") %></a></p>
30
+ <%- end -%>
31
+ <%- if param[:toplevel] and param[:toplevel][:license] -%>
32
+ <p>
33
+ <%- if param[:toplevel][:license][:icon] -%>
34
+ <a href="<%=h param[:toplevel][:license][:url] %>"><img src="<%=h param[:toplevel][:license][:icon] %>"></a>
35
+ <%- end -%>
36
+ <%= t("index.license-text", label: get_language_literal(param[:toplevel][:license][:label]), url: param[:toplevel][:license][:url]) %>
37
+ </p>
38
+ <%- end -%>
39
+ </div>
40
+ </div>
41
+ <%- end -%>
42
+ </div>
@@ -6,22 +6,31 @@
6
6
  <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
7
7
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
8
8
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.1/font/bootstrap-icons.css">
9
- <title><% if param[:title] %><%=h param[:title] %><% end %><% if param[:site_title] %> - <%=h param[:site_title] %><% end %></title>
9
+ <%- if param[:css_file] -%>
10
+ <link rel="stylesheet" href="<%=h relative_path(param[:css_file]) %>">
11
+ <%- end -%>
12
+ <%- if param[:custom_css] -%>
13
+ <style type="text/css"><%=h param[:custom_css] %></style>
14
+ <%- end -%>
15
+ <title><%=h html_title(param) %></title>
10
16
  <meta name="twitter:card" content="summary">
11
- <meta name="twitter:title" content="<% if param[:title] %><%=h param[:title] %><% end %><% if param[:site_title] %> - <%=h param[:site_title] %><% end %>">
17
+ <meta name="twitter:title" content="<%=h html_title(param) %>">
12
18
  </head>
13
19
  <body>
14
- <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
20
+ <nav class="navbar navbar-expand-lg navbar-light">
21
+ <%- if param[:logo] -%>
22
+ <a class="navbar-brand" href="/"><img src="<%=h relative_path(param[:logo]) %>" height="30"></a>
23
+ <%- end -%>
15
24
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
16
25
  <span class="navbar-toggler-icon"></span>
17
26
  </button>
18
27
  <div class="collapse navbar-collapse" id="navbarSupportedContent">
19
28
  <ul class="navbar-nav mr-auto">
20
- <li class="nav-item<%= ' class="active"' if param[:active] == :home %>">
21
- <a class="navbar-brand" href="/">Home</a>
29
+ <li class="nav-item<%= ' active' if @template == "index.html.erb" %>">
30
+ <a class="nav-link" href="/">Home</a>
22
31
  </li>
23
- <li class="nav-item<%= ' class="active"' if param[:active] == :about %>">
24
- <a class="navbar-brand" href="/about">About</a>
32
+ <li class="nav-item<%= ' active' if @template == "about.html.erb" %>">
33
+ <a class="nav-link" href="/about">About</a>
25
34
  </li>
26
35
  </ul>
27
36
  </div>
@@ -30,7 +39,15 @@
30
39
  <hr>
31
40
  <footer>
32
41
  <%- if param[:uri] -%>
33
- <p class="text-right"><a href="<%=h relative_path(param[:turtle_uri]) %>"><img src="https://www.w3.org/RDF/icons/rdf_flyer.24" alt="<%=h t("layout.rdf-data") %>"></a></p>
42
+ <p class="float-right"><a href="<%=h relative_path(param[:turtle_uri]) %>"><img src="https://www.w3.org/RDF/icons/rdf_flyer.24" alt="<%=h t("layout.rdf-data") %>"></a></p>
43
+ <%- end -%>
44
+ <%- if param[:admin_name] -%>
45
+ <p>
46
+ <%- if param[:copyright_year] -%>
47
+ &copy; <%=h param[:copyright_year] %>
48
+ <%- end -%>
49
+ <%=h param[:admin_name] %>
50
+ </p>
34
51
  <%- end -%>
35
52
  </footer>
36
53
 
@@ -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 -%>
@@ -0,0 +1,28 @@
1
+ <dt><%=h param[:data][:date] %></dt>
2
+ <dd><%=h t("about.version-release", version: param[:data][:version]) %></dd>
3
+ <dd><%=h get_language_literal(param[:data][:description]) %></dd>
4
+ <%- if param[:data][:datadump] -%>
5
+ <dd><ul>
6
+ <li><a href="<%=h param[:data][:datadump] %>"><%=h File.basename(param[:data][:datadump]) %></a>
7
+ <%-
8
+ fileinfo = []
9
+ if param[:data][:triples]
10
+ fileinfo << t("about.version-triples", triples: number_with_delimiter(param[:data][:triples].to_i))
11
+ end
12
+ if param[:data][:bytesize]
13
+ fileinfo << number_to_human_size(param[:data][:bytesize])
14
+ end
15
+ -%>
16
+ <%- if fileinfo.size > 0 -%>
17
+ (<%=h fileinfo.join(", ") %>)
18
+ <%- end -%>
19
+ <%- if param[:data][:subset].size > 0 -%>
20
+ <ul>
21
+ <%- param[:data][:subset].each do |subset| -%>
22
+ <li><a href="<%=h subset %>"><%=h File.basename(subset) %></a></li>
23
+ <%- end -%>
24
+ </ul>
25
+ </li>
26
+ <%- end -%>
27
+ </dd>
28
+ <%- end -%>
metadata CHANGED
@@ -1,14 +1,14 @@
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masao Takaku
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-04 00:00:00.000000000 Z
11
+ date: 2021-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: actionview
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -146,6 +160,7 @@ files:
146
160
  - templates/layout.html.erb
147
161
  - templates/shape-table.html.erb
148
162
  - templates/triples.html.erb
163
+ - templates/version.html.erb
149
164
  homepage: https://github.com/masao/ttl2html
150
165
  licenses:
151
166
  - MIT
@@ -165,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
180
  - !ruby/object:Gem::Version
166
181
  version: '0'
167
182
  requirements: []
168
- rubygems_version: 3.2.3
183
+ rubygems_version: 3.3.3
169
184
  signing_key:
170
185
  specification_version: 4
171
186
  summary: ttl2html