asciidoctor-html 2.4.0 → 2.4.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.
@@ -210,6 +210,15 @@ module Asciidoctor
210
210
  <link rel="apple-touch-icon" sizes="180x180" href="#{FAVICON_PATH}/apple-touch-icon.png">
211
211
  <meta name="apple-mobile-web-app-title" content="#{opts[:short_title]}">
212
212
  <link rel="manifest" href="site.webmanifest">
213
+ <script>
214
+ (function() {
215
+ const params = new URLSearchParams(window.location.search);
216
+ const role = params.get('role');
217
+ if (role && /^[a-zA-Z0-9_-]+$/.test(role)) {
218
+ document.documentElement.classList.add(role);
219
+ }
220
+ })();
221
+ </script>
213
222
  <link rel="stylesheet" href="#{CSS_PATH}/styles.css">
214
223
  #{highlightjs(opts)}
215
224
  <script>
@@ -202,9 +202,6 @@ module Asciidoctor
202
202
  else if (direction == 'left' && (link = document.getElementById('flip-back')))
203
203
  navigation.navigate(link.href);
204
204
  }
205
- function addRole(className) {
206
- document.body.classList.add(className);
207
- }
208
205
  addEventListener('hashchange', flip);
209
206
  addEventListener('keyup', function(e) {
210
207
  switch(e.key) {
@@ -244,9 +241,9 @@ module Asciidoctor
244
241
  }));
245
242
 
246
243
  const viewmode = urlParams.get('viewmode');
247
- viewmode && changeViewmode(viewmode);
248
- const role = urlParams.get('role');
249
- role && addRole(role);
244
+ if(['single', 'multi', 'presentation'].includes(viewmode)) {
245
+ changeViewmode(viewmode);
246
+ }
250
247
 
251
248
  flip();
252
249
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module Html
5
- VERSION = "2.4.0"
5
+ VERSION = "2.4.1"
6
6
  end
7
7
  end
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.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ravi Rajani