ttl2html 2.2.1 → 2.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50b5adc471f4582c8773ce30e684c4b21f013f717e2abd577ca31445c1d32058
4
- data.tar.gz: e7b1f6c9463f8a16d3b4ecfb0df6ae5a67ee9d26a47d198a08cc759eaa21a82c
3
+ metadata.gz: 13f4951cbe8d12cf99dd6563a2facae07c180d8e48bbab595f3cce942cf1da0f
4
+ data.tar.gz: 8232fb9eb944019274b5323cf44739ee147b032b60358d8e894a8daa36ab551f
5
5
  SHA512:
6
- metadata.gz: 88eecf013c95e8f90cb502b6c23590753b3cc8805e64ed4c5ee1ed98b42c2aa0e2c8b81725d2b73bded97ab8e1a0b1637f71013639770c811132ba93a645f341
7
- data.tar.gz: 67395144f89f18dc418acf14cf0600d9e0a37faf7f814cc47382557c2d68b9cb1136c0dae03057f0d55c459dea450563641fc2165b2d0196df0a6de7acc36b12
6
+ metadata.gz: c31c198f569f638e9ab5007f9776cb979144464b6be6e3f21601b07a098559af1b50d97e7eed1e77958c7240eefd3ae49e422bf7f54738a6f957ee868d9f2fd1
7
+ data.tar.gz: 8ad682b50a9cd60843d52a503fa7ffbd2a4359553d254c0c7721587d1d371c36cc533da5188c9135b411ec5f0c9c5c12aa2cc23d9bf65b0448e626a264891508
@@ -1 +1 @@
1
- TTL2HTML::VERSION = "2.2.1"
1
+ TTL2HTML::VERSION = "2.2.2"
data/lib/ttl2html.rb CHANGED
@@ -34,7 +34,7 @@ module TTL2HTML
34
34
  end
35
35
  [ :css_file, :javascript_file ].each do |k|
36
36
  if config[k]
37
- config[k] = [ config[k] ].flatten
37
+ config[k] = Array(config[k]).flatten
38
38
  end
39
39
  end
40
40
  config
@@ -152,6 +152,8 @@ module TTL2HTML
152
152
  labels = shapes2labels(shapes)
153
153
  versions = extract_versions
154
154
  toplevel = extract_toplevel
155
+ about_required = template.find_template_path("about.html") || !shapes.empty? || !versions.empty? || !toplevel.empty?
156
+ about_file = (@config[:about_file] || "about.html") if about_required
155
157
  @config[:labels_with_class] ||= {}
156
158
  labels.each do |klass, props|
157
159
  props.each do |property, label|
@@ -188,6 +190,7 @@ module TTL2HTML
188
190
  if template.find_template_path("_default.html.erb")
189
191
  param[:additional_content] = template.to_html_raw("_default.html.erb", param)
190
192
  end
193
+ param[:about_file] = about_file if about_required
191
194
  template.output_to(file, param)
192
195
  end
193
196
  index_html = "index.html"
@@ -226,14 +229,16 @@ module TTL2HTML
226
229
  end
227
230
  param[:output_file] = index_html
228
231
  param[:index_list] = template.to_html_raw("index-list.html.erb", param)
232
+ param[:about_file] = about_file if about_required
229
233
  template.output_to(index_html, param)
230
234
  end
231
235
  end
232
- if template.find_template_path("about.html") or shapes.size > 0 or versions.size > 0 or toplevel.size > 0
233
- about_html = @config[:about_file] || "about.html"
236
+ if about_required
237
+ about_html = about_file
234
238
  about_html = File.join(@config[:output_dir], about_html) if @config[:output_dir]
235
239
  template = Template.new("about.html.erb", @config)
236
240
  param = @config.dup
241
+ param[:about_file] = about_file
237
242
  param[:content] = template.to_html_raw("about.html", {}) if template.find_template_path("about.html")
238
243
  param[:data_global] = @data
239
244
  param[:versions] = versions
@@ -8,7 +8,9 @@
8
8
  <div class="description"><%= param[:description] %></div>
9
9
  <%- end -%>
