asciidoctor-revealjs 3.1.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +86 -0
  3. data/HACKING.adoc +18 -11
  4. data/README.adoc +260 -27
  5. data/Rakefile +12 -4
  6. data/asciidoctor-revealjs.gemspec +4 -2
  7. data/examples/docinfo-footer-revealjs.html +10 -0
  8. data/examples/docinfo-revealjs.html +7 -0
  9. data/examples/font-awesome.adoc +2 -1
  10. data/examples/font-awesome.css +3 -0
  11. data/examples/fragments.adoc +32 -0
  12. data/examples/fragments.css +18 -0
  13. data/examples/grid-layout-docinfo-revealjs.html +11 -0
  14. data/examples/grid-layout.adoc +174 -0
  15. data/examples/history-hash.adoc +19 -0
  16. data/examples/history-regression-tests.adoc +0 -5
  17. data/examples/history.adoc +4 -4
  18. data/examples/images/asciidoctor-logo.svg +102 -0
  19. data/examples/level-sectnums.adoc +24 -0
  20. data/examples/links-preview.adoc +32 -0
  21. data/examples/links.adoc +39 -0
  22. data/examples/release-4.0.adoc +195 -0
  23. data/examples/release-4.0.css +23 -0
  24. data/examples/source-coderay.adoc +15 -0
  25. data/examples/source-emphasis.adoc +128 -0
  26. data/examples/source-highlightjs-html.adoc +1 -1
  27. data/examples/source-highlightjs-languages.adoc +27 -0
  28. data/examples/source-highlightjs.adoc +85 -2
  29. data/examples/source-pygments.adoc +12 -0
  30. data/examples/source-rouge-docinfo.html +8 -0
  31. data/examples/source-rouge.adoc +18 -0
  32. data/examples/video.adoc +12 -3
  33. data/examples/with-docinfo-shared.adoc +13 -0
  34. data/lib/asciidoctor-revealjs/converter.rb +312 -136
  35. data/lib/asciidoctor-revealjs/highlightjs.rb +333 -2
  36. data/lib/asciidoctor-revealjs/version.rb +1 -1
  37. data/templates/asciidoctor-compatibility.css +141 -0
  38. data/templates/document.html.slim +64 -53
  39. data/templates/helpers.rb +93 -1
  40. data/templates/image.html.slim +1 -1
  41. data/templates/inline_anchor.html.slim +2 -1
  42. data/templates/inline_image.html.slim +3 -3
  43. data/templates/listing.html.slim +1 -1
  44. data/templates/section.html.slim +34 -43
  45. data/templates/stretch_nested_elements.js.slim +65 -0
  46. data/templates/title_slide.html.slim +28 -0
  47. metadata +55 -8
  48. data/examples/revealjs-features.adoc +0 -23
  49. data/templates/asciidoctor_revealjs.css.slim +0 -59
