ttl2html 2.0.1 → 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 +6 -1
- data/lib/ttl2html/version.rb +1 -1
- data/lib/ttl2html.rb +9 -2
- data/locales/en.yml +1 -0
- data/locales/ja.yml +1 -0
- data/templates/about.html.erb +16 -22
- data/templates/layout.html.erb +11 -5
- data/templates/triples.html.erb +8 -2
- data/templates/version.html.erb +1 -1
- metadata +2 -2
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
@@ -128,8 +128,13 @@ module TTL2HTML
|
|
128
128
|
src = @param[:output_file]
|
129
129
|
src = Pathname.new(src).relative_path_from(Pathname.new(@param[:output_dir])) if @param[:output_dir]
|
130
130
|
path = Pathname(dest).relative_path_from(Pathname(File.dirname src))
|
131
|
-
|
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
|
132
136
|
end
|
137
|
+
#p [ :relative_path, path, dest, src ]
|
133
138
|
path
|
134
139
|
end
|
135
140
|
def relative_path_uri(dest_uri, base_uri = @param[:base_uri])
|
data/lib/ttl2html/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
TTL2HTML::VERSION = "2.0.
|
1
|
+
TTL2HTML::VERSION = "2.0.2"
|
data/lib/ttl2html.rb
CHANGED
@@ -30,6 +30,11 @@ module TTL2HTML
|
|
30
30
|
config[k.intern] = v
|
31
31
|
end
|
32
32
|
end
|
33
|
+
[ :css_file, :javascript_file ].each do |k|
|
34
|
+
if config[k]
|
35
|
+
config[k] = [ config[k] ].flatten
|
36
|
+
end
|
37
|
+
end
|
33
38
|
config
|
34
39
|
end
|
35
40
|
|
@@ -112,10 +117,12 @@ module TTL2HTML
|
|
112
117
|
progressbar = ProgressBar.create(title: label,
|
113
118
|
total: @data.size,
|
114
119
|
format: "(%t) %a %e %P% Processed: %c from %C")
|
115
|
-
@data.
|
120
|
+
@data.keys.sort_by do|uri|
|
121
|
+
[ uri.count("/"), uri.size, uri ]
|
122
|
+
end.reverse_each do |uri|
|
116
123
|
progressbar.increment
|
117
124
|
next if not uri.start_with? @config[:base_uri]
|
118
|
-
yield uri,
|
125
|
+
yield uri, @data[uri]
|
119
126
|
end
|
120
127
|
progressbar.finish
|
121
128
|
end
|
data/locales/en.yml
CHANGED
@@ -12,6 +12,7 @@ en:
|
|
12
12
|
contact: Contact
|
13
13
|
contact-contribution: "This dataset was developed by %{name}"
|
14
14
|
contact-email: "For dataset inquiries, please contact at <a href=\"%{email}\">%{email}</a>"
|
15
|
+
toc: Table of Contents
|
15
16
|
default:
|
16
17
|
details: Details
|
17
18
|
inverse_data: Referred resources
|
data/locales/ja.yml
CHANGED
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
33
|
<%- param[:shapes].keys.sort_by{|k| param[:shapes][k][:order] }.each do |shape| -%>
|
32
|
-
<h3><%=h param[:shapes][shape][:label] %></h3>
|
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/layout.html.erb
CHANGED
@@ -5,9 +5,12 @@
|
|
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,7 +35,7 @@
|
|
32
35
|
</script>
|
33
36
|
<%- end -%>
|
34
37
|
</head>
|
35
|
-
<body
|
38
|
+
<body<%= ' data-spy="scroll" data-target="#toc"' if @template == "about.html.erb" and param[:about_toc] %>>
|
36
39
|
<nav class="navbar navbar-expand-lg <%=h param[:navbar_class] || "navbar-light" %>">
|
37
40
|
<%- if param[:logo] -%>
|
38
41
|
<a class="navbar-brand" href="<%=h relative_path_uri(param[:base_uri]) %>">
|
@@ -78,8 +81,11 @@
|
|
78
81
|
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
79
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>
|
80
83
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
|
81
|
-
<%- if param[:
|
82
|
-
<script src="
|
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>
|
83
86
|
<%- end -%>
|
87
|
+
<%- param[:javascript_file].each do |file| -%>
|
88
|
+
<script src="<%=h relative_path(file) %>"></script>
|
89
|
+
<%- end if param[:javascript_file] -%>
|
84
90
|
</body>
|
85
91
|
</html>
|
data/templates/triples.html.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
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?
|
@@ -10,7 +10,13 @@
|
|
10
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
11
|
<%- end -%>
|
12
12
|
<%- elsif v.size > 1 -%>
|
13
|
-
<%- v.
|
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| -%>
|
14
20
|
<dd class="col-sm-9<%= ' offset-sm-3' if idx > 0 %>"><%= format_object v2, param[:data], param[:type] %></dd>
|
15
21
|
<%- end -%>
|
16
22
|
<%- else -%>
|
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 -%>
|
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: 2.0.
|
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-08-
|
11
|
+
date: 2022-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|