asciidoctor-html 2.1.3 → 2.1.5
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/CHANGELOG.md +11 -0
- data/asciidoctor-html.svg +3 -0
- data/assets/css/styles.css +2 -2
- data/assets/favicon/apple-touch-icon.png +0 -0
- data/assets/favicon/favicon-96x96.png +0 -0
- data/assets/favicon/favicon.ico +0 -0
- data/assets/favicon/favicon.svg +1 -0
- data/assets/favicon/web-app-manifest-192x192.png +0 -0
- data/assets/favicon/web-app-manifest-512x512.png +0 -0
- data/lib/asciidoctor/html/book.rb +0 -1
- data/lib/asciidoctor/html/book_template.rb +18 -12
- data/lib/asciidoctor/html/cli.rb +1 -1
- data/lib/asciidoctor/html/converter.rb +18 -5
- data/lib/asciidoctor/html/flip.rb +20 -23
- data/lib/asciidoctor/html/jupyterlite.rb +2 -7
- data/lib/asciidoctor/html/list.rb +1 -1
- data/lib/asciidoctor/html/pagination.rb +39 -6
- data/lib/asciidoctor/html/ref_tree_processor.rb +14 -0
- data/lib/asciidoctor/html/search.rb +5 -6
- data/lib/asciidoctor/html/tabs.rb +45 -0
- data/lib/asciidoctor/html/utils.rb +8 -0
- data/lib/asciidoctor/html/version.rb +1 -1
- data/lib/asciidoctor/html/webmanifest.rb +7 -2
- metadata +7 -5
- data/assets/favicon/android-chrome-192x192.png +0 -0
- data/assets/favicon/android-chrome-512x512.png +0 -0
- data/assets/favicon/favicon-16x16.png +0 -0
- data/assets/favicon/favicon-32x32.png +0 -0
|
Binary file
|
|
Binary file
|
data/assets/favicon/favicon.ico
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35.631 35.631" width="35.631" height="35.631"><metadata><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"><rdf:Description><dc:creator>RealFaviconGenerator</dc:creator><dc:source>https://realfavicongenerator.net</dc:source></rdf:Description></rdf:RDF></metadata><path d="M31.25 102.847 22.278 92.04l8.972-10.597h3.514l-9.007 10.632 9.007 10.773zm5.598-8.424h14.13v2.508h-14.13Zm0-6.464h14.13v2.49h-14.13ZM56.84 102.9h-3.514l8.972-10.826-8.972-10.632h3.514l8.937 10.597z" style="fill:#d63384;stroke-width:.5" transform="matrix(.811 0 0 1.23303 -17.891 -95.835)"></path></svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -152,10 +152,12 @@ module Asciidoctor
|
|
|
152
152
|
|
|
153
153
|
def self.footer(authors)
|
|
154
154
|
<<~HTML
|
|
155
|
-
<footer class="footer
|
|
156
|
-
<div class="footer-
|
|
157
|
-
|
|
158
|
-
<
|
|
155
|
+
<footer class="footer">
|
|
156
|
+
<div class="footer-content dynamic-width">
|
|
157
|
+
<div class="footer-left">© <span id="cr-year"></span> #{authors}</div>
|
|
158
|
+
<div class="footer-right">Built with
|
|
159
|
+
<a href="https://github.com/ravirajani/asciidoctor-html">asciidoctor-html</a>
|
|
160
|
+
</div>
|
|
159
161
|
</div>
|
|
160
162
|
</footer>
|
|
161
163
|
HTML
|
|
@@ -184,10 +186,12 @@ module Asciidoctor
|
|
|
184
186
|
#{%(<meta name="description" content="#{opts[:description]}">) if opts[:description]}
|
|
185
187
|
#{%(<meta name="author" content="#{opts[:authors]}">) if opts[:authors]}
|
|
186
188
|
<title>#{opts[:title]}</title>
|
|
187
|
-
<link rel="
|
|
188
|
-
<link rel="icon" type="image/
|
|
189
|
-
<link rel="icon"
|
|
190
|
-
<link rel="
|
|
189
|
+
<link rel="icon" type="image/png" href="#{FAVICON_PATH}/favicon-96x96.png" sizes="96x96" />
|
|
190
|
+
<link rel="icon" type="image/svg+xml" href="#{FAVICON_PATH}/favicon.svg" />
|
|
191
|
+
<link rel="shortcut icon" href="#{FAVICON_PATH}/favicon.ico" />
|
|
192
|
+
<link rel="apple-touch-icon" sizes="180x180" href="#{FAVICON_PATH}/apple-touch-icon.png" />
|
|
193
|
+
<meta name="apple-mobile-web-app-title" content="#{opts[:short_title]}" />
|
|
194
|
+
<link rel="manifest" href="site.webmanifest" />
|
|
191
195
|
<link rel="stylesheet" href="#{CSS_PATH}/styles.css">
|
|
192
196
|
#{highlightjs(opts)}
|
|
193
197
|
<script>
|
|
@@ -225,8 +229,10 @@ module Asciidoctor
|
|
|
225
229
|
def self.html(content, nav_items, opts = {})
|
|
226
230
|
nav = !nav_items.empty? && (nav_items.size > 1 || opts[:has_subnav])
|
|
227
231
|
page_classes = ["page"]
|
|
228
|
-
|
|
229
|
-
|
|
232
|
+
if nav
|
|
233
|
+
page_classes << "multi" unless opts[:pagestyle] == :single
|
|
234
|
+
page_classes << "presentation" if opts[:pagestyle] == :presentation
|
|
235
|
+
end
|
|
230
236
|
page_classname = page_classes.join " "
|
|
231
237
|
<<~HTML
|
|
232
238
|
<!DOCTYPE html>
|
|
@@ -250,8 +256,8 @@ module Asciidoctor
|
|
|
250
256
|
#{Popovers::POPOVERS}
|
|
251
257
|
#{Sidebar::TOGGLE if nav}
|
|
252
258
|
#{Scroll::SCROLL}
|
|
253
|
-
#{Flip::FLIP}
|
|
254
|
-
#{Live::LIVE if opts[:has_live]}
|
|
259
|
+
#{Flip::FLIP if nav}
|
|
260
|
+
#{Live::LIVE if nav && opts[:has_live]}
|
|
255
261
|
</script>
|
|
256
262
|
#{opts[:at_body_end]}
|
|
257
263
|
</body>
|
data/lib/asciidoctor/html/cli.rb
CHANGED
|
@@ -82,7 +82,7 @@ module Asciidoctor
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
def self.generate_webmanifest(outdir, name, short_name)
|
|
85
|
-
filename = "#{outdir}
|
|
85
|
+
filename = "#{outdir}/site.webmanifest"
|
|
86
86
|
puts "Generating\n #{filename}"
|
|
87
87
|
puts
|
|
88
88
|
File.write filename, Webmanifest.generate(name, short_name)
|
|
@@ -5,6 +5,7 @@ require_relative "list"
|
|
|
5
5
|
require_relative "utils"
|
|
6
6
|
require_relative "figure"
|
|
7
7
|
require_relative "table"
|
|
8
|
+
require_relative "tabs"
|
|
8
9
|
require_relative "jupyterlite"
|
|
9
10
|
|
|
10
11
|
module Asciidoctor
|
|
@@ -37,14 +38,17 @@ module Asciidoctor
|
|
|
37
38
|
document = node.document
|
|
38
39
|
level = node.level
|
|
39
40
|
show_sectnum = node.numbered && level <= (document.attr("sectnumlevels") || 1).to_i
|
|
40
|
-
tag_level = [level == 1 ? level + 1 : level + 2, 6].min
|
|
41
|
-
tag_name = %(h#{tag_level})
|
|
42
41
|
classes = "section#{" flip" if level == 1}#{" #{node.role}" if node.role}"
|
|
43
42
|
display_sectnum = Utils.display_sectnum(node, level) if show_sectnum
|
|
44
|
-
|
|
43
|
+
title = "#{display_sectnum}#{node.title}"
|
|
44
|
+
content = "#{Utils.heading node, title}#{node.content}"
|
|
45
45
|
Utils.wrap_id_classes content, node.id, classes, :section
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
def convert_floating_title(node)
|
|
49
|
+
Utils.heading node, node.title, discrete: true
|
|
50
|
+
end
|
|
51
|
+
|
|
48
52
|
def convert_paragraph(node)
|
|
49
53
|
content = %(<p#{Utils.dyn_id_class_attr_str node, node.role}>#{node.content}</p>\n)
|
|
50
54
|
Utils.wrap_node_with_title content, node
|
|
@@ -165,7 +169,13 @@ module Asciidoctor
|
|
|
165
169
|
end
|
|
166
170
|
|
|
167
171
|
def convert_example(node)
|
|
168
|
-
Utils.
|
|
172
|
+
content = Utils.display_title(node) + node.content
|
|
173
|
+
if node.option?("unstyled")
|
|
174
|
+
classes = %(block#{" #{node.role}" if node.role})
|
|
175
|
+
return Utils.wrap_id_classes(content, node.id, classes)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
Utils.wrap_node content, node
|
|
169
179
|
end
|
|
170
180
|
|
|
171
181
|
def convert_image(node)
|
|
@@ -212,16 +222,19 @@ module Asciidoctor
|
|
|
212
222
|
end
|
|
213
223
|
|
|
214
224
|
def convert_dlist(node)
|
|
225
|
+
return Tabs.convert_tabs(node) if node.option?("tabs")
|
|
226
|
+
|
|
215
227
|
classes = ["dlist", node.style, node.role].compact.join(" ")
|
|
216
228
|
result = [%(<dl#{Utils.dyn_id_class_attr_str node, classes}>)]
|
|
217
229
|
live = node.attr? "live"
|
|
218
230
|
line_number = 1
|
|
219
231
|
node.items.each do |terms, dd|
|
|
232
|
+
return %(<p class="text-danger">Definition is required.</p>) unless dd
|
|
233
|
+
|
|
220
234
|
terms.each do |dt|
|
|
221
235
|
result << %(<dt class="dterm"#{Utils.line_number_attr line_number, live:}>#{dt.text}</dt>)
|
|
222
236
|
line_number += 1
|
|
223
237
|
end
|
|
224
|
-
next unless dd
|
|
225
238
|
|
|
226
239
|
result << "<dd#{Utils.line_number_attr line_number, live:}>"
|
|
227
240
|
line_number += 1
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "pagination"
|
|
4
|
+
|
|
3
5
|
module Asciidoctor
|
|
4
6
|
module Html
|
|
5
7
|
# Flip when pagestyle is multi or presentation
|
|
6
8
|
module Flip
|
|
7
|
-
FLIP = <<~JS
|
|
9
|
+
FLIP = <<~JS.freeze
|
|
8
10
|
(function() {
|
|
9
11
|
// Holds replaced pagination links to prev/next chapter
|
|
10
12
|
const chapPagination = {
|
|
@@ -49,6 +51,13 @@ module Asciidoctor
|
|
|
49
51
|
focusEl.focus({preventScroll: true});
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
function pagitemHTML(text, direction) {
|
|
55
|
+
if(direction == 'left') {
|
|
56
|
+
return `#{Pagination.pagitem_html "${text}", left: true}`;
|
|
57
|
+
}
|
|
58
|
+
return `#{Pagination.pagitem_html "${text}"}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
52
61
|
function updatePaginator(prev, next) {
|
|
53
62
|
const paginator = document.querySelector('.paginator');
|
|
54
63
|
if(!paginator) return;
|
|
@@ -57,13 +66,10 @@ module Asciidoctor
|
|
|
57
66
|
if(next) {
|
|
58
67
|
const nextH = next.querySelector(':scope > h2');
|
|
59
68
|
const nextLink = document.createElement('a');
|
|
60
|
-
nextLink.id =
|
|
69
|
+
nextLink.id = 'flip-forward';
|
|
61
70
|
const nextSectText = nextH && nextH.innerHTML;
|
|
62
71
|
nextLink.href = '#' + next.id;
|
|
63
|
-
nextLink.innerHTML =
|
|
64
|
-
<div>${nextSectText || ''}</div>
|
|
65
|
-
<div><i class="bi bi-chevron-compact-right"></i></div>
|
|
66
|
-
`;
|
|
72
|
+
nextLink.innerHTML = pagitemHTML(nextSectText, 'right');
|
|
67
73
|
chapPagination.nextChap ||= nextPage;
|
|
68
74
|
nextPage.replaceWith(nextLink);
|
|
69
75
|
} else if(chapPagination.nextChap) {
|
|
@@ -73,19 +79,16 @@ module Asciidoctor
|
|
|
73
79
|
const prevH = prev.querySelector(':scope > h2');
|
|
74
80
|
const prevSectitle = prevH && (prevH.innerHTML + ' ');
|
|
75
81
|
const prevLink = document.createElement('a');
|
|
76
|
-
prevLink.id =
|
|
82
|
+
prevLink.id = 'flip-back';
|
|
77
83
|
let prevSectText = prevSectitle || chapheading &&
|
|
78
|
-
('<span class="title-prefix">' + chapheading.textContent + '</span><br>');
|
|
84
|
+
('<span class="title-prefix">' + chapheading.textContent + '</span><br>') || '';
|
|
79
85
|
if(!prevH) prevSectText += chaptitle.textContent;
|
|
80
86
|
prevLink.href = '#' + (prev.id ? prev.id : 'page');
|
|
81
|
-
prevLink.innerHTML =
|
|
82
|
-
<div><i class="bi bi-chevron-compact-left"></i></div>
|
|
83
|
-
<div>${prevSectText || ''}</div>
|
|
84
|
-
`;
|
|
87
|
+
prevLink.innerHTML = pagitemHTML(prevSectText, 'left');
|
|
85
88
|
chapPagination.prevChap ||= prevPage;
|
|
86
89
|
prevPage.replaceWith(prevLink);
|
|
87
90
|
} else if(chapPagination.prevChap) {
|
|
88
|
-
prevPage.replaceWith(chapPagination.prevChap)
|
|
91
|
+
prevPage.replaceWith(chapPagination.prevChap);
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
|
|
@@ -136,12 +139,13 @@ module Asciidoctor
|
|
|
136
139
|
if(target == section) {
|
|
137
140
|
scrollEl.scrollTo({
|
|
138
141
|
top: 0,
|
|
139
|
-
left: 0
|
|
142
|
+
left: 0,
|
|
143
|
+
behavior: 'instant'
|
|
140
144
|
});
|
|
141
145
|
} else {
|
|
142
|
-
const rect = target.getBoundingClientRect()
|
|
146
|
+
const rect = target.getBoundingClientRect();
|
|
143
147
|
scrollEl.scrollTo({
|
|
144
|
-
top: rect.top +
|
|
148
|
+
top: rect.top + scrollEl.scrollTop,
|
|
145
149
|
left: 0
|
|
146
150
|
});
|
|
147
151
|
}
|
|
@@ -195,13 +199,6 @@ module Asciidoctor
|
|
|
195
199
|
|
|
196
200
|
page.classList.add('loaded');
|
|
197
201
|
|
|
198
|
-
// Chrome does not calculate viewport height correctly in standalone mode.
|
|
199
|
-
if(matchMedia('(display-mode: standalone)').matches &&
|
|
200
|
-
typeof visualViewport !== 'undefined'
|
|
201
|
-
) {
|
|
202
|
-
page.style.height = visualViewport.height + 'px';
|
|
203
|
-
}
|
|
204
|
-
|
|
205
202
|
ADHT.move = move;
|
|
206
203
|
})();
|
|
207
204
|
JS
|
|
@@ -2,12 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module Asciidoctor
|
|
4
4
|
module Html
|
|
5
|
-
#
|
|
5
|
+
# Jupyterlite library
|
|
6
6
|
module Jupyterlite
|
|
7
|
-
class << self
|
|
8
|
-
attr_accessor :cell_id
|
|
9
|
-
end
|
|
10
|
-
|
|
11
7
|
PATH = "jupyterlite"
|
|
12
8
|
REPL_PATH = "repl/index.html"
|
|
13
9
|
|
|
@@ -40,8 +36,7 @@ module Asciidoctor
|
|
|
40
36
|
end
|
|
41
37
|
|
|
42
38
|
def self.html(node)
|
|
43
|
-
|
|
44
|
-
cell_id = "jupyter-cell-frame-#{@cell_id}"
|
|
39
|
+
cell_id = "jupyter-cell-frame-#{node.attr "jupyter-cell-id"}"
|
|
45
40
|
height_attr = %( style="height: #{node.attr("height")}px;") if node.attr?("height")
|
|
46
41
|
<<~HTML
|
|
47
42
|
<div id="#{cell_id}"#{height_attr} class="jupyter-cell"></div>
|
|
@@ -5,7 +5,7 @@ module Asciidoctor
|
|
|
5
5
|
# Helper functions for the list conversion
|
|
6
6
|
module List
|
|
7
7
|
def self.convert(node, tag_name = :ol)
|
|
8
|
-
depth = node.attr "list-depth"
|
|
8
|
+
depth = node.attr "list-depth", 0
|
|
9
9
|
flat = node.attr? "flat-style"
|
|
10
10
|
inside = node.option? "inside"
|
|
11
11
|
level = depth + 1
|
|
@@ -7,28 +7,61 @@ module Asciidoctor
|
|
|
7
7
|
# Pagination item
|
|
8
8
|
PagItem = Struct.new "PagItem", :url, :title, :text
|
|
9
9
|
|
|
10
|
+
def self.chevron(left: false)
|
|
11
|
+
transform_attr = %( transform="rotate(180 7 8)") if left
|
|
12
|
+
<<~HTML
|
|
13
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100%" fill="currentColor" viewBox="3 0 8 16">
|
|
14
|
+
<path#{transform_attr} fill-rule="evenodd" d="M6.776 1.553a.5.5 0 0 1 .671.223l3 6a.5.5 0 0 1 0 .448l-3 6a.5.5 0 1 1-.894-.448L9.44 8 6.553 2.224a.5.5 0 0 1 .223-.671"/>
|
|
15
|
+
</svg>
|
|
16
|
+
HTML
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.pagitem_html(text, left: false)
|
|
20
|
+
if left
|
|
21
|
+
<<~HTML
|
|
22
|
+
<div class="chevron">
|
|
23
|
+
#{Pagination.chevron left:}
|
|
24
|
+
</div>
|
|
25
|
+
<div class="pagination-prv">#{text}</div>
|
|
26
|
+
HTML
|
|
27
|
+
else
|
|
28
|
+
<<~HTML
|
|
29
|
+
<div class="pagination-nxt">#{text}</div>
|
|
30
|
+
<div class="chevron">
|
|
31
|
+
#{Pagination.chevron}
|
|
32
|
+
</div>
|
|
33
|
+
HTML
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.display_prefix(prefix)
|
|
38
|
+
%(<span class="title-prefix">#{prefix}</span><br>)
|
|
39
|
+
end
|
|
40
|
+
|
|
10
41
|
def display_paginator(prv, nxt)
|
|
11
42
|
blank = %(<span class="blank"> </span>)
|
|
12
43
|
html = [<<~HTML
|
|
13
|
-
<div class="paginator-wrapper
|
|
14
|
-
<div class="paginator">
|
|
44
|
+
<div class="paginator-wrapper">
|
|
45
|
+
<div class="paginator dynamic-width">
|
|
15
46
|
HTML
|
|
16
47
|
]
|
|
17
48
|
html << if prv
|
|
49
|
+
prefix = Pagination.display_prefix(prv.title) if prv.title
|
|
50
|
+
text = "#{prefix}#{prv.text}"
|
|
18
51
|
<<~HTML
|
|
19
52
|
<a id="flip-back" href="#{prv.url}">
|
|
20
|
-
|
|
21
|
-
<div>#{%(<span class="title-prefix">#{prv.title}</span><br>) if prv.title}#{prv.text}</div>
|
|
53
|
+
#{Pagination.pagitem_html text, left: true}
|
|
22
54
|
</a>
|
|
23
55
|
HTML
|
|
24
56
|
else
|
|
25
57
|
blank
|
|
26
58
|
end
|
|
27
59
|
html << if nxt
|
|
60
|
+
prefix = Pagination.display_prefix(nxt.title) if nxt.title
|
|
61
|
+
text = "#{prefix}#{nxt.text}"
|
|
28
62
|
<<~HTML
|
|
29
63
|
<a id="flip-forward" href="#{nxt.url}">
|
|
30
|
-
|
|
31
|
-
<div><i class="bi bi-chevron-compact-right"></i></div>
|
|
64
|
+
#{Pagination.pagitem_html text}
|
|
32
65
|
</a>
|
|
33
66
|
HTML
|
|
34
67
|
else
|
|
@@ -22,6 +22,12 @@ module Asciidoctor
|
|
|
22
22
|
listing: "ltg-number"
|
|
23
23
|
}.freeze
|
|
24
24
|
|
|
25
|
+
def initialize(*args)
|
|
26
|
+
@jupyter_cell_id = 0
|
|
27
|
+
@tabs_id = 0
|
|
28
|
+
super
|
|
29
|
+
end
|
|
30
|
+
|
|
25
31
|
def assign_numeral!(node, counter_name)
|
|
26
32
|
document = node.document
|
|
27
33
|
document.counters[counter_name] ||= 0
|
|
@@ -65,6 +71,14 @@ module Asciidoctor
|
|
|
65
71
|
elsif process_numbered_block? block
|
|
66
72
|
process_numbered_block! block
|
|
67
73
|
end
|
|
74
|
+
if block.option? "jupyter"
|
|
75
|
+
@jupyter_cell_id += 1
|
|
76
|
+
block.set_attr "jupyter-cell-id", @jupyter_cell_id
|
|
77
|
+
end
|
|
78
|
+
return unless block.option? "tabs"
|
|
79
|
+
|
|
80
|
+
@tabs_id += 1
|
|
81
|
+
block.set_attr "tabs-id", @tabs_id
|
|
68
82
|
end
|
|
69
83
|
|
|
70
84
|
def env(context, style)
|
|
@@ -12,12 +12,12 @@ module Asciidoctor
|
|
|
12
12
|
def search_page
|
|
13
13
|
content = <<~HTML
|
|
14
14
|
<div class="search-form-container">
|
|
15
|
-
<div id="search-form-spinner" class="d-flex justify-content-center">
|
|
15
|
+
<div id="search-form-spinner" class="d-flex justify-content-center position-absolute w-100">
|
|
16
16
|
<div class="spinner-border" role="status">
|
|
17
17
|
<span class="visually-hidden">Loading...</span>
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
|
-
<form id="search-form" class="search-form
|
|
20
|
+
<form id="search-form" class="search-form invisible">
|
|
21
21
|
<input type="text" id="search-text" name="search-text" class="form-control search-box" placeholder="Search">
|
|
22
22
|
<button type="submit" class="btn btn-primary search-btn">Go</button>
|
|
23
23
|
</form>
|
|
@@ -33,11 +33,10 @@ module Asciidoctor
|
|
|
33
33
|
title: @title,
|
|
34
34
|
short_title: @short_title,
|
|
35
35
|
authors: display_authors,
|
|
36
|
-
date: @date,
|
|
37
36
|
chapsubheading: "Search",
|
|
38
|
-
langs: [],
|
|
39
37
|
at_head_end: %(<script defer src="https://cdn.jsdelivr.net/npm/lunr@2.3.9/lunr.min.js"></script>),
|
|
40
|
-
at_body_end: %(<script type="module">#{lunr_script}</script>)
|
|
38
|
+
at_body_end: %(<script type="module">#{lunr_script}</script>),
|
|
39
|
+
pagestyle: :single
|
|
41
40
|
)
|
|
42
41
|
end
|
|
43
42
|
|
|
@@ -168,7 +167,7 @@ module Asciidoctor
|
|
|
168
167
|
resultsContainer.classList.remove('hidden');
|
|
169
168
|
}
|
|
170
169
|
document.getElementById('search-form-spinner').classList.add('hidden');
|
|
171
|
-
searchForm.classList.remove('
|
|
170
|
+
searchForm.classList.remove('invisible');
|
|
172
171
|
searchForm.addEventListener('submit', e => {
|
|
173
172
|
e.preventDefault();
|
|
174
173
|
const searchText = searchBox.value;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "utils"
|
|
4
|
+
|
|
5
|
+
module Asciidoctor
|
|
6
|
+
module Html
|
|
7
|
+
# Helpers for the tabs conversion
|
|
8
|
+
module Tabs
|
|
9
|
+
def self.convert_tabs(node)
|
|
10
|
+
tabs_id = node.attr "tabs-id"
|
|
11
|
+
nav = [%(<div class="nav nav-tabs" role="tablist">)]
|
|
12
|
+
panes = [%(<div class="tab-content">)]
|
|
13
|
+
pane_number = 1
|
|
14
|
+
node.items.each do |terms, dd|
|
|
15
|
+
return %(<p class="text-danger">Definition is required.</p>) unless dd
|
|
16
|
+
|
|
17
|
+
active = pane_number == 1
|
|
18
|
+
tab_id = "tab-#{tabs_id}-#{pane_number}"
|
|
19
|
+
pane_id = "#{tab_id}-pane"
|
|
20
|
+
terms.each do |dt|
|
|
21
|
+
class_attr = %( class="nav-link#{" active" if active}")
|
|
22
|
+
target_attr = %( data-bs-target="##{pane_id}")
|
|
23
|
+
selected_attr = %( aria-selected="#{active ? "true" : "false"}")
|
|
24
|
+
other_attrs = %( data-bs-toggle="tab" type="button" role="tab" aria-controls="#{pane_id}")
|
|
25
|
+
id_attr = %( id="#{tab_id}")
|
|
26
|
+
nav << %(<button#{id_attr}#{class_attr}#{target_attr}#{other_attrs}#{selected_attr}>#{dt.text}</button>)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class_attr = %( class="tab-pane#{" show active" if active}")
|
|
30
|
+
id_attr = %( id="#{pane_id}")
|
|
31
|
+
other_attrs = %( role="tabpanel" aria-labelledby="#{tab_id}" tabindex="0")
|
|
32
|
+
panes << %(<div#{id_attr}#{class_attr}#{other_attrs}>)
|
|
33
|
+
panes << %(<p>#{dd.text}</p>) if dd.text?
|
|
34
|
+
panes << dd.content if dd.blocks?
|
|
35
|
+
panes << "</div>"
|
|
36
|
+
pane_number += 1
|
|
37
|
+
end
|
|
38
|
+
nav << "</div> <!-- .nav.nav-tabs -->\n"
|
|
39
|
+
panes << "</div> <!-- .tab-content -->\n"
|
|
40
|
+
content = %(<div class="tabs">\n#{nav.join("\n")}#{panes.join("\n")}</div> <!-- .tabs -->\n)
|
|
41
|
+
Utils.wrap_id_classes_with_title(content, node, node.id, "tabs-wrapper")
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -103,6 +103,14 @@ module Asciidoctor
|
|
|
103
103
|
def self.line_number_attr(line_number, live: false)
|
|
104
104
|
live ? %( data-line-number="#{line_number}") : ""
|
|
105
105
|
end
|
|
106
|
+
|
|
107
|
+
def self.heading(node, title, discrete: false)
|
|
108
|
+
level = node.level
|
|
109
|
+
tag_level = [level + 1, 6].min
|
|
110
|
+
tag_name = %(h#{tag_level})
|
|
111
|
+
classes = %( class="#{node.role}") if discrete && node.role
|
|
112
|
+
%(<#{tag_name}#{classes}>#{title}</#{tag_name}>\n)
|
|
113
|
+
end
|
|
106
114
|
end
|
|
107
115
|
end
|
|
108
116
|
end
|
|
@@ -4,14 +4,19 @@ require "json"
|
|
|
4
4
|
|
|
5
5
|
module Asciidoctor
|
|
6
6
|
module Html
|
|
7
|
-
# Generates the site.webmanifest
|
|
7
|
+
# Generates the site.webmanifest
|
|
8
8
|
module Webmanifest
|
|
9
9
|
def self.generate(name, short_name)
|
|
10
10
|
{
|
|
11
11
|
name:,
|
|
12
12
|
short_name:,
|
|
13
13
|
icons: %w[192x192 512x512].map do |sizes|
|
|
14
|
-
{
|
|
14
|
+
{
|
|
15
|
+
src: "#{FAVICON_PATH}/web-app-manifest-#{sizes}.png",
|
|
16
|
+
sizes:,
|
|
17
|
+
type: "image/png",
|
|
18
|
+
purpose: "maskable"
|
|
19
|
+
}
|
|
15
20
|
end,
|
|
16
21
|
theme_color: "#ffffff",
|
|
17
22
|
background_color: "#ffffff",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: asciidoctor-html
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ravi Rajani
|
|
@@ -94,16 +94,17 @@ files:
|
|
|
94
94
|
- LICENSE.txt
|
|
95
95
|
- README.md
|
|
96
96
|
- Rakefile
|
|
97
|
+
- asciidoctor-html.svg
|
|
97
98
|
- assets/css/fonts/bootstrap-icons.woff
|
|
98
99
|
- assets/css/fonts/bootstrap-icons.woff2
|
|
99
100
|
- assets/css/jupyterlite.css
|
|
100
101
|
- assets/css/styles.css
|
|
101
|
-
- assets/favicon/android-chrome-192x192.png
|
|
102
|
-
- assets/favicon/android-chrome-512x512.png
|
|
103
102
|
- assets/favicon/apple-touch-icon.png
|
|
104
|
-
- assets/favicon/favicon-
|
|
105
|
-
- assets/favicon/favicon-32x32.png
|
|
103
|
+
- assets/favicon/favicon-96x96.png
|
|
106
104
|
- assets/favicon/favicon.ico
|
|
105
|
+
- assets/favicon/favicon.svg
|
|
106
|
+
- assets/favicon/web-app-manifest-192x192.png
|
|
107
|
+
- assets/favicon/web-app-manifest-512x512.png
|
|
107
108
|
- exe/adoctohtml
|
|
108
109
|
- exe/build-jupyterlite
|
|
109
110
|
- jupyterlite/.gitignore
|
|
@@ -134,6 +135,7 @@ files:
|
|
|
134
135
|
- lib/asciidoctor/html/sidebar.rb
|
|
135
136
|
- lib/asciidoctor/html/subnav_block_macro.rb
|
|
136
137
|
- lib/asciidoctor/html/table.rb
|
|
138
|
+
- lib/asciidoctor/html/tabs.rb
|
|
137
139
|
- lib/asciidoctor/html/text_inline_macro.rb
|
|
138
140
|
- lib/asciidoctor/html/tree_walker.rb
|
|
139
141
|
- lib/asciidoctor/html/utils.rb
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|