@@ -0,0 +1,65 @@
1
+ javascript:
2
+ var dom = {};
3
+ dom.slides = document.querySelector('.reveal .slides');
4
+
5
+ function getRemainingHeight(element, slideElement, height) {
6
+ height = height || 0;
7
+ if (element) {
8
+ var newHeight, oldHeight = element.style.height;
9
+ // Change the .stretch element height to 0 in order find the height of all
10
+ // the other elements
11
+ element.style.height = '0px';
12
+ // In Overview mode, the parent (.slide) height is set of 700px.
13
+ // Restore it temporarily to its natural height.
14
+ slideElement.style.height = 'auto';
15
+ newHeight = height - slideElement.offsetHeight;
16
+ // Restore the old height, just in case
17
+ element.style.height = oldHeight + 'px';
18
+ // Clear the parent (.slide) height. .removeProperty works in IE9+
19
+ slideElement.style.removeProperty('height');
20
+ return newHeight;
21
+ }
22
+ return height;
23
+ }
24
+
25
+ function layoutSlideContents(width, height) {
26
+ // Handle sizing of elements with the 'stretch' class
27
+ toArray(dom.slides.querySelectorAll('section .stretch')).forEach(function (element) {
28
+ // Determine how much vertical space we can use
29
+ var limit = 5; // hard limit
30
+ var parent = element.parentNode;
31
+ while (parent.nodeName !== 'SECTION' && limit > 0) {
32
+ parent = parent.parentNode;
33
+ limit--;
34
+ }
35
+ if (limit === 0) {
36
+ // unable to find parent, aborting!
37
+ return;
38
+ }
39
+ var remainingHeight = getRemainingHeight(element, parent, height);
40
+ // Consider the aspect ratio of media elements
41
+ if (/(img|video)/gi.test(element.nodeName)) {
42
+ var nw = element.naturalWidth || element.videoWidth, nh = element.naturalHeight || element.videoHeight;
43
+ var es = Math.min(width / nw, remainingHeight / nh);
44
+ element.style.width = (nw * es) + 'px';
45
+ element.style.height = (nh * es) + 'px';
46
+ } else {
47
+ element.style.width = width + 'px';
48
+ element.style.height = remainingHeight + 'px';
49
+ }
50
+ });
51
+ }
52
+
53
+ function toArray(o) {
54
+ return Array.prototype.slice.call(o);
55
+ }
56
+
57
+ Reveal.addEventListener('slidechanged', function () {
58
+ layoutSlideContents(#{attr 'revealjs_width', 960}, #{attr 'revealjs_height', 700})
59
+ });
60
+ Reveal.addEventListener('ready', function () {
61
+ layoutSlideContents(#{attr 'revealjs_width', 960}, #{attr 'revealjs_height', 700})
62
+ });
63
+ Reveal.addEventListener('resize', function () {
64
+ layoutSlideContents(#{attr 'revealjs_width', 960}, #{attr 'revealjs_height', 700})
65
+ });
@@ -0,0 +1,28 @@
1
+ - bg_image = (attr? 'title-slide-background-image') ? (image_uri(attr 'title-slide-background-image')) : nil
2
+ - bg_video = (attr? 'title-slide-background-video') ? (media_uri(attr 'title-slide-background-video')) : nil
3
+ section.title(class = role
4
+ data-state='title'
5
+ data-transition=(attr 'title-slide-transition')
6
+ data-transition-speed=(attr 'title-slide-transition-speed')
7
+ data-background=(attr 'title-slide-background')
8
+ data-background-size=(attr 'title-slide-background-size')
9
+ data-background-image=bg_image
10
+ data-background-video=bg_video
11
+ data-background-video-loop=(attr 'title-slide-background-video-loop')
12
+ data-background-video-muted=(attr 'title-slide-background-video-muted')
13
+ data-background-opacity=(attr 'title-slide-background-opacity')
14
+ data-background-iframe=(attr 'title-slide-background-iframe')
15
+ data-background-color=(attr 'title-slide-background-color')
16
+ data-background-repeat=(attr 'title-slide-background-repeat')
17
+ data-background-position=(attr 'title-slide-background-position')
18
+ data-background-transition=(attr 'title-slide-background-transition'))
19
+ - if (_title_obj = doctitle partition: true, use_fallback: true).subtitle?
20
+ h1=slice_text _title_obj.title, (_slice = header.option? :slice)
21
+ h2=slice_text _title_obj.subtitle, _slice
22
+ - else
23
+ h1=@header.title
24
+ - preamble = @document.find_by context: :preamble
25
+ - unless preamble.nil? or preamble.length == 0
26
+ div.preamble=preamble.pop.content
27
+ - unless author.nil?
28
+ p.author: small=author
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-revealjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Bilodeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-19 00:00:00.000000000 Z
11
+ date: 2020-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -86,20 +86,48 @@ dependencies:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
88
  version: 2.0.0.beta.5
89
+ - !ruby/object:Gem::Dependency
90
+ name: minitest
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '5.14'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '5.14'
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: pry
91
105
  requirement: !ruby/object:Gem::Requirement
92
106
  requirements:
93
107
  - - "~>"
94
108
  - !ruby/object:Gem::Version
95
- version: 0.10.4
109
+ version: 0.12.0
96
110
  type: :development
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - "~>"
101
115
  - !ruby/object:Gem::Version
102
- version: 0.10.4
116
+ version: 0.12.0
117
+ - !ruby/object:Gem::Dependency
118
+ name: irb
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
103
131
  - !ruby/object:Gem::Dependency
104
132
  name: pry-byebug
105
133
  requirement: !ruby/object:Gem::Requirement
@@ -148,14 +176,14 @@ dependencies:
148
176
  requirements:
149
177
  - - "~>"
150
178
  - !ruby/object:Gem::Version
151
- version: 0.4.2
179
+ version: 0.6.0
152
180
  type: :development
153
181
  prerelease: false
154
182
  version_requirements: !ruby/object:Gem::Requirement
155
183
  requirements:
156
184
  - - "~>"
157
185
  - !ruby/object:Gem::Version
158
- version: 0.4.2
186
+ version: 0.6.0
159
187
  - !ruby/object:Gem::Dependency
160
188
  name: slim
161
189
  requirement: !ruby/object:Gem::Requirement
@@ -228,11 +256,20 @@ files:
228
256
  - examples/customcss.css
229
257
  - examples/data-background-newstyle.adoc
230
258
  - examples/data-background-oldstyle.adoc
259
+ - examples/docinfo-footer-revealjs.html
260
+ - examples/docinfo-revealjs.html
231
261
  - examples/font-awesome.adoc
262
+ - examples/font-awesome.css
263
+ - examples/fragments.adoc
264
+ - examples/fragments.css
265
+ - examples/grid-layout-docinfo-revealjs.html
266
+ - examples/grid-layout.adoc
267
+ - examples/history-hash.adoc
232
268
  - examples/history-regression-tests.adoc
233
269
  - examples/history.adoc
234
270
  - examples/images.adoc
235
271
  - examples/images/70s.jpg
272
+ - examples/images/asciidoctor-logo.svg
236
273
  - examples/images/bio.jpg
237
274
  - examples/images/cover.jpg
238
275
  - examples/images/meme-2.jpg
@@ -240,8 +277,12 @@ files:
240
277
  - examples/images/web_surfing_time.gif
241
278
  - examples/keyboard-shortcuts.adoc
242
279
  - examples/level-sections.adoc
280
+ - examples/level-sectnums.adoc
281
+ - examples/links-preview.adoc
282
+ - examples/links.adoc
243
283
  - examples/multi-destination-content.adoc
244
- - examples/revealjs-features.adoc
284
+ - examples/release-4.0.adoc
285
+ - examples/release-4.0.css
245
286
  - examples/revealjs-plugin-activation.adoc
246
287
  - examples/revealjs-plugins-conf.js
247
288
  - examples/revealjs-plugins.adoc
@@ -293,10 +334,13 @@ files:
293
334
  - examples/slide-state.css
294
335
  - examples/source-callouts.adoc
295
336
  - examples/source-coderay.adoc
337
+ - examples/source-emphasis.adoc
296
338
  - examples/source-highlightjs-html.adoc
339
+ - examples/source-highlightjs-languages.adoc
297
340
  - examples/source-highlightjs.adoc
298
341
  - examples/source-prettify.adoc
299
342
  - examples/source-pygments.adoc
343
+ - examples/source-rouge-docinfo.html
300
344
  - examples/source-rouge.adoc
301
345
  - examples/speaker-notes.adoc
302
346
  - examples/tables-styles.adoc
@@ -310,13 +354,14 @@ files:
310
354
  - examples/transitions.adoc
311
355
  - examples/vertical-slides.adoc
312
356
  - examples/video.adoc
357
+ - examples/with-docinfo-shared.adoc
313
358
  - lib/asciidoctor-revealjs.rb
314
359
  - lib/asciidoctor-revealjs/converter.rb
315
360
  - lib/asciidoctor-revealjs/highlightjs.rb
316
361
  - lib/asciidoctor-revealjs/version.rb
317
362
  - lib/asciidoctor-templates-compiler.rb
318
363
  - templates/admonition.html.slim
319
- - templates/asciidoctor_revealjs.css.slim
364
+ - templates/asciidoctor-compatibility.css
320
365
  - templates/audio.html.slim
321
366
  - templates/colist.html.slim
322
367
  - templates/dlist.html.slim
@@ -351,8 +396,10 @@ files:
351
396
  - templates/section.html.slim
352
397
  - templates/sidebar.html.slim
353
398
  - templates/stem.html.slim
399
+ - templates/stretch_nested_elements.js.slim
354
400
  - templates/table.html.slim
355
401
  - templates/thematic_break.html.slim
402
+ - templates/title_slide.html.slim
356
403
  - templates/toc.html.slim
357
404
  - templates/ulist.html.slim
358
405
  - templates/verse.html.slim
@@ -1,23 +0,0 @@
1
- // .revealjs-features
2
- // This example tests some of Reveal.js 3.7.0 features
3
- // :include: //body/script | //div[@class="slides"]
4
- // :header_footer:
5
- = Reveal.JS
6
- :revealjs_history: true
7
- :revealjs_fragmentInURL: true
8
-
9
- == Slide One
10
-
11
- Some content
12
-
13
- === And
14
-
15
- With Reveal.JS 3.6
16
-
17
- === Fragments
18
-
19
- Can now be displayed in URLs
20
-
21
- == Second slide
22
-
23
- Done
@@ -1,59 +0,0 @@
1
- /! This CSS is generated by the Asciidoctor-Reveal.js converter to further integrate AsciiDoc's existing semantic with Reveal.js
2
- css:
3
- .reveal div.right {
4
- float: right;
5
- }
6
-
7
- .reveal .listingblock.stretch > .content {
8
- height: 100%;
9
- }
10
-
11
- .reveal .listingblock.stretch > .content > pre {
12
- height: 100%;
13
- }
14
-
15
- .reveal .listingblock.stretch > .content > pre > code {
16
- height: 100%;
17
- max-height: 100%;
18
- }
19
-
20
- /* tables */
21
- table{border-collapse:collapse;border-spacing:0}
22
- table{margin-bottom:1.25em;border:solid 1px #dedede}
23
- table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;text-align:left}
24
- table tr th,table tr td{padding:.5625em .625em;font-size:inherit}
25
- table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6}
26
- td.tableblock>.content{margin-bottom:1.25em}
27
- td.tableblock>.content>:last-child{margin-bottom:-1.25em}
28
- table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
29
- table.grid-all>thead>tr>.tableblock,table.grid-all>tbody>tr>.tableblock{border-width:0 1px 1px 0}
30
- table.grid-all>tfoot>tr>.tableblock{border-width:1px 1px 0 0}
31
- table.grid-cols>*>tr>.tableblock{border-width:0 1px 0 0}
32
- table.grid-rows>thead>tr>.tableblock,table.grid-rows>tbody>tr>.tableblock{border-width:0 0 1px}
33
- table.grid-rows>tfoot>tr>.tableblock{border-width:1px 0 0}
34
- table.grid-all>*>tr>.tableblock:last-child,table.grid-cols>*>tr>.tableblock:last-child{border-right-width:0}
35
- table.grid-all>tbody>tr:last-child>.tableblock,table.grid-all>thead:last-child>tr>.tableblock,table.grid-rows>tbody>tr:last-child>.tableblock,table.grid-rows>thead:last-child>tr>.tableblock{border-bottom-width:0}
36
- table.frame-all{border-width:1px}
37
- table.frame-sides{border-width:0 1px}
38
- table.frame-topbot,table.frame-ends{border-width:1px 0}
39
- .reveal table th.halign-left,.reveal table td.halign-left{text-align:left}
40
- .reveal table th.halign-right,.reveal table td.halign-right{text-align:right}
41
- .reveal table th.halign-center,.reveal table td.halign-center{text-align:center}
42
- .reveal table th.valign-top,.reveal table td.valign-top{vertical-align:top}
43
- .reveal table th.valign-bottom,.reveal table td.valign-bottom{vertical-align:bottom}
44
- .reveal table th.valign-middle,.reveal table td.valign-middle{vertical-align:middle}
45
- table thead th,table tfoot th{font-weight:bold}
46
- tbody tr th{display:table-cell;line-height:1.6}
47
- tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{font-weight:bold}
48
- thead{display:table-header-group}
49
-
50
- .reveal table.grid-none th,.reveal table.grid-none td{border-bottom:0!important}
51
-
52
- /* callouts */
53
- .conum[data-value]{display:inline-block;color:#fff!important;background:rgba(0,0,0,.8);-webkit-border-radius:50%;border-radius:50%;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
54
- .conum[data-value] *{color:#fff!important}
55
- .conum[data-value]+b{display:none}
56
- .conum[data-value]::after{content:attr(data-value)}
57
- pre .conum[data-value]{position:relative;top:-.125em}
58
- b.conum *{color:inherit!important}
59
- .conum:not([data-value]):empty{display:none}