asciidoctor-html 2.2.9 → 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/CHANGELOG.md +9 -0
- data/assets/css/jupyterlite-repl.css +1 -1
- data/assets/css/styles.css +2 -2
- data/lib/asciidoctor/html/book_template.rb +1 -1
- data/lib/asciidoctor/html/flip.rb +17 -7
- data/lib/asciidoctor/html/version.rb +1 -1
- metadata +1 -1
|
@@ -259,7 +259,7 @@ module Asciidoctor
|
|
|
259
259
|
def self.html(content, nav_items, opts = {})
|
|
260
260
|
nav = !nav_items.empty? && (nav_items.size > 1 || opts[:has_subnav])
|
|
261
261
|
page_classes = ["page"]
|
|
262
|
-
if
|
|
262
|
+
if opts[:has_subnav]
|
|
263
263
|
page_classes << "multi" unless opts[:pagestyle] == :single
|
|
264
264
|
page_classes << "presentation" if opts[:pagestyle] == :presentation
|
|
265
265
|
end
|
|
@@ -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,
|
|
@@ -144,6 +146,11 @@ module Asciidoctor
|
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
|
|
149
|
+
nav.forEach(el => {
|
|
150
|
+
const a = el.querySelector('a');
|
|
151
|
+
a && a.hash && el.classList.toggle('active', id == a.hash.substring(1));
|
|
152
|
+
});
|
|
153
|
+
|
|
147
154
|
const typesetEls = paginator ? [...activeSects, paginator] : activeSects;
|
|
148
155
|
// MathJax needs displayed content to calculate auto line breaks.
|
|
149
156
|
await MathJax.startup.promise;
|
|
@@ -151,11 +158,6 @@ module Asciidoctor
|
|
|
151
158
|
ADHT.nudgeMenuBtn();
|
|
152
159
|
page.classList.add('loaded');
|
|
153
160
|
|
|
154
|
-
nav.forEach(el => {
|
|
155
|
-
const a = el.querySelector('a');
|
|
156
|
-
a && a.hash && el.classList.toggle('active', id == a.hash.substring(1));
|
|
157
|
-
});
|
|
158
|
-
|
|
159
161
|
if(target == section && page.classList.contains('multi') || target == page) {
|
|
160
162
|
scrollEl.scrollTo({
|
|
161
163
|
top: id in scrollTop ? scrollTop[id] : 0,
|
|
@@ -203,13 +205,19 @@ module Asciidoctor
|
|
|
203
205
|
addEventListener('hashchange', flip);
|
|
204
206
|
addEventListener('keyup', function(e) {
|
|
205
207
|
switch(e.key) {
|
|
206
|
-
case 'ArrowLeft': move('left'); break;
|
|
207
|
-
case 'ArrowRight': move('right'); break;
|
|
208
208
|
case 'q':
|
|
209
209
|
case 'Escape':
|
|
210
210
|
page.classList.contains('presentation') && changeViewmode('multi');
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
|
+
addEventListener('keydown', function(e) {
|
|
214
|
+
if(e.altKey) return;
|
|
215
|
+
|
|
216
|
+
switch(e.key) {
|
|
217
|
+
case 'ArrowLeft': move('left'); break;
|
|
218
|
+
case 'ArrowRight': move('right');
|
|
219
|
+
}
|
|
220
|
+
});
|
|
213
221
|
document.querySelectorAll('a').forEach(el => {
|
|
214
222
|
el.addEventListener('click', () => {
|
|
215
223
|
const scrollEl = getScrollEl();
|
|
@@ -232,6 +240,8 @@ module Asciidoctor
|
|
|
232
240
|
changeViewmode(viewmode);
|
|
233
241
|
}));
|
|
234
242
|
|
|
243
|
+
const viewmode = urlParams.get('viewmode');
|
|
244
|
+
viewmode && changeViewmode(viewmode);
|
|
235
245
|
flip();
|
|
236
246
|
|
|
237
247
|
ADHT.move = move;
|