ttl2html 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/catttl +23 -6
- data/bin/ttl2html +2 -0
- data/lib/ttl2html/version.rb +1 -1
- data/lib/ttl2html.rb +15 -1
- data/locales/en.yml +2 -1
- data/locales/ja.yml +2 -1
- data/templates/about.html.erb +7 -3
- data/templates/index.html.erb +13 -5
- data/templates/triples.html.erb +5 -3
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a699bd6e103ee6b88c617b6421fc7968fc63141c78d2dfff8aa75a64e7f271d
|
|
4
|
+
data.tar.gz: bfc5ccd8c37e16939d1cd1fcb2fe80a6b4902b408d2def30750f10bd71a1b1be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88d8e9f520c749186b33001e4102b711ed75c3f9ee8c0dbcdab5c86896b68ce141d19800aa8fc6307926dfc3f65451d0ee0f674f80052ba606ef7815f32d120e
|
|
7
|
+
data.tar.gz: 2899b38935cc874ca678913830089f514b805ceb0ff55a64fd7cb2cda850a9238ad348b000aceb3be44bfc0bf5482e525050236d409d818eff16ec0b1019a655
|
data/bin/catttl
CHANGED
|
@@ -1,18 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
require "zlib"
|
|
4
|
+
require "getoptlong"
|
|
4
5
|
require "ttl2html"
|
|
5
6
|
include TTL2HTML
|
|
6
7
|
|
|
7
8
|
prefix = {}
|
|
8
9
|
ttl = []
|
|
10
|
+
noexpand_filenames = false
|
|
11
|
+
|
|
12
|
+
opts = GetoptLong.new(
|
|
13
|
+
["--no-expand", "-f", GetoptLong::NO_ARGUMENT],
|
|
14
|
+
["--help", "-h", GetoptLong::NO_ARGUMENT]
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
opts.each do |opt, arg|
|
|
18
|
+
case opt
|
|
19
|
+
when "--no-expand"
|
|
20
|
+
noexpand_filenames = true
|
|
21
|
+
when "--help"
|
|
22
|
+
puts "Usage: catttl [options] [files]"
|
|
23
|
+
puts "Options:"
|
|
24
|
+
puts " -f, --no-expand Do not expand filenames"
|
|
25
|
+
puts " -h, --help Show this help message"
|
|
26
|
+
exit
|
|
27
|
+
end
|
|
28
|
+
end
|
|
9
29
|
|
|
10
30
|
ARGV.each do |file|
|
|
11
|
-
filename = find_turtle(file)
|
|
31
|
+
filename = find_turtle(file, noexpand: noexpand_filenames)
|
|
12
32
|
if filename.nil?
|
|
13
33
|
STDERR.puts "#{file} not found. skipping."
|
|
14
34
|
next
|
|
15
35
|
end
|
|
36
|
+
STDERR.puts filename
|
|
16
37
|
klass = File
|
|
17
38
|
if File.extname(filename) == ".gz"
|
|
18
39
|
klass = Zlib::GzipReader
|
|
@@ -29,13 +50,9 @@ ARGV.each do |file|
|
|
|
29
50
|
end
|
|
30
51
|
end
|
|
31
52
|
end
|
|
32
|
-
ARGV.each do |file|
|
|
33
|
-
filename = find_turtle(file)
|
|
34
|
-
STDERR.puts filename
|
|
35
|
-
end
|
|
36
53
|
|
|
37
54
|
prefix.each do |k, v|
|
|
38
|
-
STDERR.puts "Duplicate prefixes: #{k}: #{v}" if v.uniq.size > 1
|
|
55
|
+
STDERR.puts "Duplicate prefixes: #{k}: #{v.uniq}" if v.uniq.size > 1
|
|
39
56
|
prefix[k] = v.sort.first
|
|
40
57
|
end
|
|
41
58
|
dups = prefix.values.group_by{|e| e }.select{|k, v| v.size > 1 }.keys
|
data/bin/ttl2html
CHANGED
data/lib/ttl2html/version.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
TTL2HTML::VERSION = "2.3.
|
|
1
|
+
TTL2HTML::VERSION = "2.3.1"
|
data/lib/ttl2html.rb
CHANGED
|
@@ -209,6 +209,7 @@ module TTL2HTML
|
|
|
209
209
|
template = Template.new("index.html.erb", @config)
|
|
210
210
|
param = @config.dup
|
|
211
211
|
param[:class_label] = template.get_title(@data[@config[:top_class]], nil)
|
|
212
|
+
param[:class_label] ||= @config[:top_class].split(/[\/\#]/).last.capitalize
|
|
212
213
|
param[:data_global] = @data
|
|
213
214
|
param[:data_inverse_global] = @data_inverse
|
|
214
215
|
param[:versions] = versions
|
|
@@ -486,12 +487,21 @@ module TTL2HTML
|
|
|
486
487
|
if data["http://rdfs.org/ns/void#sparqlEndpoint"]
|
|
487
488
|
endpoint = data["http://rdfs.org/ns/void#sparqlEndpoint"].first
|
|
488
489
|
end
|
|
490
|
+
if data["http://www.w3.org/ns/dcat#accessService"]
|
|
491
|
+
service = data["http://www.w3.org/ns/dcat#accessService"].first
|
|
492
|
+
service_data = @data[service]
|
|
493
|
+
if service_data
|
|
494
|
+
endpoint = service_data["http://www.w3.org/ns/dcat#endpointURL"]&.first
|
|
495
|
+
endpoint_landingpage = service_data["http://www.w3.org/ns/dcat#landingPage"]&.first
|
|
496
|
+
end
|
|
497
|
+
end
|
|
489
498
|
result = {
|
|
490
499
|
uri: toplevel.to_s,
|
|
491
500
|
description: data["http://purl.org/dc/terms/description"],
|
|
492
501
|
license: license,
|
|
493
502
|
contact: contact,
|
|
494
503
|
endpoint: endpoint,
|
|
504
|
+
endpoint_landingpage: endpoint_landingpage,
|
|
495
505
|
derivedfrom: derivedfrom,
|
|
496
506
|
}
|
|
497
507
|
end
|
|
@@ -547,7 +557,11 @@ module TTL2HTML
|
|
|
547
557
|
|
|
548
558
|
def find_turtle(filename, params = {})
|
|
549
559
|
if params[:noexpand] == true
|
|
550
|
-
|
|
560
|
+
if File.exist? filename
|
|
561
|
+
filename
|
|
562
|
+
else
|
|
563
|
+
nil
|
|
564
|
+
end
|
|
551
565
|
else
|
|
552
566
|
file = nil
|
|
553
567
|
basename = File.basename(filename, ".ttl")
|
data/locales/en.yml
CHANGED
|
@@ -23,7 +23,8 @@ en:
|
|
|
23
23
|
past-versions: "Past versions"
|
|
24
24
|
license-text: "This dataset is freely usable as <a href=\"%{url}\">%{label}</a>."
|
|
25
25
|
sparql-endpoint: "SPARQL Endpoint"
|
|
26
|
-
sparql-endpoint-text: "The SPARQL endpoint for the dataset is available at"
|
|
26
|
+
sparql-endpoint-text: "The SPARQL endpoint for the dataset is available at:"
|
|
27
|
+
sparql-endpoint-landingpage: "Search page"
|
|
27
28
|
dataset:
|
|
28
29
|
derivedfrom-text: "This dataset is created by editing <a href=\"%{url}\">\"%{label}\"</a>."
|
|
29
30
|
license-text: "This dataset is freely usable as <a href=\"%{url}\">%{label}</a>."
|
data/locales/ja.yml
CHANGED
|
@@ -23,7 +23,8 @@ ja:
|
|
|
23
23
|
past-versions: 過去の更新履歴
|
|
24
24
|
license-text: "このデータセットは<a href=\"%{url}\">%{label}</a>として自由に利用できます。"
|
|
25
25
|
sparql-endpoint: "SPARQLエンドポイント"
|
|
26
|
-
sparql-endpoint-text: "このデータセットに対するSPARQLエンドポイントは以下のURL
|
|
26
|
+
sparql-endpoint-text: "このデータセットに対するSPARQLエンドポイントは以下のURLからアクセスできます:"
|
|
27
|
+
sparql-endpoint-landingpage: "クエリ画面"
|
|
27
28
|
dataset:
|
|
28
29
|
derivedfrom-text: "このデータセットは<a href=\"%{url}\">「%{label}」</a>を加工して作成。"
|
|
29
30
|
license-text: "<a href=\"%{url}\">%{label}</a>として自由に利用できます。"
|
data/templates/about.html.erb
CHANGED
|
@@ -55,9 +55,13 @@
|
|
|
55
55
|
<%- end -%>
|
|
56
56
|
<%- if param[:toplevel][:endpoint] -%>
|
|
57
57
|
<h2 id="sparql-endpoint"><%=h t("index.sparql-endpoint") %> <i class="bi bi-database-add"></i></h2>
|
|
58
|
-
<p>
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
<p><%= t("index.sparql-endpoint-text") %></p>
|
|
59
|
+
<ul>
|
|
60
|
+
<%- if param[:toplevel][:endpoint_landingpage] -%>
|
|
61
|
+
<li><%= t("index.sparql-endpoint-landingpage") %>: <a href="<%=h param[:toplevel][:endpoint_landingpage] %>"><%=h param[:toplevel][:endpoint_landingpage] %></a></li>
|
|
62
|
+
<%- end -%>
|
|
63
|
+
<li><%= t("index.sparql-endpoint") %>: <a href="<%=h param[:toplevel][:endpoint] %>"><%=h param[:toplevel][:endpoint] %></a></li>
|
|
64
|
+
</ul>
|
|
61
65
|
<%- end -%>
|
|
62
66
|
<%- if param[:toplevel] and param[:toplevel][:contact] -%>
|
|
63
67
|
<h2 id="contact"><%=h t("about.contact") %></h2>
|
data/templates/index.html.erb
CHANGED
|
@@ -40,11 +40,19 @@
|
|
|
40
40
|
<%- end -%>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
<%- end -%>
|
|
44
|
+
<%- if param[:toplevel][:endpoint] -%>
|
|
45
|
+
<div class="row">
|
|
46
|
+
<div class="col-md">
|
|
47
|
+
<h2 id="sparql-endpoint"><%=h t("index.sparql-endpoint") %> <i class="bi bi-database-add"></i></h2>
|
|
48
|
+
<p><%= t("index.sparql-endpoint-text") %></p>
|
|
49
|
+
<ul>
|
|
50
|
+
<%- if param[:toplevel][:endpoint_landingpage] -%>
|
|
51
|
+
<li><%= t("index.sparql-endpoint-landingpage") %>: <a href="<%=h param[:toplevel][:endpoint_landingpage] %>"><%=h param[:toplevel][:endpoint_landingpage] %></a></li>
|
|
52
|
+
<%- end -%>
|
|
53
|
+
<li><%= t("index.sparql-endpoint") %>: <a href="<%=h param[:toplevel][:endpoint] %>"><%=h param[:toplevel][:endpoint] %></a></li>
|
|
54
|
+
</ul>
|
|
55
|
+
</div>
|
|
48
56
|
</div>
|
|
49
57
|
<%- end -%>
|
|
50
58
|
</div>
|
data/templates/triples.html.erb
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
<%- itemtypes = param[:data][RDF.type.to_s].to_a.join(" ") -%>
|
|
1
2
|
<%- if param[:type][:blank] -%>
|
|
2
|
-
<dl class="row<%= if param[:type][:blank] then ' border' end %>" itemscope
|
|
3
|
+
<dl class="row<%= if param[:type][:blank] then ' border' end %>" itemscope<% unless itemtypes.empty? %> itemtype="<%=h itemtypes %>"<% end %>>
|
|
3
4
|
<%- else -%>
|
|
4
|
-
<dl class="row<%= if param[:type][:blank] then ' border' end %>" itemscope itemid="<%=h param[:uri] %>"
|
|
5
|
+
<dl class="row<%= if param[:type][:blank] then ' border' end %>" itemscope itemid="<%=h param[:uri] %>"<% unless itemtypes.empty? %> itemtype="<%=h itemtypes %>"<% end %>>
|
|
5
6
|
<%- end -%>
|
|
6
7
|
<%- param[:data].sort_by{|k, v|
|
|
7
8
|
order = param[:orders][k] if param[:orders] and param[:orders][k]
|
|
@@ -13,7 +14,8 @@
|
|
|
13
14
|
<%- if v2.respond_to? :language and v2.language? -%>
|
|
14
15
|
<dd class="col-sm-9<%= ' offset-sm-3' if idx > 0 %>" lang="<%=h v2.language %>" itemprop="<%=h k %>"><%= format_object v2, param[:data], param[:type] %></dd>
|
|
15
16
|
<%- elsif /\Ahttps?:\/\// =~ v2.to_s -%>
|
|
16
|
-
|
|
17
|
+
<%- itemtypes = param[:data_global][v2.to_s] ? param[:data_global][v2.to_s][RDF.type.to_s].to_a.join(" ") : "" -%>
|
|
18
|
+
<dd class="col-sm-9<%= ' offset-sm-3' if idx > 0 %>" itemscope itemprop="<%=h k %>" itemid="<%=h v2.to_s %>"<% unless itemtypes.empty? %> itemtype="<%=h itemtypes %>"<% end %>><%= format_object v2, param[:data], param[:type] %></dd>
|
|
17
19
|
<%- else -%>
|
|
18
20
|
<dd class="col-sm-9<%= ' offset-sm-3' if idx > 0 %>" itemprop="<%=h k %>"><%= format_object v2, param[:data], param[:type] %></dd>
|
|
19
21
|
<%- end -%>
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ttl2html
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.3.
|
|
4
|
+
version: 2.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masao Takaku
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-01-24 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: nokogiri
|
|
@@ -180,9 +180,9 @@ dependencies:
|
|
|
180
180
|
description: Static site generator for RDF/Turtle
|
|
181
181
|
email: tmasao@acm.org
|
|
182
182
|
executables:
|
|
183
|
+
- catttl
|
|
183
184
|
- ttl2html
|
|
184
185
|
- xlsx2shape
|
|
185
|
-
- catttl
|
|
186
186
|
extensions: []
|
|
187
187
|
extra_rdoc_files: []
|
|
188
188
|
files:
|
|
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
225
225
|
- !ruby/object:Gem::Version
|
|
226
226
|
version: '0'
|
|
227
227
|
requirements: []
|
|
228
|
-
rubygems_version:
|
|
228
|
+
rubygems_version: 4.0.3
|
|
229
229
|
specification_version: 4
|
|
230
230
|
summary: ttl2html
|
|
231
231
|
test_files: []
|