ttl2html 1.2.0 → 1.3.3
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 +4 -4
- data/lib/ttl2html/template.rb +40 -4
- data/lib/ttl2html/version.rb +1 -1
- data/lib/ttl2html.rb +155 -20
- data/locales/en.yml +12 -1
- data/locales/ja.yml +12 -1
- data/templates/about.html.erb +53 -11
- data/templates/default.html.erb +25 -5
- data/templates/index.html.erb +28 -4
- data/templates/layout.html.erb +37 -12
- data/templates/triples.html.erb +22 -14
- data/templates/version.html.erb +28 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7971e142aa8344f4ef07bea779f430a94a986014768c1876dcb4ab0e56c0c788
|
4
|
+
data.tar.gz: aa5cca9ebcc358b4f2697f68a86ce2edf998f83bbe4c67e2c11512cdf2a7e5f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f1d25cb74cdbbf69b6b7826edcdea833bc9286f9035a03a85c4f925553364da6c7a1f2713da767a75076a4c8ebc3ac064e639e04ed0c5625607f96cc2a52254
|
7
|
+
data.tar.gz: 04435256e3234d30eb7942e64a627cb6bf3e32dbe8e440f2f69711a62da4c14fc5d222d9cddc56bc11eebcd3708c8e27ea1ca0bd31e570b8be3654e8adac1eab
|
data/lib/ttl2html/template.rb
CHANGED
@@ -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
|
@@ -156,16 +158,33 @@ 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
|
171
|
+
def shorten_title(title, length = 140)
|
172
|
+
if title.length > length
|
173
|
+
title[0..length] + "..."
|
174
|
+
else
|
175
|
+
title
|
176
|
+
end
|
177
|
+
end
|
159
178
|
def get_title(data, default_title = "no title")
|
160
179
|
if @param[:title_property_perclass] and data["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
|
161
180
|
@param[:title_property_perclass].each do |klass, property|
|
162
181
|
if data["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"].include?(klass) and data[property]
|
163
|
-
return get_language_literal(data[property])
|
182
|
+
return shorten_title(get_language_literal(data[property]))
|
164
183
|
end
|
165
184
|
end
|
166
185
|
end
|
167
186
|
if @param[:title_property] and data[@param[:title_property]]
|
168
|
-
return get_language_literal(data[@param[:title_property]])
|
187
|
+
return shorten_title(get_language_literal(data[@param[:title_property]]))
|
169
188
|
end
|
170
189
|
%w(
|
171
190
|
http://www.w3.org/2000/01/rdf-schema#label
|
@@ -174,7 +193,7 @@ module TTL2HTML
|
|
174
193
|
http://schema.org/name
|
175
194
|
http://www.w3.org/2004/02/skos/core#prefLabel
|
176
195
|
).each do |property|
|
177
|
-
return get_language_literal(data[property]) if data[property]
|
196
|
+
return shorten_title(get_language_literal(data[property])) if data[property]
|
178
197
|
end
|
179
198
|
default_title
|
180
199
|
end
|
@@ -212,8 +231,9 @@ module TTL2HTML
|
|
212
231
|
object
|
213
232
|
end
|
214
233
|
end
|
215
|
-
def format_triples(triples)
|
234
|
+
def format_triples(triples, type = :default)
|
216
235
|
param_local = @param.dup.merge(data: triples)
|
236
|
+
param_local[:type] = type
|
217
237
|
if @param[:labels_with_class] and triples["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
|
218
238
|
@param[:labels_with_class].reverse_each do |k, v|
|
219
239
|
triples["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"].each do |entity_class|
|
@@ -226,7 +246,23 @@ module TTL2HTML
|
|
226
246
|
end
|
227
247
|
end
|
228
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
|
229
261
|
to_html_raw("triples.html.erb", param_local)
|
230
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
|
231
267
|
end
|
232
268
|
end
|
data/lib/ttl2html/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
TTL2HTML::VERSION = "1.
|
1
|
+
TTL2HTML::VERSION = "1.3.3"
|
data/lib/ttl2html.rb
CHANGED
@@ -105,11 +105,16 @@ module TTL2HTML
|
|
105
105
|
result
|
106
106
|
end
|
107
107
|
|
108
|
-
def each_data
|
108
|
+
def each_data(label = :each_data)
|
109
|
+
progressbar = ProgressBar.create(title: label,
|
110
|
+
total: @data.size,
|
111
|
+
format: "(%t) %a %e %P% Processed: %c from %C")
|
109
112
|
@data.each do |uri, v|
|
113
|
+
progressbar.increment
|
110
114
|
next if not uri.start_with? @config[:base_uri]
|
111
115
|
yield uri, v
|
112
116
|
end
|
117
|
+
progressbar.finish
|
113
118
|
end
|
114
119
|
def output_html_files
|
115
120
|
template = Template.new("", @config)
|
@@ -117,6 +122,8 @@ module TTL2HTML
|
|
117
122
|
RDF::URI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
|
118
123
|
RDF::URI("http://www.w3.org/ns/shacl#NodeShape")])
|
119
124
|
labels = shapes2labels(shapes)
|
125
|
+
versions = extract_versions
|
126
|
+
toplevel = extract_toplevel
|
120
127
|
@config[:labels_with_class] ||= {}
|
121
128
|
labels.each do |klass, props|
|
122
129
|
props.each do |property, label|
|
@@ -128,18 +135,19 @@ module TTL2HTML
|
|
128
135
|
end
|
129
136
|
end
|
130
137
|
end
|
131
|
-
|
132
|
-
|
133
|
-
format: "(%t) %a %e %P% Processed: %c from %C")
|
134
|
-
each_data do |uri, v|
|
135
|
-
progressbar.increment
|
138
|
+
@config[:orders_with_class] = shapes2orders(shapes)
|
139
|
+
each_data(:output_html_files) do |uri, v|
|
136
140
|
template = Template.new("default.html.erb", @config)
|
137
141
|
param = @config.dup
|
138
142
|
param[:uri] = uri
|
143
|
+
param[:turtle_uri] = uri_mapping_to_path(uri, ".ttl")
|
139
144
|
param[:data] = v
|
140
145
|
param[:data_inverse] = @data_inverse[uri]
|
141
146
|
param[:data_global] = @data
|
142
147
|
param[:title] = template.get_title(v)
|
148
|
+
if param[:breadcrumbs]
|
149
|
+
param[:breadcrumbs_items] = build_breadcrumbs(uri, template)
|
150
|
+
end
|
143
151
|
file = uri_mapping_to_path(uri, ".html")
|
144
152
|
if @config[:output_dir]
|
145
153
|
Dir.mkdir @config[:output_dir] if not File.exist? @config[:output_dir]
|
@@ -147,7 +155,6 @@ module TTL2HTML
|
|
147
155
|
end
|
148
156
|
template.output_to(file, param)
|
149
157
|
end
|
150
|
-
progressbar.finish
|
151
158
|
index_html = "index.html"
|
152
159
|
index_html = File.join(@config[:output_dir], "index.html") if @config[:output_dir]
|
153
160
|
if @config.has_key? :top_class
|
@@ -161,6 +168,8 @@ module TTL2HTML
|
|
161
168
|
template = Template.new("index.html.erb", @config)
|
162
169
|
param = @config.dup
|
163
170
|
param[:data_global] = @data
|
171
|
+
param[:versions] = versions
|
172
|
+
param[:toplevel] = toplevel
|
164
173
|
subjects.sort.each do |subject|
|
165
174
|
param[:index_data] ||= []
|
166
175
|
param[:index_data] << subject.to_s
|
@@ -168,24 +177,32 @@ module TTL2HTML
|
|
168
177
|
template.output_to(index_html, param)
|
169
178
|
end
|
170
179
|
end
|
171
|
-
if shapes.size > 0
|
180
|
+
if shapes.size > 0 or versions.size > 0 or toplevel.size > 0
|
172
181
|
about_html = @config[:about_file] || "about.html"
|
173
182
|
about_html = File.join(@config[:output_dir], about_html) if @config[:output_dir]
|
174
183
|
template = Template.new("about.html.erb", @config)
|
175
184
|
param = @config.dup
|
176
185
|
param[:data_global] = @data
|
177
|
-
param[:
|
186
|
+
param[:versions] = versions
|
187
|
+
param[:toplevel] = toplevel
|
188
|
+
param[:shapes] = {}
|
178
189
|
shapes.subjects.each do |subject|
|
179
|
-
label = nil
|
190
|
+
label = comment = nil
|
180
191
|
target_class = @data[subject.to_s]["http://www.w3.org/ns/shacl#targetClass"]
|
181
192
|
if target_class
|
182
|
-
|
183
|
-
|
193
|
+
target_class = target_class.first
|
194
|
+
if @data[target_class]
|
195
|
+
label = template.get_title(@data[target_class], nil)
|
196
|
+
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"]
|
197
|
+
else
|
198
|
+
label = template.format_property(target_class)
|
199
|
+
end
|
184
200
|
else
|
185
201
|
label = template.get_title(@data[subject.to_s])
|
186
202
|
end
|
187
|
-
param[:
|
203
|
+
param[:shapes][subject] = {
|
188
204
|
label: label,
|
205
|
+
comment: comment,
|
189
206
|
html: template.expand_shape(@data, subject.to_s, @prefix),
|
190
207
|
}
|
191
208
|
end
|
@@ -193,6 +210,36 @@ module TTL2HTML
|
|
193
210
|
end
|
194
211
|
end
|
195
212
|
|
213
|
+
def build_breadcrumbs(uri, template, depth = 0)
|
214
|
+
results = []
|
215
|
+
data = @data[uri]
|
216
|
+
if @config[:breadcrumbs]
|
217
|
+
if depth == 0
|
218
|
+
first_label = template.get_title(data)
|
219
|
+
first_label = data[@config[:breadcrumbs].first["label"]].first if @config[:breadcrumbs].first["label"] and data[@config[:breadcrumbs].first["label"]]
|
220
|
+
results << { label: first_label }
|
221
|
+
end
|
222
|
+
@config[:breadcrumbs].each do |e|
|
223
|
+
data_target = data
|
224
|
+
data_target = @data_inverse[uri] if e["inverse"]
|
225
|
+
if data_target and data_target[e["property"]]
|
226
|
+
data_target[e["property"]].each do |parent|
|
227
|
+
data_parent = @data[parent]
|
228
|
+
label = template.get_title(data_parent)
|
229
|
+
label = data_parent[e["label"]].first if e["label"] and data_parent[e["label"]]
|
230
|
+
results << {
|
231
|
+
uri: parent,
|
232
|
+
label: label,
|
233
|
+
}
|
234
|
+
results += build_breadcrumbs(parent, template, depth + 1)
|
235
|
+
end
|
236
|
+
return results
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
results
|
241
|
+
end
|
242
|
+
|
196
243
|
def shapes2labels(shapes)
|
197
244
|
labels = {}
|
198
245
|
shapes.subjects.each do |shape|
|
@@ -208,13 +255,102 @@ module TTL2HTML
|
|
208
255
|
end
|
209
256
|
labels
|
210
257
|
end
|
258
|
+
def shapes2orders(shapes)
|
259
|
+
orders = {}
|
260
|
+
shapes.subjects.each do |shape|
|
261
|
+
target_class = @data[shape.to_s]["http://www.w3.org/ns/shacl#targetClass"]&.first
|
262
|
+
if target_class
|
263
|
+
@data[shape.to_s]["http://www.w3.org/ns/shacl#property"].each do |property|
|
264
|
+
path = @data[property]["http://www.w3.org/ns/shacl#path"].first
|
265
|
+
order = @data[property]["http://www.w3.org/ns/shacl#order"]
|
266
|
+
orders[target_class] ||= {}
|
267
|
+
orders[target_class][path] = order&.first&.to_i
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
orders
|
272
|
+
end
|
273
|
+
|
274
|
+
def extract_versions
|
275
|
+
versions = []
|
276
|
+
["http://purl.org/pav/hasVersion", "http://purl.org/pav/hasCurrentVersion", "http://purl.org/dc/terms/hasVersion"].each do |prop|
|
277
|
+
objects = @graph.query([nil, RDF::URI(prop), nil]).objects
|
278
|
+
objects.each do |o|
|
279
|
+
uri = o.to_s
|
280
|
+
version = @data[uri]
|
281
|
+
next if not version
|
282
|
+
next if not version["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"].include? "http://rdfs.org/ns/void#Dataset"
|
283
|
+
description = version["http://purl.org/dc/terms/description"]
|
284
|
+
if not description
|
285
|
+
qrev = version["http://www.w3.org/ns/prov#qualifiedRevision"]&.first
|
286
|
+
if description = @data[qrev]
|
287
|
+
description = @data[qrev]["http://www.w3.org/2000/01/rdf-schema#comment"]
|
288
|
+
end
|
289
|
+
end
|
290
|
+
subset = []
|
291
|
+
if version["http://rdfs.org/ns/void#subset"]
|
292
|
+
version["http://rdfs.org/ns/void#subset"].each do |s|
|
293
|
+
subset << @data[s]["http://rdfs.org/ns/void#dataDump"].first
|
294
|
+
end
|
295
|
+
end
|
296
|
+
date = version["http://purl.org/pav/createdOn"]&.first
|
297
|
+
date = version["http://purl.org/dc/terms/issued"]&.first if date.nil?
|
298
|
+
versions << {
|
299
|
+
uri: uri,
|
300
|
+
version: version["http://purl.org/pav/version"]&.first,
|
301
|
+
triples: version["http://rdfs.org/ns/void#triples"]&.first,
|
302
|
+
datadump: version["http://rdfs.org/ns/void#dataDump"]&.first,
|
303
|
+
bytesize: version["http://www.w3.org/ns/dcat#byteSize"]&.first,
|
304
|
+
date: date,
|
305
|
+
description: description,
|
306
|
+
subset: subset,
|
307
|
+
}
|
308
|
+
end
|
309
|
+
end
|
310
|
+
versions.sort_by{|v| [ v[:date], v[:uri] ] }
|
311
|
+
end
|
312
|
+
def extract_toplevel
|
313
|
+
result = {}
|
314
|
+
toplevel = @graph.query([nil, RDF::URI("http://purl.org/pav/hasCurrentVersion"), nil]).subjects.first
|
315
|
+
data = @data[toplevel.to_s]
|
316
|
+
if toplevel
|
317
|
+
license = {}
|
318
|
+
if data["http://purl.org/dc/terms/license"]
|
319
|
+
license_data = @data[data["http://purl.org/dc/terms/license"].first]
|
320
|
+
license[:url] = license_data["http://www.w3.org/1999/02/22-rdf-syntax-ns#value"]&.first
|
321
|
+
license[:icon] = license_data["http://xmlns.com/foaf/0.1/thumbnail"]&.first
|
322
|
+
license[:label] = license_data["http://www.w3.org/2000/01/rdf-schema#label"]
|
323
|
+
end
|
324
|
+
if data["http://purl.org/dc/terms/publisher"]
|
325
|
+
publisher_data = @data[data["http://purl.org/dc/terms/publisher"].first]
|
326
|
+
email = publisher_data["http://xmlns.com/foaf/0.1/mbox"]&.first
|
327
|
+
contact = { email: email }
|
328
|
+
name = publisher_data["http://xmlns.com/foaf/0.1/name"]
|
329
|
+
contact[:name] = name if name
|
330
|
+
members = []
|
331
|
+
if publisher_data["http://xmlns.com/foaf/0.1/member"]
|
332
|
+
publisher_data["http://xmlns.com/foaf/0.1/member"].each do |member|
|
333
|
+
member_data = @data[member]
|
334
|
+
members << {
|
335
|
+
name: member_data["http://xmlns.com/foaf/0.1/name"],
|
336
|
+
org: member_data["http://www.w3.org/2006/vcard/ns#organization-name"]
|
337
|
+
}
|
338
|
+
end
|
339
|
+
contact[:members] = members
|
340
|
+
end
|
341
|
+
end
|
342
|
+
result = {
|
343
|
+
uri: toplevel.to_s,
|
344
|
+
description: data["http://purl.org/dc/terms/description"],
|
345
|
+
license: license,
|
346
|
+
contact: contact,
|
347
|
+
}
|
348
|
+
end
|
349
|
+
result
|
350
|
+
end
|
211
351
|
|
212
352
|
def output_turtle_files
|
213
|
-
|
214
|
-
total: @data.size,
|
215
|
-
format: "(%t) %a %e %P% Processed: %c from %C")
|
216
|
-
each_data do |uri, v|
|
217
|
-
progressbar.increment
|
353
|
+
each_data(:output_turtle_files) do |uri, v|
|
218
354
|
file = uri_mapping_to_path(uri, ".ttl")
|
219
355
|
if @config[:output_dir]
|
220
356
|
Dir.mkdir @config[:output_dir] if not File.exist? @config[:output_dir]
|
@@ -226,7 +362,6 @@ module TTL2HTML
|
|
226
362
|
io.puts str.strip
|
227
363
|
end
|
228
364
|
end
|
229
|
-
progressbar.finish
|
230
365
|
end
|
231
366
|
def uri_mapping_to_path(uri, suffix = ".html")
|
232
367
|
path = nil
|
@@ -292,4 +427,4 @@ module TTL2HTML
|
|
292
427
|
file
|
293
428
|
end
|
294
429
|
end
|
295
|
-
end
|
430
|
+
end
|
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:
|
@@ -23,4 +32,6 @@ en:
|
|
23
32
|
optional: "Optional"
|
24
33
|
non-repeatable: "Non repeatable"
|
25
34
|
blank-node-structure: "The structural contents of a blank node are as follows:"
|
26
|
-
blank-node-or-structure: "The structural contents of a blank node are either of the followings:"
|
35
|
+
blank-node-or-structure: "The structural contents of a blank node are either of the followings:"
|
36
|
+
triples:
|
37
|
+
inverse_refered: "Referred to as '%{property}' from:"
|
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:
|
@@ -22,4 +31,6 @@ ja:
|
|
22
31
|
optional: 省略可能
|
23
32
|
non-repeatable: 繰り返し無し
|
24
33
|
blank-node-structure: ブランクノードの内容は以下の内容からなる構造を持ちます。
|
25
|
-
blank-node-or-structure: ブランクノードの内容は以下のいずれかの内容からなる構造を持ちます。
|
34
|
+
blank-node-or-structure: ブランクノードの内容は以下のいずれかの内容からなる構造を持ちます。
|
35
|
+
triples:
|
36
|
+
inverse_refered: "'%{property}'としての参照元:"
|
data/templates/about.html.erb
CHANGED
@@ -1,25 +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
9
|
<div class="container">
|
7
10
|
<div class="row">
|
8
11
|
<div class="col-md-12">
|
9
|
-
<
|
10
|
-
<
|
11
|
-
|
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>
|
13
18
|
</div>
|
14
19
|
</div>
|
15
|
-
|
20
|
+
<%- if param[:shapes] -%>
|
16
21
|
<div class="row">
|
17
|
-
<div class="col-md
|
18
|
-
<%- param[:
|
19
|
-
<h3><%=h param[:
|
20
|
-
<p><%= param[:
|
21
|
-
<p><%=h t("about.shape-note", resource: param[:
|
22
|
-
<%= param[:
|
22
|
+
<div class="col-md">
|
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] -%>
|
23
28
|
<%- end -%>
|
24
29
|
</div>
|
25
30
|
</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>
|
data/templates/default.html.erb
CHANGED
@@ -1,22 +1,42 @@
|
|
1
1
|
<div class="jumbotron">
|
2
2
|
<div class="container">
|
3
3
|
<h1><%=h param[:title] %></h1>
|
4
|
-
<p><
|
4
|
+
<p><i class="bi bi-link-45deg"></i> <a href="<%=h param[:uri] %>"><%=h param[:uri] %></a></p>
|
5
5
|
</div>
|
6
6
|
</div>
|
7
7
|
<div class="container">
|
8
|
+
<%- if param[:breadcrumbs] -%>
|
9
|
+
<div class="row">
|
10
|
+
<div class="col-md-12">
|
11
|
+
<nav aria-label="breadcrumb">
|
12
|
+
<ol class="breadcrumb">
|
13
|
+
<li class="breadcrumb-item"><a href="./"><i class="bi bi-house-door-fill"></i> Home</a></li>
|
14
|
+
<%- param[:breadcrumbs_items].reverse.each_with_index do |e, i| -%>
|
15
|
+
<li class="breadcrumb-item<%= ' active' if i == param[:breadcrumbs_items].size-1 %>" aria-current="page">
|
16
|
+
<%- if e[:uri] -%>
|
17
|
+
<a href="<%=h e[:uri] %>"><%=h e[:label] %></a>
|
18
|
+
<%- else -%>
|
19
|
+
<%=h e[:label] %>
|
20
|
+
<%- end -%>
|
21
|
+
</li>
|
22
|
+
<%- end -%>
|
23
|
+
</ol>
|
24
|
+
</nav>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<%- end -%>
|
8
28
|
<div class="row">
|
9
29
|
<div class="col-md-12">
|
10
30
|
<h2><%=h t("default.details") %></h2>
|
11
31
|
<%= format_triples(param[:data]) %>
|
12
32
|
</div>
|
13
33
|
</div>
|
14
|
-
|
34
|
+
<%- if param[:data_inverse] -%>
|
15
35
|
<div class="row inverse">
|
16
36
|
<div class="col-md-12">
|
17
37
|
<h2><%=h t("default.inverse_data") %></h2>
|
18
|
-
<%= format_triples(param[:data_inverse]) %>
|
38
|
+
<%= format_triples(param[:data_inverse], :inverse) %>
|
19
39
|
</div>
|
20
40
|
</div>
|
21
|
-
|
22
|
-
</div>
|
41
|
+
<%- end -%>
|
42
|
+
</div>
|
data/templates/index.html.erb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
<div class="jumbotron">
|
2
2
|
<div class="container">
|
3
3
|
<h1><%=h param[:site_title] %></h1>
|
4
|
-
|
4
|
+
<%- if param[:toplevel] and param[:toplevel][:description] -%>
|
5
|
+
<p><%= get_language_literal(param[:toplevel][:description]) %></p>
|
6
|
+
<%- end -%>
|
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>
|
7
10
|
<div class="container">
|
@@ -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
|
-
|
15
|
+
<%- param[:index_data].each do |e| -%>
|
13
16
|
<li><%= format_object(e, param[:data_global]) %></li>
|
14
|
-
|
17
|
+
<%- end -%>
|
15
18
|
</ul>
|
16
19
|
</div>
|
17
20
|
</div>
|
18
|
-
|
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">» <%=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>
|
data/templates/layout.html.erb
CHANGED
@@ -4,17 +4,34 @@
|
|
4
4
|
<meta charset="utf-8">
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
6
6
|
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
7
|
-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.
|
8
|
-
<
|
7
|
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
|
8
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.1/font/bootstrap-icons.css">
|
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>
|
9
16
|
<meta name="twitter:card" content="summary">
|
10
|
-
<meta name="twitter:title" content="
|
17
|
+
<meta name="twitter:title" content="<%=h html_title(param) %>">
|
11
18
|
</head>
|
12
19
|
<body>
|
13
|
-
<nav class="navbar navbar-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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 -%>
|
24
|
+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
25
|
+
<span class="navbar-toggler-icon"></span>
|
26
|
+
</button>
|
27
|
+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
28
|
+
<ul class="navbar-nav mr-auto">
|
29
|
+
<li class="nav-item<%= ' active' if @template == "index.html.erb" %>">
|
30
|
+
<a class="nav-link" href="/">Home</a>
|
31
|
+
</li>
|
32
|
+
<li class="nav-item<%= ' active' if @template == "about.html.erb" %>">
|
33
|
+
<a class="nav-link" href="/about">About</a>
|
34
|
+
</li>
|
18
35
|
</ul>
|
19
36
|
</div>
|
20
37
|
</nav>
|
@@ -22,13 +39,21 @@
|
|
22
39
|
<hr>
|
23
40
|
<footer>
|
24
41
|
<%- if param[:uri] -%>
|
25
|
-
<p class="
|
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
|
+
© <%=h param[:copyright_year] %>
|
48
|
+
<%- end -%>
|
49
|
+
<%=h param[:admin_name] %>
|
50
|
+
</p>
|
26
51
|
<%- end -%>
|
27
52
|
</footer>
|
28
53
|
|
29
54
|
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
30
|
-
<script src="https://code.jquery.com/jquery-3.
|
31
|
-
<script src="https://
|
32
|
-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.
|
55
|
+
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
56
|
+
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
|
57
|
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
|
33
58
|
</body>
|
34
59
|
</html>
|
data/templates/triples.html.erb
CHANGED
@@ -1,16 +1,24 @@
|
|
1
|
-
<dl>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<dl class="row">
|
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| -%>
|
7
|
+
<%- if param[:type] == :inverse -%>
|
8
|
+
<dt class="col-sm-3"><%=h t('triples.inverse_refered', property: format_property(k, param[:labels])) %></dt>
|
9
|
+
<%- else -%>
|
10
|
+
<dt class="col-sm-3"><%=h format_property(k, param[:labels]) %></dt>
|
11
|
+
<%- end -%>
|
12
|
+
<%- if v.respond_to? :has_key? -%>
|
13
|
+
<% v.each_with_index do |v2, idx| %>
|
14
|
+
<dd class="col-sm-9<%= ' offset-sm-3' if idx > 0 %>" lang="<%=h v2[0] %>"><%= format_object v2[1], param[:data] %></dd>
|
7
15
|
<% end %>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<dd><%= format_object v.first, param[:data] %></dd>
|
14
|
-
|
16
|
+
<%- elsif v.size > 1 -%>
|
17
|
+
<%- v.each_with_index do |v2, idx| -%>
|
18
|
+
<dd class="col-sm-9<%= ' offset-sm-3' if idx > 0 %>"><%= format_object v2, param[:data] %></dd>
|
19
|
+
<%- end -%>
|
20
|
+
<%- else -%>
|
21
|
+
<dd class="col-sm-9"><%= format_object v.first, param[:data] %></dd>
|
22
|
+
<%- end -%>
|
15
23
|
<%- end -%>
|
16
|
-
</dl>
|
24
|
+
</dl>
|
@@ -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.
|
4
|
+
version: 1.3.3
|
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-
|
11
|
+
date: 2021-12-29 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.
|
183
|
+
rubygems_version: 3.2.32
|
169
184
|
signing_key:
|
170
185
|
specification_version: 4
|
171
186
|
summary: ttl2html
|