asciidoctor-html 2.3.0 → 2.3.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/CHANGELOG.md +9 -0
- data/assets/css/jupyterlite-repl.css +1 -1
- data/assets/css/styles.css +2 -2
- data/lib/asciidoctor/html/flip.rb +18 -2
- data/lib/asciidoctor/html/popovers.rb +4 -0
- data/lib/asciidoctor/html/utils.rb +1 -1
- data/lib/asciidoctor/html/version.rb +1 -1
- metadata +1 -1
|
@@ -8,6 +8,8 @@ module Asciidoctor
|
|
|
8
8
|
module Flip
|
|
9
9
|
FLIP = <<~JS.freeze
|
|
10
10
|
(function() {
|
|
11
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
12
|
+
|
|
11
13
|
// Holds replaced pagination links to prev/next chapter
|
|
12
14
|
const chapPagination = {
|
|
13
15
|
prevChap: null,
|
|
@@ -200,16 +202,25 @@ module Asciidoctor
|
|
|
200
202
|
else if (direction == 'left' && (link = document.getElementById('flip-back')))
|
|
201
203
|
navigation.navigate(link.href);
|
|
202
204
|
}
|
|
205
|
+
function addRole(className) {
|
|
206
|
+
document.body.classList.add(className);
|
|
207
|
+
}
|
|
203
208
|
addEventListener('hashchange', flip);
|
|
204
209
|
addEventListener('keyup', function(e) {
|
|
205
210
|
switch(e.key) {
|
|
206
|
-
case 'ArrowLeft': move('left'); break;
|
|
207
|
-
case 'ArrowRight': move('right'); break;
|
|
208
211
|
case 'q':
|
|
209
212
|
case 'Escape':
|
|
210
213
|
page.classList.contains('presentation') && changeViewmode('multi');
|
|
211
214
|
}
|
|
212
215
|
});
|
|
216
|
+
addEventListener('keydown', function(e) {
|
|
217
|
+
if(e.altKey) return;
|
|
218
|
+
|
|
219
|
+
switch(e.key) {
|
|
220
|
+
case 'ArrowLeft': move('left'); break;
|
|
221
|
+
case 'ArrowRight': move('right');
|
|
222
|
+
}
|
|
223
|
+
});
|
|
213
224
|
document.querySelectorAll('a').forEach(el => {
|
|
214
225
|
el.addEventListener('click', () => {
|
|
215
226
|
const scrollEl = getScrollEl();
|
|
@@ -232,6 +243,11 @@ module Asciidoctor
|
|
|
232
243
|
changeViewmode(viewmode);
|
|
233
244
|
}));
|
|
234
245
|
|
|
246
|
+
const viewmode = urlParams.get('viewmode');
|
|
247
|
+
viewmode && changeViewmode(viewmode);
|
|
248
|
+
const role = urlParams.get('role');
|
|
249
|
+
role && addRole(role);
|
|
250
|
+
|
|
235
251
|
flip();
|
|
236
252
|
|
|
237
253
|
ADHT.move = move;
|
|
@@ -39,6 +39,10 @@ module Asciidoctor
|
|
|
39
39
|
await MathJax.startup.promise;
|
|
40
40
|
await initPopovers();
|
|
41
41
|
|
|
42
|
+
document.querySelectorAll('.btn-po[data-contentid]').forEach(el => {
|
|
43
|
+
el.addEventListener('click', e => e.preventDefault());
|
|
44
|
+
});
|
|
45
|
+
|
|
42
46
|
// Enable tooltips
|
|
43
47
|
document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(el => {
|
|
44
48
|
bootstrap.Tooltip.getOrCreateInstance(el);
|
|
@@ -74,7 +74,7 @@ module Asciidoctor
|
|
|
74
74
|
def self.popover_button(content, content_id, classes = nil)
|
|
75
75
|
extra_classes = classes ? " #{classes}" : ""
|
|
76
76
|
attrs = %( tabindex="0" role="button" class="btn-po#{extra_classes}" data-contentid="#{content_id}")
|
|
77
|
-
%(<a#{attrs}>#{content}</a>)
|
|
77
|
+
%(<a href="##{content_id}"#{attrs}>#{content}</a>)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
def self.display_sectnum(node, level = 1)
|