ttl2html 1.3.5 → 2.0.2
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 +46 -37
- data/lib/ttl2html/util.rb +32 -0
- data/lib/ttl2html/version.rb +1 -1
- data/lib/ttl2html.rb +123 -67
- data/locales/en.yml +3 -0
- data/locales/ja.yml +3 -0
- data/templates/about.html.erb +17 -23
- data/templates/default.html.erb +6 -3
- data/templates/index-list.html.erb +20 -0
- data/templates/index.html.erb +3 -11
- data/templates/layout.html.erb +18 -7
- data/templates/shape-table.html.erb +15 -3
- data/templates/triples-blank.html.erb +4 -0
- data/templates/triples-inverse.html.erb +20 -0
- data/templates/triples.html.erb +13 -11
- data/templates/version.html.erb +2 -2
- metadata +7 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71b5a2abdcc42e13003a2ceca9c3c29ed0ff866c472a058354a469868a244269
|
|
4
|
+
data.tar.gz: de4d3bd146d80800f7f4358a0f843479e5f8583436d4af550ddef4643af60c06
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54d9bfb81e8fce12a3b0158e888a67bd6b718f7ab1efa35d09fc18ba8d7c596c226a08017894823d1baf6f637f3080e7211f44c85f4ff5a37546fde3b25b5838
|
|
7
|
+
data.tar.gz: fc40d4fc10a284b152802eef7069d786ea307d4a6713ffff1fd30dee7d46c1605f8b328e5d598f3913b0345d8e20f038cae623497453f2e5e0b6e0adedb4aeb5
|
data/lib/ttl2html/template.rb
CHANGED
|
@@ -59,6 +59,7 @@ module TTL2HTML
|
|
|
59
59
|
def expand_shape(data, uri, prefixes = {})
|
|
60
60
|
return nil if not data[uri]
|
|
61
61
|
return nil if not data[uri]["http://www.w3.org/ns/shacl#property"]
|
|
62
|
+
prefix_used = {}
|
|
62
63
|
result = data[uri]["http://www.w3.org/ns/shacl#property"].sort_by do |e|
|
|
63
64
|
e["http://www.w3.org/ns/shacl#order"]
|
|
64
65
|
end.map do |property|
|
|
@@ -67,6 +68,7 @@ module TTL2HTML
|
|
|
67
68
|
prefixes.each do |prefix, val|
|
|
68
69
|
if path.index(val) == 0
|
|
69
70
|
shorten_path = path.sub(/\A#{val}/, "#{prefix}:")
|
|
71
|
+
prefix_used[prefix] = val
|
|
70
72
|
end
|
|
71
73
|
end
|
|
72
74
|
repeatable = false
|
|
@@ -107,41 +109,16 @@ module TTL2HTML
|
|
|
107
109
|
nodeKind: data[property]["http://www.w3.org/ns/shacl#nodeKind"] ? data[property]["http://www.w3.org/ns/shacl#nodeKind"].first : nil,
|
|
108
110
|
nodes: nodes,
|
|
109
111
|
node_mode: node_mode,
|
|
112
|
+
prefix: prefix_used,
|
|
110
113
|
}
|
|
111
114
|
end
|
|
112
115
|
template = "shape-table.html.erb"
|
|
113
116
|
tmpl = Template.new(template)
|
|
114
|
-
tmpl.to_html_raw(template, {properties: result})
|
|
117
|
+
tmpl.to_html_raw(template, { properties: result, prefix: prefix_used })
|
|
115
118
|
end
|
|
116
119
|
|
|
117
120
|
# helper method:
|
|
118
|
-
|
|
119
|
-
path = nil
|
|
120
|
-
if @param[:uri_mappings]
|
|
121
|
-
@param[:uri_mappings].each do |mapping|
|
|
122
|
-
local_file = uri.sub(@param[:base_uri], "")
|
|
123
|
-
if mapping["regexp"] =~ local_file
|
|
124
|
-
path = local_file.sub(mapping["regexp"], mapping["path"])
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
if path.nil?
|
|
129
|
-
if suffix == ".html"
|
|
130
|
-
if @param[:data_global] and @param[:data_global].keys.find{|e| e.start_with?(uri + "/") }
|
|
131
|
-
path = uri + "/index"
|
|
132
|
-
elsif uri.end_with?("/")
|
|
133
|
-
path = uri + "index"
|
|
134
|
-
else
|
|
135
|
-
path = uri
|
|
136
|
-
end
|
|
137
|
-
else
|
|
138
|
-
path = uri
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
path = path.sub(@param[:base_uri], "") if @param[:base_uri]
|
|
142
|
-
path << suffix
|
|
143
|
-
path
|
|
144
|
-
end
|
|
121
|
+
include TTL2HTML::Util
|
|
145
122
|
def relative_path(dest)
|
|
146
123
|
path = nil
|
|
147
124
|
dest_uri = RDF::IRI.parse(dest)
|
|
@@ -151,14 +128,19 @@ module TTL2HTML
|
|
|
151
128
|
src = @param[:output_file]
|
|
152
129
|
src = Pathname.new(src).relative_path_from(Pathname.new(@param[:output_dir])) if @param[:output_dir]
|
|
153
130
|
path = Pathname(dest).relative_path_from(Pathname(File.dirname src))
|
|
154
|
-
|
|
131
|
+
if @param[:output_dir] and File.directory?(Pathname.new(@param[:output_dir]) + path)
|
|
132
|
+
path = path.to_s + "/"
|
|
133
|
+
elsif File.directory?(path)
|
|
134
|
+
path = path.to_s + "/"
|
|
135
|
+
end
|
|
155
136
|
end
|
|
137
|
+
#p [ :relative_path, path, dest, src ]
|
|
156
138
|
path
|
|
157
139
|
end
|
|
158
|
-
def relative_path_uri(dest_uri, base_uri)
|
|
140
|
+
def relative_path_uri(dest_uri, base_uri = @param[:base_uri])
|
|
159
141
|
if dest_uri.start_with? base_uri
|
|
160
142
|
dest = dest_uri.sub(base_uri, "")
|
|
161
|
-
dest = uri_mapping_to_path(dest, "")
|
|
143
|
+
dest = uri_mapping_to_path(dest, @param, "")
|
|
162
144
|
relative_path(dest)
|
|
163
145
|
else
|
|
164
146
|
dest_uri
|
|
@@ -217,14 +199,18 @@ module TTL2HTML
|
|
|
217
199
|
object
|
|
218
200
|
end
|
|
219
201
|
end
|
|
220
|
-
def format_property(property, labels = {})
|
|
221
|
-
if
|
|
202
|
+
def format_property(property, labels = {}, subject = nil)
|
|
203
|
+
subject = @param[:blank_subject] if not subject and @param[:blank_subject]
|
|
204
|
+
subject_class = @param[:data_global][subject][RDF.type.to_s]&.first if subject
|
|
205
|
+
if subject_class and @param[:labels_with_class][subject_class] and @param[:labels_with_class][subject_class][property]
|
|
206
|
+
@param[:labels_with_class][subject_class][property]
|
|
207
|
+
elsif labels and labels[property]
|
|
222
208
|
labels[property]
|
|
223
209
|
else
|
|
224
210
|
property.split(/[\/\#]/).last.capitalize
|
|
225
211
|
end
|
|
226
212
|
end
|
|
227
|
-
def format_object(object, data)
|
|
213
|
+
def format_object(object, data, type = {})
|
|
228
214
|
if object =~ /\Ahttps?:\/\//
|
|
229
215
|
rel_path = relative_path_uri(object, param[:base_uri])
|
|
230
216
|
if param[:data_global][object]
|
|
@@ -233,12 +219,16 @@ module TTL2HTML
|
|
|
233
219
|
"<a href=\"#{rel_path}\">#{object}</a>"
|
|
234
220
|
end
|
|
235
221
|
elsif object =~ /\A_:/ and param[:data_global][object]
|
|
236
|
-
|
|
222
|
+
if type[:inverse] and param[:data_inverse_global][object]
|
|
223
|
+
format_triples(param[:data_inverse_global][object], inverse: true, blank: true)
|
|
224
|
+
else
|
|
225
|
+
format_triples(param[:data_global][object], blank: true)
|
|
226
|
+
end
|
|
237
227
|
else
|
|
238
228
|
object
|
|
239
229
|
end
|
|
240
230
|
end
|
|
241
|
-
def format_triples(triples, type =
|
|
231
|
+
def format_triples(triples, type = {})
|
|
242
232
|
param_local = @param.dup.merge(data: triples)
|
|
243
233
|
param_local[:type] = type
|
|
244
234
|
if @param[:labels_with_class] and triples["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
|
|
@@ -265,7 +255,26 @@ module TTL2HTML
|
|
|
265
255
|
end
|
|
266
256
|
end
|
|
267
257
|
end
|
|
268
|
-
|
|
258
|
+
if type[:inverse] == true
|
|
259
|
+
if type[:blank] == true
|
|
260
|
+
#p param_local[:data]
|
|
261
|
+
#p param_local[:data_inverse]
|
|
262
|
+
#p param_local[:data_inverse].values.first.first
|
|
263
|
+
param_local[:blank_subject] = param_local[:data].values.first.first
|
|
264
|
+
param_local[:blank_triples] = {
|
|
265
|
+
param_local[:data].keys.first => param_local[:data_global][param_local[:blank_subject]][param_local[:data].keys.first]
|
|
266
|
+
}
|
|
267
|
+
#p param_local[:blank_subject]
|
|
268
|
+
#p param_local[:blank_triples]
|
|
269
|
+
param_local[:type] = {}
|
|
270
|
+
#pp param_local
|
|
271
|
+
to_html_raw("triples-blank.html.erb", param_local)
|
|
272
|
+
else
|
|
273
|
+
to_html_raw("triples-inverse.html.erb", param_local)
|
|
274
|
+
end
|
|
275
|
+
else
|
|
276
|
+
to_html_raw("triples.html.erb", param_local)
|
|
277
|
+
end
|
|
269
278
|
end
|
|
270
279
|
def format_version_info(version)
|
|
271
280
|
param_local = @param.dup.merge(data: version)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module TTL2HTML
|
|
2
|
+
module Util
|
|
3
|
+
def uri_mapping_to_path(uri, param, suffix = ".html")
|
|
4
|
+
path = nil
|
|
5
|
+
if param[:uri_mappings]
|
|
6
|
+
param[:uri_mappings].each do |mapping|
|
|
7
|
+
local_file = uri.sub(param[:base_uri], "")
|
|
8
|
+
if mapping["regexp"] =~ local_file
|
|
9
|
+
path = local_file.sub(mapping["regexp"], mapping["path"])
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
if path.nil?
|
|
14
|
+
if suffix == ".html"
|
|
15
|
+
if @data.keys.find{|e| e.start_with?(uri + "/") }
|
|
16
|
+
path = uri + "/index"
|
|
17
|
+
elsif uri.end_with?("/")
|
|
18
|
+
path = uri + "index"
|
|
19
|
+
else
|
|
20
|
+
path = uri
|
|
21
|
+
end
|
|
22
|
+
else
|
|
23
|
+
path = uri
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
path = path.sub(param[:base_uri], "")
|
|
27
|
+
path << suffix
|
|
28
|
+
#p [uri, path]
|
|
29
|
+
path
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
data/lib/ttl2html/version.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
TTL2HTML::VERSION = "
|
|
1
|
+
TTL2HTML::VERSION = "2.0.2"
|
data/lib/ttl2html.rb
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
require "zlib"
|
|
4
|
+
require "uri"
|
|
4
5
|
require "yaml"
|
|
5
6
|
require "nokogiri"
|
|
6
7
|
require "rdf/turtle"
|
|
7
8
|
require "ruby-progressbar"
|
|
8
9
|
|
|
10
|
+
require "ttl2html/util"
|
|
9
11
|
require "ttl2html/template"
|
|
10
12
|
|
|
11
13
|
module TTL2HTML
|
|
12
14
|
class App
|
|
15
|
+
include Util
|
|
13
16
|
def initialize(config = "config.yml")
|
|
14
17
|
@config = load_config(config)
|
|
15
18
|
if not @config[:base_uri]
|
|
@@ -18,7 +21,6 @@ module TTL2HTML
|
|
|
18
21
|
@data = {}
|
|
19
22
|
@data_inverse = {}
|
|
20
23
|
@prefix = {}
|
|
21
|
-
@graph = RDF::Graph.new
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
def load_config(file)
|
|
@@ -28,6 +30,11 @@ module TTL2HTML
|
|
|
28
30
|
config[k.intern] = v
|
|
29
31
|
end
|
|
30
32
|
end
|
|
33
|
+
[ :css_file, :javascript_file ].each do |k|
|
|
34
|
+
if config[k]
|
|
35
|
+
config[k] = [ config[k] ].flatten
|
|
36
|
+
end
|
|
37
|
+
end
|
|
31
38
|
config
|
|
32
39
|
end
|
|
33
40
|
|
|
@@ -39,10 +46,8 @@ module TTL2HTML
|
|
|
39
46
|
else
|
|
40
47
|
io = File.open(file)
|
|
41
48
|
end
|
|
42
|
-
RDF::
|
|
43
|
-
@prefix.merge! reader.prefixes
|
|
49
|
+
RDF::Format.for(:turtle).reader.new(io) do |reader|
|
|
44
50
|
reader.statements.each do |statement|
|
|
45
|
-
@graph.insert(statement)
|
|
46
51
|
s = statement.subject
|
|
47
52
|
v = statement.predicate
|
|
48
53
|
o = statement.object
|
|
@@ -55,12 +60,13 @@ module TTL2HTML
|
|
|
55
60
|
@data[s.to_s][v.to_s] ||= []
|
|
56
61
|
@data[s.to_s][v.to_s] << o.to_s
|
|
57
62
|
end
|
|
58
|
-
if o.is_a? RDF::URI
|
|
63
|
+
if o.is_a? RDF::URI or o.is_a? RDF::Node
|
|
59
64
|
@data_inverse[o.to_s] ||= {}
|
|
60
65
|
@data_inverse[o.to_s][v.to_s] ||= []
|
|
61
66
|
@data_inverse[o.to_s][v.to_s] << s.to_s
|
|
62
67
|
end
|
|
63
68
|
end
|
|
69
|
+
@prefix.merge! reader.prefixes
|
|
64
70
|
end
|
|
65
71
|
STDERR.puts "#{count} triples. #{@data.size} subjects."
|
|
66
72
|
@data
|
|
@@ -111,18 +117,23 @@ module TTL2HTML
|
|
|
111
117
|
progressbar = ProgressBar.create(title: label,
|
|
112
118
|
total: @data.size,
|
|
113
119
|
format: "(%t) %a %e %P% Processed: %c from %C")
|
|
114
|
-
@data.
|
|
120
|
+
@data.keys.sort_by do|uri|
|
|
121
|
+
[ uri.count("/"), uri.size, uri ]
|
|
122
|
+
end.reverse_each do |uri|
|
|
115
123
|
progressbar.increment
|
|
116
124
|
next if not uri.start_with? @config[:base_uri]
|
|
117
|
-
yield uri,
|
|
125
|
+
yield uri, @data[uri]
|
|
118
126
|
end
|
|
119
127
|
progressbar.finish
|
|
120
128
|
end
|
|
121
129
|
def output_html_files
|
|
122
130
|
template = Template.new("", @config)
|
|
123
|
-
shapes =
|
|
124
|
-
|
|
125
|
-
|
|
131
|
+
shapes = []
|
|
132
|
+
@data.each do |s, v|
|
|
133
|
+
if v[RDF.type.to_s] and @data[s][RDF.type.to_s].include?("http://www.w3.org/ns/shacl#NodeShape")
|
|
134
|
+
shapes << s
|
|
135
|
+
end
|
|
136
|
+
end
|
|
126
137
|
labels = shapes2labels(shapes)
|
|
127
138
|
versions = extract_versions
|
|
128
139
|
toplevel = extract_toplevel
|
|
@@ -145,38 +156,57 @@ module TTL2HTML
|
|
|
145
156
|
param[:turtle_uri] = uri + ".ttl"
|
|
146
157
|
param[:data] = v
|
|
147
158
|
param[:data_inverse] = @data_inverse[uri]
|
|
159
|
+
param[:data_inverse_global] = @data_inverse
|
|
148
160
|
param[:data_global] = @data
|
|
149
161
|
param[:title] = template.get_title(v)
|
|
150
162
|
if param[:breadcrumbs]
|
|
151
163
|
param[:breadcrumbs_items] = build_breadcrumbs(uri, template)
|
|
152
164
|
end
|
|
153
|
-
file = uri_mapping_to_path(uri, ".html")
|
|
165
|
+
file = uri_mapping_to_path(uri, @config, ".html")
|
|
154
166
|
if @config[:output_dir]
|
|
155
167
|
Dir.mkdir @config[:output_dir] if not File.exist? @config[:output_dir]
|
|
156
168
|
file = File.join(@config[:output_dir], file)
|
|
157
169
|
end
|
|
170
|
+
if template.find_template_path("_default.html.erb")
|
|
171
|
+
param[:additional_content] = template.to_html_raw("_default.html.erb", param)
|
|
172
|
+
end
|
|
158
173
|
template.output_to(file, param)
|
|
159
174
|
end
|
|
160
175
|
index_html = "index.html"
|
|
161
176
|
index_html = File.join(@config[:output_dir], "index.html") if @config[:output_dir]
|
|
162
177
|
if @config.has_key? :top_class
|
|
163
|
-
subjects =
|
|
164
|
-
|
|
165
|
-
|
|
178
|
+
subjects = []
|
|
179
|
+
@data.each do |s, v|
|
|
180
|
+
if @data[s][RDF.type.to_s] and @data[s][RDF.type.to_s].include?(@config[:top_class])
|
|
181
|
+
subjects << s
|
|
182
|
+
end
|
|
183
|
+
end
|
|
166
184
|
if subjects.empty?
|
|
167
185
|
STDERR.puts "WARN: top_class parameter specified as [#{@config[:top_class]}], but there is no instance data."
|
|
168
|
-
STDERR.puts " Skip generation of top page."
|
|
169
186
|
else
|
|
170
187
|
template = Template.new("index.html.erb", @config)
|
|
171
188
|
param = @config.dup
|
|
172
189
|
param[:class_label] = template.get_title(@data[@config[:top_class]], nil)
|
|
173
190
|
param[:data_global] = @data
|
|
191
|
+
param[:data_inverse_global] = @data_inverse
|
|
174
192
|
param[:versions] = versions
|
|
175
193
|
param[:toplevel] = toplevel
|
|
176
194
|
subjects.sort.each do |subject|
|
|
195
|
+
objects = []
|
|
196
|
+
if @config.has_key? :top_additional_property
|
|
197
|
+
@config[:top_additional_property].each do |property|
|
|
198
|
+
if @data[subject][property]
|
|
199
|
+
objects += @data[subject][property]
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end
|
|
177
203
|
param[:index_data] ||= []
|
|
178
|
-
param[:index_data] <<
|
|
204
|
+
param[:index_data] << {
|
|
205
|
+
subject.to_s => objects
|
|
206
|
+
}
|
|
179
207
|
end
|
|
208
|
+
param[:output_file] = index_html
|
|
209
|
+
param[:index_list] = template.to_html_raw("index-list.html.erb", param)
|
|
180
210
|
template.output_to(index_html, param)
|
|
181
211
|
end
|
|
182
212
|
end
|
|
@@ -190,7 +220,13 @@ module TTL2HTML
|
|
|
190
220
|
param[:versions] = versions
|
|
191
221
|
param[:toplevel] = toplevel
|
|
192
222
|
param[:shapes] = {}
|
|
193
|
-
shapes.
|
|
223
|
+
shapes.each do |subject|
|
|
224
|
+
orders = []
|
|
225
|
+
if param[:shape_orders]
|
|
226
|
+
param[:shape_orders].index(subject)
|
|
227
|
+
orders << ( param[:shape_orders].index(subject) or Float::INFINITY )
|
|
228
|
+
end
|
|
229
|
+
orders << subject
|
|
194
230
|
label = comment = nil
|
|
195
231
|
target_class = @data[subject.to_s]["http://www.w3.org/ns/shacl#targetClass"]
|
|
196
232
|
if target_class
|
|
@@ -209,6 +245,7 @@ module TTL2HTML
|
|
|
209
245
|
comment: comment,
|
|
210
246
|
html: template.expand_shape(@data, subject.to_s, @prefix),
|
|
211
247
|
target_class: target_class,
|
|
248
|
+
order: orders,
|
|
212
249
|
}
|
|
213
250
|
end
|
|
214
251
|
template.output_to(about_html, param)
|
|
@@ -227,30 +264,62 @@ module TTL2HTML
|
|
|
227
264
|
@config[:breadcrumbs].each do |e|
|
|
228
265
|
data_target = data
|
|
229
266
|
data_target = @data_inverse[uri] if e["inverse"]
|
|
230
|
-
if data_target
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
267
|
+
if data_target
|
|
268
|
+
if e["property"].kind_of? Array
|
|
269
|
+
parent = nil
|
|
270
|
+
data_target_sub = data_target
|
|
271
|
+
e["property"].each do |prop|
|
|
272
|
+
if data_target_sub[prop["property"]]
|
|
273
|
+
data_target_sub[prop["property"]].each do |o|
|
|
274
|
+
parent = o
|
|
275
|
+
data_target_sub = @data[parent]
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
if parent
|
|
280
|
+
results << build_breadcrumbs_sub(parent, template)
|
|
281
|
+
results += build_breadcrumbs(parent, template, depth + 1)
|
|
282
|
+
return results
|
|
283
|
+
end
|
|
284
|
+
elsif data_target[e["property"]]
|
|
285
|
+
data_target[e["property"]].each do |parent|
|
|
286
|
+
results << build_breadcrumbs_sub(parent, template, e["label"])
|
|
287
|
+
results += build_breadcrumbs(parent, template, depth + 1)
|
|
288
|
+
return results
|
|
289
|
+
end
|
|
240
290
|
end
|
|
241
|
-
return results
|
|
242
291
|
end
|
|
243
292
|
end
|
|
244
293
|
end
|
|
245
294
|
results
|
|
246
295
|
end
|
|
296
|
+
def build_breadcrumbs_sub(parent, template, label_prop = nil)
|
|
297
|
+
data_parent = @data[parent]
|
|
298
|
+
label = template.get_title(data_parent)
|
|
299
|
+
label = data_parent[label_prop].first if label_prop and data_parent[label_prop]
|
|
300
|
+
{
|
|
301
|
+
uri: parent,
|
|
302
|
+
label: label,
|
|
303
|
+
}
|
|
304
|
+
end
|
|
247
305
|
|
|
248
306
|
def shapes_parse(shapes)
|
|
249
|
-
shapes.
|
|
250
|
-
target_class = @data[shape
|
|
307
|
+
shapes.each do |shape|
|
|
308
|
+
target_class = @data[shape]["http://www.w3.org/ns/shacl#targetClass"]&.first
|
|
251
309
|
if target_class
|
|
252
310
|
properties = @data[shape.to_s]["http://www.w3.org/ns/shacl#property"]
|
|
253
|
-
if
|
|
311
|
+
if @data[shape.to_s]["http://www.w3.org/ns/shacl#or"]
|
|
312
|
+
properties ||= []
|
|
313
|
+
node_list = @data[shape.to_s]["http://www.w3.org/ns/shacl#or"].first
|
|
314
|
+
while node_list and @data[node_list] do
|
|
315
|
+
sub_shape = @data[node_list]["http://www.w3.org/1999/02/22-rdf-syntax-ns#first"].first
|
|
316
|
+
if @data[sub_shape] and @data[sub_shape]["http://www.w3.org/ns/shacl#property"]
|
|
317
|
+
properties += @data[sub_shape]["http://www.w3.org/ns/shacl#property"]
|
|
318
|
+
end
|
|
319
|
+
node_list = @data[node_list]["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"].first
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
if not properties.empty?
|
|
254
323
|
properties.each do |property|
|
|
255
324
|
path = @data[property]["http://www.w3.org/ns/shacl#path"].first
|
|
256
325
|
yield target_class, property
|
|
@@ -283,11 +352,17 @@ module TTL2HTML
|
|
|
283
352
|
def extract_versions
|
|
284
353
|
versions = []
|
|
285
354
|
["http://purl.org/pav/hasVersion", "http://purl.org/pav/hasCurrentVersion", "http://purl.org/dc/terms/hasVersion"].each do |prop|
|
|
286
|
-
objects =
|
|
355
|
+
objects = []
|
|
356
|
+
@data.each do |s, v|
|
|
357
|
+
if @data[s][prop]
|
|
358
|
+
objects += @data[s][prop]
|
|
359
|
+
end
|
|
360
|
+
end
|
|
287
361
|
objects.each do |o|
|
|
288
362
|
uri = o.to_s
|
|
289
363
|
version = @data[uri]
|
|
290
364
|
next if not version
|
|
365
|
+
next if not version["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
|
|
291
366
|
next if not version["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"].include? "http://rdfs.org/ns/void#Dataset"
|
|
292
367
|
description = version["http://purl.org/dc/terms/description"]
|
|
293
368
|
link = nil
|
|
@@ -323,15 +398,24 @@ module TTL2HTML
|
|
|
323
398
|
end
|
|
324
399
|
def extract_toplevel
|
|
325
400
|
result = {}
|
|
326
|
-
toplevel =
|
|
401
|
+
toplevel = nil
|
|
402
|
+
@data.each do |s, v|
|
|
403
|
+
if @data[s]["http://purl.org/pav/hasCurrentVersion"]
|
|
404
|
+
toplevel = s
|
|
405
|
+
end
|
|
406
|
+
end
|
|
327
407
|
data = @data[toplevel.to_s]
|
|
328
408
|
if toplevel
|
|
329
409
|
license = {}
|
|
330
410
|
if data["http://purl.org/dc/terms/license"]
|
|
331
411
|
license_data = @data[data["http://purl.org/dc/terms/license"].first]
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
412
|
+
if license_data
|
|
413
|
+
license[:url] = license_data["http://www.w3.org/1999/02/22-rdf-syntax-ns#value"]&.first
|
|
414
|
+
license[:icon] = license_data["http://xmlns.com/foaf/0.1/thumbnail"]&.first
|
|
415
|
+
license[:label] = license_data["http://www.w3.org/2000/01/rdf-schema#label"]
|
|
416
|
+
elsif data["http://purl.org/dc/terms/license"].first =~ URI::regexp
|
|
417
|
+
license[:url] = license[:label] = data["http://purl.org/dc/terms/license"].first
|
|
418
|
+
end
|
|
335
419
|
end
|
|
336
420
|
if data["http://purl.org/dc/terms/publisher"]
|
|
337
421
|
publisher_data = @data[data["http://purl.org/dc/terms/publisher"].first]
|
|
@@ -363,7 +447,7 @@ module TTL2HTML
|
|
|
363
447
|
|
|
364
448
|
def output_turtle_files
|
|
365
449
|
each_data(:output_turtle_files) do |uri, v|
|
|
366
|
-
file = uri_mapping_to_path(uri, ".ttl")
|
|
450
|
+
file = uri_mapping_to_path(uri, @config, ".ttl")
|
|
367
451
|
if @config[:output_dir]
|
|
368
452
|
Dir.mkdir @config[:output_dir] if not File.exist? @config[:output_dir]
|
|
369
453
|
file = File.join(@config[:output_dir], file)
|
|
@@ -383,44 +467,16 @@ module TTL2HTML
|
|
|
383
467
|
output_turtle_files if @config[:output_turtle]
|
|
384
468
|
end
|
|
385
469
|
|
|
386
|
-
def uri_mapping_to_path(uri, suffix = ".html")
|
|
387
|
-
path = nil
|
|
388
|
-
if @config[:uri_mappings]
|
|
389
|
-
@config[:uri_mappings].each do |mapping|
|
|
390
|
-
local_file = uri.sub(@config[:base_uri], "")
|
|
391
|
-
if mapping["regexp"] =~ local_file
|
|
392
|
-
path = local_file.sub(mapping["regexp"], mapping["path"])
|
|
393
|
-
end
|
|
394
|
-
end
|
|
395
|
-
end
|
|
396
|
-
if path.nil?
|
|
397
|
-
if suffix == ".html"
|
|
398
|
-
if @data.keys.find{|e| e.start_with?(uri + "/") }
|
|
399
|
-
path = uri + "/index"
|
|
400
|
-
elsif uri.end_with?("/")
|
|
401
|
-
path = uri + "index"
|
|
402
|
-
else
|
|
403
|
-
path = uri
|
|
404
|
-
end
|
|
405
|
-
else
|
|
406
|
-
path = uri
|
|
407
|
-
end
|
|
408
|
-
end
|
|
409
|
-
path = path.sub(@config[:base_uri], "")
|
|
410
|
-
path << suffix
|
|
411
|
-
#p [uri, path]
|
|
412
|
-
path
|
|
413
|
-
end
|
|
414
470
|
def cleanup
|
|
415
471
|
@data.select do |uri, v|
|
|
416
472
|
uri.start_with? @config[:base_uri]
|
|
417
473
|
end.sort_by do |uri, v|
|
|
418
474
|
-(uri.size)
|
|
419
475
|
end.each do |uri, v|
|
|
420
|
-
html_file = uri_mapping_to_path(uri, ".html")
|
|
476
|
+
html_file = uri_mapping_to_path(uri, @config, ".html")
|
|
421
477
|
html_file = File.join(@config[:output_dir], html_file) if @config[:output_dir]
|
|
422
478
|
File.unlink html_file if File.exist? html_file
|
|
423
|
-
ttl_file = uri_mapping_to_path(uri, ".ttl")
|
|
479
|
+
ttl_file = uri_mapping_to_path(uri, @config, ".ttl")
|
|
424
480
|
ttl_file = File.join(@config[:output_dir], ttl_file) if @config[:output_dir]
|
|
425
481
|
File.unlink ttl_file if File.exist? ttl_file
|
|
426
482
|
dir = uri.sub(@config[:base_uri], "")
|
data/locales/en.yml
CHANGED
|
@@ -4,6 +4,7 @@ en:
|
|
|
4
4
|
shape-heading: "Resources description"
|
|
5
5
|
shape-note: "The properties for the %{resource} resources are as follows:"
|
|
6
6
|
shape-target: Target class
|
|
7
|
+
shape-namespace: "The namespace URIs used in the table are as follows:"
|
|
7
8
|
versions: Versions
|
|
8
9
|
version-release: "Version %{version} released."
|
|
9
10
|
version-triples: "%{triples} triples"
|
|
@@ -11,6 +12,7 @@ en:
|
|
|
11
12
|
contact: Contact
|
|
12
13
|
contact-contribution: "This dataset was developed by %{name}"
|
|
13
14
|
contact-email: "For dataset inquiries, please contact at <a href=\"%{email}\">%{email}</a>"
|
|
15
|
+
toc: Table of Contents
|
|
14
16
|
default:
|
|
15
17
|
details: Details
|
|
16
18
|
inverse_data: Referred resources
|
|
@@ -37,3 +39,4 @@ en:
|
|
|
37
39
|
blank-node-or-structure: "The structural contents of a blank node are either of the followings:"
|
|
38
40
|
triples:
|
|
39
41
|
inverse_refered: "Referred to as '%{property}' from:"
|
|
42
|
+
blank_node: "Blank node"
|
data/locales/ja.yml
CHANGED
|
@@ -4,6 +4,7 @@ ja:
|
|
|
4
4
|
shape-heading: "各リソースの説明"
|
|
5
5
|
shape-note: "%{resource}リソースが持つプロパティを下表に示します"
|
|
6
6
|
shape-target: 対象クラス
|
|
7
|
+
shape-namespace: "表内で用いている名前空間URIは以下の通りです"
|
|
7
8
|
versions: 更新履歴
|
|
8
9
|
version-release: "バージョン%{version}を公開。"
|
|
9
10
|
version-triples: "%{triples}トリプル"
|
|
@@ -11,6 +12,7 @@ ja:
|
|
|
11
12
|
contact: 連絡先
|
|
12
13
|
contact-contribution: "本データセットは %{name} が開発したものです"
|
|
13
14
|
contact-email: "データセットに関する問い合わせは <a href=\"%{email}\">%{email}</a> までお問い合わせください。"
|
|
15
|
+
toc: 目次
|
|
14
16
|
default:
|
|
15
17
|
details: 詳細情報
|
|
16
18
|
inverse_data: 被参照情報
|
|
@@ -37,3 +39,4 @@ ja:
|
|
|
37
39
|
blank-node-or-structure: ブランクノードの内容は以下のいずれかの内容からなる構造を持ちます。
|
|
38
40
|
triples:
|
|
39
41
|
inverse_refered: "'%{property}'としての参照元:"
|
|
42
|
+
blank_node: "空ノード"
|
data/templates/about.html.erb
CHANGED
|
@@ -17,19 +17,21 @@
|
|
|
17
17
|
</nav>
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
|
-
<%- if param[:content] -%>
|
|
21
20
|
<div class="row">
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
<%- if @template == "about.html.erb" and param[:about_toc] -%>
|
|
22
|
+
<div class="col-md-2 order-12">
|
|
23
|
+
<h2 data-toc-skip><%=h t('about.toc') %></h2>
|
|
24
|
+
<nav id="toc" data-toggle="toc" class="sticky-top"></nav>
|
|
24
25
|
</div>
|
|
25
|
-
|
|
26
|
-
<%- end -%>
|
|
27
|
-
<%- if param[:shapes].size > 0 -%>
|
|
28
|
-
<div class="row">
|
|
26
|
+
<%- end -%>
|
|
29
27
|
<div class="col-md">
|
|
28
|
+
<%- if param[:content] -%>
|
|
29
|
+
<%= param[:content] %>
|
|
30
|
+
<%- end -%>
|
|
31
|
+
<%- if param[:shapes].size > 0 -%>
|
|
30
32
|
<h2 id="shapes"><%=h t("about.shape-heading") %></h2>
|
|
31
|
-
<%- param[:shapes].keys.
|
|
32
|
-
<h3><%=h param[:shapes][shape][:label] %></h3>
|
|
33
|
+
<%- param[:shapes].keys.sort_by{|k| param[:shapes][k][:order] }.each do |shape| -%>
|
|
34
|
+
<h3 id="<%=h relative_path_uri(shape) %>"><%=h param[:shapes][shape][:label] %></h3>
|
|
33
35
|
<%- if param[:shapes][shape][:target_class] -%>
|
|
34
36
|
<ul><li><%= t("about.shape-target") %>: <a href="<%=h param[:shapes][shape][:target_class] %>"><%=h param[:shapes][shape][:target_class] %></a></li></ul>
|
|
35
37
|
<%- end -%>
|
|
@@ -37,24 +39,16 @@
|
|
|
37
39
|
<p><%=h t("about.shape-note", resource: param[:shapes][shape][:label]) %></p>
|
|
38
40
|
<%= param[:shapes][shape][:html] -%>
|
|
39
41
|
<%- end -%>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<%- end -%>
|
|
43
|
-
<%- if param[:versions].size > 0 -%>
|
|
44
|
-
<div class="row">
|
|
45
|
-
<div class="col-md">
|
|
42
|
+
<%- end -%>
|
|
43
|
+
<%- if param[:versions].size > 0 -%>
|
|
46
44
|
<h2 id="versions"><%=h t("about.versions") %> <i class="bi bi-info-circle"></i></h2>
|
|
47
45
|
<dl>
|
|
48
46
|
<%- param[:versions].reverse_each do |version| -%>
|
|
49
47
|
<%= format_version_info(version) %>
|
|
50
48
|
<%- end -%>
|
|
51
49
|
</dl>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<%- end -%>
|
|
55
|
-
<%- if param[:toplevel] and param[:toplevel][:contact] -%>
|
|
56
|
-
<div class="row">
|
|
57
|
-
<div class="col-md">
|
|
50
|
+
<%- end -%>
|
|
51
|
+
<%- if param[:toplevel] and param[:toplevel][:contact] -%>
|
|
58
52
|
<h2 id="contact"><%=h t("about.contact") %></h2>
|
|
59
53
|
<%- if param[:toplevel][:contact][:name] -%>
|
|
60
54
|
<p><%=h t("about.contact-contribution", name: get_language_literal(param[:toplevel][:contact][:name])) %></p>
|
|
@@ -72,7 +66,7 @@
|
|
|
72
66
|
<%- if param[:toplevel][:contact][:email] -%>
|
|
73
67
|
<p><%= t("about.contact-email", email: param[:toplevel][:contact][:email]) %></p>
|
|
74
68
|
<%- end -%>
|
|
69
|
+
<%- end -%>
|
|
75
70
|
</div>
|
|
76
71
|
</div>
|
|
77
|
-
|
|
78
|
-
</div>
|
|
72
|
+
</div>
|
data/templates/default.html.erb
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
<div class="col-md-12">
|
|
11
11
|
<nav aria-label="breadcrumb">
|
|
12
12
|
<ol class="breadcrumb">
|
|
13
|
-
<li class="breadcrumb-item"><a href="
|
|
13
|
+
<li class="breadcrumb-item"><a href="<%=h relative_path_uri(param[:base_uri]) %>"><i class="bi bi-house-door-fill"></i> Home</a></li>
|
|
14
14
|
<%- param[:breadcrumbs_items].reverse.each_with_index do |e, i| -%>
|
|
15
15
|
<li class="breadcrumb-item<%= ' active' if i == param[:breadcrumbs_items].size-1 %>" aria-current="page">
|
|
16
16
|
<%- if e[:uri] -%>
|
|
17
|
-
<a href="<%=h e[:uri] %>"><%=h e[:label] %></a>
|
|
17
|
+
<a href="<%=h relative_path_uri(e[:uri]) %>"><%=h e[:label] %></a>
|
|
18
18
|
<%- else -%>
|
|
19
19
|
<%=h e[:label] %>
|
|
20
20
|
<%- end -%>
|
|
@@ -31,11 +31,14 @@
|
|
|
31
31
|
<%= format_triples(param[:data]) %>
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
34
|
+
<%- if param[:additional_content] -%>
|
|
35
|
+
<%= param[:additional_content] %>
|
|
36
|
+
<%- end -%>
|
|
34
37
|
<%- if param[:data_inverse] -%>
|
|
35
38
|
<div class="row inverse">
|
|
36
39
|
<div class="col-md-12">
|
|
37
40
|
<h2><%=h t("default.inverse_data") %></h2>
|
|
38
|
-
<%= format_triples(param[:data_inverse], :
|
|
41
|
+
<%= format_triples(param[:data_inverse], inverse: true) %>
|
|
39
42
|
</div>
|
|
40
43
|
</div>
|
|
41
44
|
<%- end -%>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<div class="row">
|
|
2
|
+
<div class="col-md-12">
|
|
3
|
+
<h2><%=h t("index.list", resource: param[:class_label]) %></h2>
|
|
4
|
+
<ul>
|
|
5
|
+
<%- param[:index_data].each do |e| -%>
|
|
6
|
+
<%- e.each do |s, o| -%>
|
|
7
|
+
<li><%= format_object(s, param[:data_global]) %>
|
|
8
|
+
<%- if o and o.size > 0 -%>
|
|
9
|
+
<ul>
|
|
10
|
+
<%- o.each do |o2| -%>
|
|
11
|
+
<li><%= format_object(o2.to_s, param[:data_global]) %></li>
|
|
12
|
+
<%- end -%>
|
|
13
|
+
</ul>
|
|
14
|
+
<%- end -%>
|
|
15
|
+
</li>
|
|
16
|
+
<%- end -%>
|
|
17
|
+
<%- end -%>
|
|
18
|
+
</ul>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
data/templates/index.html.erb
CHANGED
|
@@ -5,19 +5,11 @@
|
|
|
5
5
|
<p><%= get_language_literal(param[:toplevel][:description]) %></p>
|
|
6
6
|
<%- end -%>
|
|
7
7
|
<p><i class="bi bi-link-45deg"></i> <a href="<%=h param[:base_uri] %>"><%=h param[:base_uri] %></a></p>
|
|
8
|
+
<p><a class="btn btn-info" href="<%=h relative_path(param[:about_file] || "about.html") %>"><%=h t("about.title", title: param[:site_title]) %> »</a></p>
|
|
8
9
|
</div>
|
|
9
10
|
</div>
|
|
10
11
|
<div class="container">
|
|
11
|
-
|
|
12
|
-
<div class="col-md-12">
|
|
13
|
-
<h2><%=h t("index.list", resource: param[:class_label]) %></h2>
|
|
14
|
-
<ul>
|
|
15
|
-
<%- param[:index_data].each do |e| -%>
|
|
16
|
-
<li><%= format_object(e, param[:data_global]) %></li>
|
|
17
|
-
<%- end -%>
|
|
18
|
-
</ul>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
12
|
+
<%= param[:index_list] %>
|
|
21
13
|
<%- if param[:versions].size > 0 -%>
|
|
22
14
|
<div class="row">
|
|
23
15
|
<div class="col-md">
|
|
@@ -39,4 +31,4 @@
|
|
|
39
31
|
</div>
|
|
40
32
|
</div>
|
|
41
33
|
<%- end -%>
|
|
42
|
-
</div>
|
|
34
|
+
</div>
|
data/templates/layout.html.erb
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
2
|
+
<html lang="<%= param[:locale] || I18n.default_locale %>">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
6
6
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
|
|
7
7
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.1/font/bootstrap-icons.css">
|
|
8
|
-
<%- if param[:
|
|
9
|
-
<link rel="stylesheet" href="
|
|
8
|
+
<%- if @template == "about.html.erb" and param[:about_toc] -%>
|
|
9
|
+
<link rel="stylesheet" href="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.css">
|
|
10
10
|
<%- end -%>
|
|
11
|
+
<%- param[:css_file].each do |file| -%>
|
|
12
|
+
<link rel="stylesheet" href="<%=h relative_path(file) %>">
|
|
13
|
+
<%- end if param[:css_file] -%>
|
|
11
14
|
<%- if param[:custom_css] -%>
|
|
12
15
|
<style type="text/css"><%=h param[:custom_css] %></style>
|
|
13
16
|
<%- end -%>
|
|
@@ -32,10 +35,12 @@
|
|
|
32
35
|
</script>
|
|
33
36
|
<%- end -%>
|
|
34
37
|
</head>
|
|
35
|
-
<body
|
|
36
|
-
<nav class="navbar navbar-expand-lg navbar-light">
|
|
38
|
+
<body<%= ' data-spy="scroll" data-target="#toc"' if @template == "about.html.erb" and param[:about_toc] %>>
|
|
39
|
+
<nav class="navbar navbar-expand-lg <%=h param[:navbar_class] || "navbar-light" %>">
|
|
37
40
|
<%- if param[:logo] -%>
|
|
38
|
-
<a class="navbar-brand" href="<%=h relative_path_uri(param[:base_uri]
|
|
41
|
+
<a class="navbar-brand" href="<%=h relative_path_uri(param[:base_uri]) %>">
|
|
42
|
+
<img src="<%=h relative_path(param[:logo]) %>" style="max-height: 54px" alt="<%=h param[:site_title] %>">
|
|
43
|
+
</a>
|
|
39
44
|
<%- end -%>
|
|
40
45
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
|
41
46
|
<span class="navbar-toggler-icon"></span>
|
|
@@ -43,7 +48,7 @@
|
|
|
43
48
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
|
44
49
|
<ul class="navbar-nav mr-auto">
|
|
45
50
|
<li class="nav-item<%= ' active' if @template == "index.html.erb" %>">
|
|
46
|
-
<a class="nav-link" href="<%=h relative_path_uri(param[:base_uri]
|
|
51
|
+
<a class="nav-link" href="<%=h relative_path_uri(param[:base_uri]) %>">Home</a>
|
|
47
52
|
</li>
|
|
48
53
|
<li class="nav-item<%= ' active' if @template == "about.html.erb" %>">
|
|
49
54
|
<a class="nav-link" href="<%=h relative_path(param[:about_file] || "about.html") %>">About</a>
|
|
@@ -76,5 +81,11 @@
|
|
|
76
81
|
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
|
77
82
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
|
|
78
83
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
|
|
84
|
+
<%- if @template == "about.html.erb" and param[:about_toc] -%>
|
|
85
|
+
<script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"></script>
|
|
86
|
+
<%- end -%>
|
|
87
|
+
<%- param[:javascript_file].each do |file| -%>
|
|
88
|
+
<script src="<%=h relative_path(file) %>"></script>
|
|
89
|
+
<%- end if param[:javascript_file] -%>
|
|
79
90
|
</body>
|
|
80
91
|
</html>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<table class="table table-
|
|
1
|
+
<table class="table table-sm">
|
|
2
2
|
<tr>
|
|
3
3
|
<th><%=h t('shape-table.header.property-name') %></th>
|
|
4
4
|
<th><%=h t('shape-table.header.description') %></th>
|
|
@@ -56,5 +56,17 @@
|
|
|
56
56
|
<%- end -%>
|
|
57
57
|
<%- end -%>
|
|
58
58
|
</tbody>
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
<%- if param[:prefix] and not param[:prefix].empty? -%>
|
|
60
|
+
<tfoot>
|
|
61
|
+
<tr><td colspan="5">
|
|
62
|
+
<%=h t('about.shape-namespace') %>
|
|
63
|
+
<dl class="row small">
|
|
64
|
+
<%- param[:prefix].each do |prefix, url| -%>
|
|
65
|
+
<dt class="col-sm-2"><code><%=h prefix %>:</code></dt>
|
|
66
|
+
<dd class="col-sm-10"><%=h url %></dd>
|
|
67
|
+
<%- end -%>
|
|
68
|
+
</dl>
|
|
69
|
+
<%- end -%>
|
|
70
|
+
</td></tr>
|
|
71
|
+
</tfoot>
|
|
72
|
+
</table>
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
<dt class="col-sm-3"><%=h t('triples.inverse_refered', property: format_property(k, param[:labels], v.first)) %></dt>
|
|
8
|
+
<%- if v.respond_to? :has_key? -%>
|
|
9
|
+
<% v.each_with_index do |v2, idx| %>
|
|
10
|
+
<dd class="col-sm-9<%= ' offset-sm-3' if idx > 0 %>" lang="<%=h v2[0] %>"><%= format_object v2[1], param[:data], param[:type] %></dd>
|
|
11
|
+
<% end %>
|
|
12
|
+
<%- elsif v.size > 1 -%>
|
|
13
|
+
<%- v.each_with_index do |v2, idx| -%>
|
|
14
|
+
<dd class="col-sm-9<%= ' offset-sm-3' if idx > 0 %>"><%= format_object v2, param[:data], param[:type] %></dd>
|
|
15
|
+
<%- end -%>
|
|
16
|
+
<%- else -%>
|
|
17
|
+
<dd class="col-sm-9"><%= format_object v.first, param[:data], param[:type] %></dd>
|
|
18
|
+
<%- end -%>
|
|
19
|
+
<%- end -%>
|
|
20
|
+
</dl>
|
data/templates/triples.html.erb
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
<dl class="row">
|
|
1
|
+
<dl class="row<%= if param[:type][:blank] then ' border' end %>">
|
|
2
2
|
<%- param[:data].sort_by{|k, v|
|
|
3
3
|
order = param[:orders][k] if param[:orders] and param[:orders][k]
|
|
4
4
|
order = Float::INFINITY if order.nil?
|
|
5
5
|
[ order, k ]
|
|
6
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
7
|
<dt class="col-sm-3"><%=h format_property(k, param[:labels]) %></dt>
|
|
11
|
-
<%- end -%>
|
|
12
8
|
<%- 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>
|
|
15
|
-
<% end %>
|
|
16
|
-
<%- elsif v.size > 1 -%>
|
|
17
9
|
<%- 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>
|
|
10
|
+
<dd class="col-sm-9<%= ' offset-sm-3' if idx > 0 %>" lang="<%=h v2[0] %>"><%= format_object v2[1], param[:data], param[:type] %></dd>
|
|
11
|
+
<%- end -%>
|
|
12
|
+
<%- elsif v.size > 1 -%>
|
|
13
|
+
<%- v.sort_by{|e|
|
|
14
|
+
if e =~ /\A_:/ and param[:data_global][e]
|
|
15
|
+
param[:data_global][e].to_s
|
|
16
|
+
else
|
|
17
|
+
e
|
|
18
|
+
end
|
|
19
|
+
}.each_with_index do |v2, idx| -%>
|
|
20
|
+
<dd class="col-sm-9<%= ' offset-sm-3' if idx > 0 %>"><%= format_object v2, param[:data], param[:type] %></dd>
|
|
19
21
|
<%- end -%>
|
|
20
22
|
<%- else -%>
|
|
21
|
-
<dd class="col-sm-9"><%= format_object v.first, param[:data] %></dd>
|
|
23
|
+
<dd class="col-sm-9"><%= format_object v.first, param[:data], param[:type] %></dd>
|
|
22
24
|
<%- end -%>
|
|
23
25
|
<%- end -%>
|
|
24
26
|
</dl>
|
data/templates/version.html.erb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<dt><%=h param[:data][:date] %></dt>
|
|
2
2
|
<dd><%=h t("about.version-release", version: param[:data][:version]) %></dd>
|
|
3
|
-
<dd><%=
|
|
3
|
+
<dd><%= get_language_literal(param[:data][:description]) %>
|
|
4
4
|
<%- if param[:data][:link] -%>
|
|
5
5
|
<%= t("about.version-link", link: param[:data][:link]) %>
|
|
6
6
|
<%- end -%>
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
</ul>
|
|
29
29
|
</li>
|
|
30
30
|
<%- end -%>
|
|
31
|
-
</dd>
|
|
31
|
+
</ul></dd>
|
|
32
32
|
<%- 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:
|
|
4
|
+
version: 2.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masao Takaku
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-08-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -150,15 +150,19 @@ files:
|
|
|
150
150
|
- bin/xlsx2shape
|
|
151
151
|
- lib/ttl2html.rb
|
|
152
152
|
- lib/ttl2html/template.rb
|
|
153
|
+
- lib/ttl2html/util.rb
|
|
153
154
|
- lib/ttl2html/version.rb
|
|
154
155
|
- lib/xlsx2shape.rb
|
|
155
156
|
- locales/en.yml
|
|
156
157
|
- locales/ja.yml
|
|
157
158
|
- templates/about.html.erb
|
|
158
159
|
- templates/default.html.erb
|
|
160
|
+
- templates/index-list.html.erb
|
|
159
161
|
- templates/index.html.erb
|
|
160
162
|
- templates/layout.html.erb
|
|
161
163
|
- templates/shape-table.html.erb
|
|
164
|
+
- templates/triples-blank.html.erb
|
|
165
|
+
- templates/triples-inverse.html.erb
|
|
162
166
|
- templates/triples.html.erb
|
|
163
167
|
- templates/version.html.erb
|
|
164
168
|
homepage: https://github.com/masao/ttl2html
|
|
@@ -180,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
180
184
|
- !ruby/object:Gem::Version
|
|
181
185
|
version: '0'
|
|
182
186
|
requirements: []
|
|
183
|
-
rubygems_version: 3.3.
|
|
187
|
+
rubygems_version: 3.3.7
|
|
184
188
|
signing_key:
|
|
185
189
|
specification_version: 4
|
|
186
190
|
summary: ttl2html
|