10
10
  <p><i class="bi bi-link-45deg"></i> <a href="<%=h param[:base_uri] %>"><%=h param[:base_uri] %></a></p>
11
- <p><a class="btn btn-info" href="<%=h relative_path(param[:about_file] || "about.html") %>"><%=h t("about.title", title: param[:site_title]) %> &raquo;</a></p>
11
+ <%- if param[:about_file] -%>
12
+ <p><a class="btn btn-info" href="<%=h relative_path(param[:about_file]) %>"><%=h t("about.title", title: param[:site_title]) %> &raquo;</a></p>
13
+ <%- end -%>
12
14
  </div>
13
15
  </div>
14
16
  <div class="container">
@@ -20,8 +22,8 @@
20
22
  <dl>
21
23
  <%= format_version_info(param[:versions].last) %>
22
24
  </dl>
23
- <%- if param[:versions].size > 1 -%>
24
- <p><a href="about#versions">&raquo; <%=h t("index.past-versions") %></a></p>
25
+ <%- if param[:about_file] and param[:versions].size > 1 -%>
26
+ <p><a href="<%=h relative_path(param[:about_file]) %>#versions">&raquo; <%=h t("index.past-versions") %></a></p>
25
27
  <%- end -%>
26
28
  <%- if param[:toplevel] and not param[:toplevel][:license].empty? -%>
27
29
  <p class="license">
@@ -8,9 +8,9 @@
8
8
  <%- if @template == "about.html.erb" and param[:about_toc] -%>
9
9
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc/dist/bootstrap-toc.min.css">
10
10
  <%- end -%>
11
- <%- param[:css_file].each do |file| -%>
11
+ <%- Array(param[:css_file]).each do |file| -%>
12
12
  <link rel="stylesheet" href="<%=h relative_path(file) %>">
13
- <%- end if param[:css_file] -%>
13
+ <%- end -%>
14
14
  <%- if param[:custom_css] -%>
15
15
  <style type="text/css"><%=h param[:custom_css] %></style>
16
16
  <%- end -%>
@@ -63,9 +63,11 @@
63
63
  <li class="nav-item<%= ' active' if @template == "index.html.erb" %>">
64
64
  <a class="nav-link" href="<%=h relative_path_uri(param[:base_uri]) %>">Home</a>
65
65
  </li>
66
+ <%- if param[:about_file] -%>
66
67
  <li class="nav-item<%= ' active' if @template == "about.html.erb" %>">
67
- <a class="nav-link" href="<%=h relative_path(param[:about_file] || "about.html") %>">About</a>
68
+ <a class="nav-link" href="<%=h relative_path(param[:about_file]) %>">About</a>
68
69
  </li>
70
+ <%- end -%>
69
71
  <%- if param[:additional_link] -%>
70
72
  <%- param[:additional_link].each do |link| -%>
71
73
  <li class="nav-item"><a class="nav-link" href="<%=h link["href"] %>"><%=h link["label"] %></a></li>
@@ -100,8 +102,8 @@
100
102
  <%- if @template == "about.html.erb" and param[:about_toc] -%>
101
103
  <script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc/dist/bootstrap-toc.min.js"></script>
102
104
  <%- end -%>
103
- <%- param[:javascript_file].each do |file| -%>
105
+ <%- Array(param[:javascript_file]).each do |file| -%>
104
106
  <script src="<%=h relative_path(file) %>"></script>
105
- <%- end if param[:javascript_file] -%>
107
+ <%- end -%>
106
108
  </body>
107
109
  </html>
@@ -1,4 +1,5 @@
1
1
  <table class="table table-sm">
2
+ <thead>
2
3
  <tr>
3
4
  <th><%=h t('shape-table.header.property-name') %></th>
4
5
  <th><%=h t('shape-table.header.description') %></th>
@@ -7,6 +8,7 @@
7
8
  <%=h t('shape-table.header.repeatable') %></th>
8
9
  <th><%=h t('shape-table.header.note') %></th>
9
10
  </tr>
11
+ </thead>
10
12
  <tbody>
11
13
  <%- param[:properties].each do |property| -%>
12
14
  <tr>
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.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masao Takaku
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-10 00:00:00.000000000 Z
10
+ date: 2025-09-11 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: nokogiri