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
@@ -2,6 +2,10 @@ doctype 5
2
2
  html lang=(attr :lang, 'en' unless attr? :nolang)
3
3
  head
4
4
  meta charset="utf-8"
5
+ meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui"
6
+
7
+ title=(doctitle sanitize: true, use_fallback: true)
8
+
5
9
  - if RUBY_ENGINE == 'opal' && JAVASCRIPT_PLATFORM == 'node'
6
10
  - revealjsdir = (attr :revealjsdir, 'node_modules/reveal.js')
7
11
  - else
@@ -13,17 +17,17 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
13
17
  - if attr? key
14
18
  meta name=key content=(attr key)
15
19
  - linkcss = (attr? 'linkcss')
16
- title=(doctitle sanitize: true, use_fallback: true)
17
- meta content="yes" name="apple-mobile-web-app-capable"
18
- meta content="black-translucent" name="apple-mobile-web-app-status-bar-style"
19
- meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" name="viewport"
20
- link href="#{revealjsdir}/css/reveal.css" rel="stylesheet"
20
+ link rel="stylesheet" href="#{revealjsdir}/css/reset.css"
21
+ link rel="stylesheet" href="#{revealjsdir}/css/reveal.css"
22
+
21
23
  / Default theme required even when using custom theme
22
24
  - if attr? :revealjs_customtheme
23
25
  link rel='stylesheet' href=(attr :revealjs_customtheme) id='theme'
24
26
  - else
25
27
  link rel='stylesheet' href='#{revealjsdir}/css/theme/#{attr 'revealjs_theme', 'black'}.css' id='theme'
26
- include asciidoctor_revealjs.css.slim
28
+ /! This CSS is generated by the Asciidoctor reveal.js converter to further integrate AsciiDoc's existing semantic with reveal.js
29
+ style type="text/css"
30
+ include asciidoctor-compatibility.css
27
31
  - if attr? :icons, 'font'
28
32
  / iconfont-remote is implicitly set by Asciidoctor core. See https://github.com/asciidoctor/asciidoctor.org/issues/361
29
33
  - if attr? 'iconfont-remote'
@@ -53,55 +57,33 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
53
57
  - syntax_hl = self.syntax_highlighter
54
58
  - if syntax_hl && (syntax_hl.docinfo? :head)
55
59
  =syntax_hl.docinfo :head, self, cdn_base_url: cdn_base, linkcss: linkcss, self_closing_tag_slash: '/'
56
- / If the query includes 'print-pdf', use the PDF print sheet
60
+
61
+ /! Printing and PDF exports
57
62
  javascript:
58
63
  var link = document.createElement( 'link' );
59
64
  link.rel = 'stylesheet';
60
65
  link.type = 'text/css';
61
66
  link.href = window.location.search.match( /print-pdf/gi ) ? "#{revealjsdir}/css/print/pdf.css" : "#{revealjsdir}/css/print/paper.css";
62
67
  document.getElementsByTagName( 'head' )[0].appendChild( link );
63
- /[if lt IE 9]
64
- <script src="#{revealjsdir}/lib/js/html5shiv.js"></script>
65
- - unless (docinfo_content = docinfo :header, '.html').empty?
66
- =docinfo_content
68
+
67
69
  - if attr? :customcss
68
70
  link rel='stylesheet' href=((customcss = attr :customcss).empty? ? 'asciidoctor-revealjs.css' : customcss)
71
+ - unless (_docinfo = docinfo :head, '-revealjs.html').empty?
72
+ =_docinfo
69
73
  body
70
74
  .reveal
71
75
  / Any section element inside of this container is displayed as a slide
72
76
  .slides
73
- - unless notitle || !has_header?
74
- - bg_image = (attr? 'title-slide-background-image') ? (image_uri(attr 'title-slide-background-image')) : nil
75
- - bg_video = (attr? 'title-slide-background-video') ? (media_uri(attr 'title-slide-background-video')) : nil
76
- section.title(class = role
77
- data-state='title'
78
- data-transition=(attr 'title-slide-transition')
79
- data-transition-speed=(attr 'title-slide-transition-speed')
80
- data-background=(attr 'title-slide-background')
81
- data-background-size=(attr 'title-slide-background-size')
82
- data-background-image=bg_image
83
- data-background-video=bg_video
84
- data-background-video-loop=(attr 'title-slide-background-video-loop')
85
- data-background-video-muted=(attr 'title-slide-background-video-muted')
86
- data-background-opacity=(attr "background-opacity")
87
- data-background-iframe=(attr 'title-slide-background-iframe')
88
- data-background-color=(attr 'title-slide-background-color')
89
- data-background-repeat=(attr 'title-slide-background-repeat')
90
- data-background-position=(attr 'title-slide-background-position')
91
- data-background-transition=(attr 'title-slide-background-transition'))
92
- - if (_title_obj = doctitle partition: true, use_fallback: true).subtitle?
93
- h1=slice_text _title_obj.title, (_slice = header.option? :slice)
94
- h2=slice_text _title_obj.subtitle, _slice
95
- - else
96
- h1=@header.title
97
- - preamble = @document.find_by context: :preamble
98
- - unless preamble.nil? or preamble.length == 0
99
- div.preamble=preamble.pop.content
100
- - unless author.nil?
101
- p.author: small=author
102
- =content
103
- script src="#{revealjsdir}/lib/js/head.min.js"
77
+ - unless noheader
78
+ - unless (_docinfo = docinfo :header, '-revealjs.html').empty?
79
+ = _docinfo
80
+ - if header?
81
+ include title_slide.html.slim
82
+ = content
83
+ - unless (_docinfo = docinfo :footer, '-revealjs.html').empty?
84
+ = _docinfo
104
85
  script src="#{revealjsdir}/js/reveal.js"
86
+ / Supports easy AsciiDoc syntax for background color
105
87
  javascript:
106
88
  Array.prototype.slice.call(document.querySelectorAll('.slides section')).forEach(function(slide) {
107
89
  if (slide.getAttribute('data-background-color')) return;
@@ -112,9 +94,11 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
112
94
  slide.setAttribute('data-background-color', bgColor);
113
95
  slide.style.backgroundColor = 'transparent';
114
96
  }
115
- })
97
+ });
116
98
 
117
- // See https://github.com/hakimel/reveal.js#configuration for a full list of configuration options
99
+ // More info about config & dependencies:
100
+ // - https://github.com/hakimel/reveal.js#configuration
101
+ // - https://github.com/hakimel/reveal.js#dependencies
118
102
  Reveal.initialize({
119
103
  // Display presentation control arrows
120
104
  controls: #{to_boolean(attr 'revealjs_controls', true)},
@@ -132,7 +116,10 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
132
116
  slideNumber: #{to_valid_slidenumber(attr 'revealjs_slidenumber', false)},
133
117
  // Control which views the slide number displays on
134
118
  showSlideNumber: '#{attr 'revealjs_showslidenumber', 'all'}',
135
- // Push each slide change to the browser history
119
+ // Add the current slide number to the URL hash so that reloading the
120
+ // page/copying the URL will return you to the same slide
121
+ hash: #{to_boolean(attr 'revealjs_hash', false)},
122
+ // Push each slide change to the browser history. Implies `hash: true`
136
123
  history: #{to_boolean(attr 'revealjs_history', false)},
137
124
  // Enable keyboard shortcuts for navigation
138
125
  keyboard: #{to_boolean(attr 'revealjs_keyboard', true)},
@@ -146,6 +133,8 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
146
133
  loop: #{to_boolean(attr 'revealjs_loop', false)},
147
134
  // Change the presentation direction to be RTL
148
135
  rtl: #{to_boolean(attr 'revealjs_rtl', false)},
136
+ // See https://github.com/hakimel/reveal.js/#navigation-mode
137
+ navigationMode: '#{attr 'revealjs_navigationmode', 'default'}',
149
138
  // Randomizes the order of slides each time the presentation loads
150
139
  shuffle: #{to_boolean(attr 'revealjs_shuffle', false)},
151
140
  // Turns fragments on and off globally
@@ -166,6 +155,12 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
166
155
  // - true: All media will autoplay, regardless of individual setting
167
156
  // - false: No media will autoplay, regardless of individual setting
168
157
  autoPlayMedia: #{attr 'revealjs_autoplaymedia', 'null'},
158
+ // Global override for preloading lazy-loaded iframes
159
+ // - null: Iframes with data-src AND data-preload will be loaded when within
160
+ // the viewDistance, iframes with only data-src will be loaded when visible
161
+ // - true: All iframes with data-src will be loaded when within the viewDistance
162
+ // - false: All iframes with data-src will be loaded only when visible
163
+ preloadIframes: #{attr 'revealjs_preloadiframes', 'null'},
169
164
  // Number of milliseconds between automatically proceeding to the
170
165
  // next slide, disabled when set to 0, this value can be overwritten
171
166
  // by using a data-autoslide attribute on your slides
@@ -178,8 +173,23 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
178
173
  // presenting each slide. This is used to show a pacing timer in the
179
174
  // speaker view
180
175
  defaultTiming: #{attr 'revealjs_defaulttiming', 120},
176
+ // Specify the total time in seconds that is available to
177
+ // present. If this is set to a nonzero value, the pacing
178
+ // timer will work out the time available for each slide,
179
+ // instead of using the defaultTiming value
180
+ totalTime: #{attr 'revealjs_totaltime', 0},
181
+ // Specify the minimum amount of time you want to allot to
182
+ // each slide, if using the totalTime calculation method. If
183
+ // the automated time allocation causes slide pacing to fall
184
+ // below this threshold, then you will see an alert in the
185
+ // speaker notes window
186
+ minimumTimePerSlide: #{attr 'revealjs_minimumtimeperslide', 0},
181
187
  // Enable slide navigation via mouse wheel
182
188
  mouseWheel: #{to_boolean(attr 'revealjs_mousewheel', false)},
189
+ // Hide cursor if inactive
190
+ hideInactiveCursor: #{to_boolean(attr 'revealjs_hideinactivecursor', true)},
191
+ // Time before the cursor is hidden (in ms)
192
+ hideCursorTime: #{attr 'revealjs_hidecursortime', 5000},
183
193
  // Hides the address bar on mobile devices
184
194
  hideAddressBar: #{to_boolean(attr 'revealjs_hideaddressbar', true)},
185
195
  // Opens links in an iframe preview overlay
@@ -194,6 +204,10 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
194
204
  backgroundTransition: '#{attr 'revealjs_backgroundtransition', 'fade'}',
195
205
  // Number of slides away from the current that are visible
196
206
  viewDistance: #{attr 'revealjs_viewdistance', 3},
207
+ // Number of slides away from the current that are visible on mobile
208
+ // devices. It is advisable to set this to a lower number than
209
+ // viewDistance in order to save resources.
210
+ mobileViewDistance: #{attr 'revealjs_mobileviewdistance', 3},
197
211
  // Parallax background image (e.g., "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'")
198
212
  parallaxBackgroundImage: '#{attr 'revealjs_parallaxbackgroundimage', ''}',
199
213
  // Parallax background size in CSS syntax (e.g., "2100px 900px")
@@ -227,19 +241,16 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
227
241
 
228
242
  // Optional libraries used to extend on reveal.js
229
243
  dependencies: [
230
- { src: '#{revealjsdir}/lib/js/classList.js', condition: function() { return !document.body.classList; } },
231
- #{(document.attr? 'source-highlighter', 'highlightjs') ? "{ src: '#{revealjsdir}/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }," : nil}
232
- #{(attr? 'revealjs_plugin_zoom', 'disabled') ? "" : "{ src: '#{revealjsdir}/plugin/zoom-js/zoom.js', async: true }," }
233
- #{(attr? 'revealjs_plugin_notes', 'disabled') ? "" : "{ src: '#{revealjsdir}/plugin/notes/notes.js', async: true }," }
234
- #{(attr? 'revealjs_plugin_marked', 'enabled') ? "{ src: '#{revealjsdir}/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }," : "" }
235
- #{(attr? 'revealjs_plugin_markdown', 'enabled') ? "{ src: '#{revealjsdir}/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }," : "" }
236
- #{(attr? 'revealjs_plugin_pdf', 'enabled') ? "{ src: '#{revealjsdir}/plugin/print-pdf/print-pdf.js', async: true }," : "" }
237
- #{(attr? 'revealjs_plugins') ? File.read(attr('revealjs_plugins', '')) : ""}
244
+ #{revealjs_dependencies(document, self, revealjsdir)}
238
245
  ],
239
246
 
240
247
  #{(attr? 'revealjs_plugins_configuration') ? File.read(attr('revealjs_plugins_configuration', '')) : ""}
241
248
 
242
249
  });
250
+ / Workaround the "Only direct descendants of a slide section can be stretched" limitation in reveal.js
251
+ / https://github.com/hakimel/reveal.js/issues/2584
252
+ include stretch_nested_elements.js.slim
253
+
243
254
  - if syntax_hl && (syntax_hl.docinfo? :footer)
244
255
  =syntax_hl.docinfo :footer, self, cdn_base_url: cdn_base, linkcss: linkcss, self_closing_tag_slash: '/'
245
256
 
@@ -24,6 +24,23 @@ module Slim::Helpers
24
24
  val && val != 'false' && val.to_s != '0' || false
25
25
  end
26
26
 
27
+ # bool_data_attr
28
+ # If the AsciiDoc attribute doesn't exist, no HTML attribute is added
29
+ # If the AsciiDoc attribute exist and is a true value, HTML attribute is enabled (bool)
30
+ # If the AsciiDoc attribute exist and is a false value, HTML attribute is a false string
31
+ # Ex: a feature is enabled globally but can be disabled using a data- attribute on individual items
32
+ # :revealjs_previewlinks: True
33
+ # then link::example.com[Link text, preview=false]
34
+ # Here the template must have data-preview-link="false" not just no data-preview-link attribute
35
+ def bool_data_attr val
36
+ return false if !attr?(val)
37
+ if attr(val).downcase == 'false' || attr(val) == '0'
38
+ return 'false'
39
+ else
40
+ return true
41
+ end
42
+ end
43
+
27
44
  # false needs to be verbatim everything else is a string.
28
45
  # Calling side isn't responsible for quoting so we are doing it here
29
46
  def to_valid_slidenumber val
@@ -101,6 +118,20 @@ module Slim::Helpers
101
118
  end
102
119
  end
103
120
 
121
+ def revealjs_dependencies(document, node, revealjsdir)
122
+ dependencies = []
123
+ dependencies << "{ src: '#{revealjsdir}/plugin/zoom-js/zoom.js', async: true }" unless (node.attr? 'revealjs_plugin_zoom', 'disabled')
124
+ dependencies << "{ src: '#{revealjsdir}/plugin/notes/notes.js', async: true }" unless (node.attr? 'revealjs_plugin_notes', 'disabled')
125
+ dependencies << "{ src: '#{revealjsdir}/plugin/markdown/marked.js', async: true }" if (node.attr? 'revealjs_plugin_marked', 'enabled')
126
+ dependencies << "{ src: '#{revealjsdir}/plugin/markdown/markdown.js', async: true }" if (node.attr? 'revealjs_plugin_markdown', 'enabled')
127
+ if (node.attr? 'revealjs_plugins') &&
128
+ !(revealjs_plugins_file = (node.attr 'revealjs_plugins', '').strip).empty? &&
129
+ !(revealjs_plugins_content = (File.read revealjs_plugins_file).strip).empty?
130
+ dependencies << revealjs_plugins_content
131
+ end
132
+ dependencies.join(",\n ")
133
+ end
134
+
104
135
 
105
136
  # Between delimiters (--) is code taken from asciidoctor-bespoke 1.0.0.alpha.1
106
137
  # Licensed under MIT, Copyright (C) 2015-2016 Dan Allen and the Asciidoctor Project
@@ -113,8 +144,69 @@ module Slim::Helpers
113
144
  def resolve_content
114
145
  @content_model == :simple ? %(<p>#{content}</p>) : content
115
146
  end
116
- #--
117
147
 
148
+ # Capture nested template content and register it with the specified key, to
149
+ # be executed at a later time.
150
+ #
151
+ # This method must be invoked using the control code directive (i.e., -). By
152
+ # using a control code directive, the block is set up to append the result
153
+ # directly to the output buffer. (Integrations often hide the distinction
154
+ # between a control code directive and an output directive in this context).
155
+ #
156
+ # key - The Symbol under which to save the template block.
157
+ # opts - A Hash of options to control processing (default: {}):
158
+ # * :append - A Boolean that indicates whether to append this block
159
+ # to others registered with this key (default: false).
160
+ # * :content - String content to be used if template content is not
161
+ # provided (optional).
162
+ # block - The template content (in Slim template syntax).
163
+ #
164
+ # Examples
165
+ #
166
+ # - content_for :body
167
+ # p content
168
+ # - content_for :body, append: true
169
+ # p more content
170
+ #
171
+ # Returns nothing.
172
+ def content_for key, opts = {}, &block
173
+ @content = {} unless defined? @content
174
+ (opts[:append] ? (@content[key] ||= []) : (@content[key] = [])) << (block_given? ? block : lambda { opts[:content] })
175
+ nil
176
+ end
177
+
178
+ # Checks whether deferred template content has been registered for the specified key.
179
+ #
180
+ # key - The Symbol under which to look for saved template blocks.
181
+ #
182
+ # Returns a Boolean indicating whether content has been registered for this key.
183
+ def content_for? key
184
+ (defined? @content) && (@content.key? key)
185
+ end
186
+
187
+ # Evaluates the deferred template content registered with the specified key.
188
+ #
189
+ # When the corresponding content_for method is invoked using a control code
190
+ # directive, the block is set up to append the result to the output buffer
191
+ # directly.
192
+ #
193
+ # key - The Symbol under which to look for template blocks to yield.
194
+ # opts - A Hash of options to control processing (default: {}):
195
+ # * :drain - A Boolean indicating whether to drain the key of blocks
196
+ # after calling them (default: true).
197
+ #
198
+ # Examples
199
+ #
200
+ # - yield_content :body
201
+ #
202
+ # Returns nothing (assuming the content has been captured in the context of control code).
203
+ def yield_content key, opts = {}
204
+ if (defined? @content) && (blks = (opts.fetch :drain, true) ? (@content.delete key) : @content[key])
205
+ blks.map {|b| b.call }.join
206
+ end
207
+ nil
208
+ end
209
+ #--
118
210
  end
119
211
 
120
212
  # More custom functions can be added in another namespace if required
@@ -13,7 +13,7 @@
13
13
  .imageblock(id=@id class=roles
14
14
  style=[("text-align: #{attr :align}" if attr? :align),("float: #{attr :float}" if attr? :float)].compact.join('; '))
15
15
  - if attr? :link
16
- a.image href=(attr :link)
16
+ a.image href=(attr :link) target=(attr :window) data-preview-link=(bool_data_attr :link_preview)
17
17
  img src=image_uri(attr :target) alt=(attr :alt) width=(width) height=(height) style=((attr? :background) ? "background: #{attr :background}" : nil)
18
18
  - else
19
19
  img src=image_uri(attr :target) alt=(attr :alt) width=(width) height=(height) style=((attr? :background) ? "background: #{attr :background}" : nil)
@@ -8,4 +8,5 @@
8
8
  a id=@target
9
9
  |[#{@target}]
10
10
  - else
11
- a href=@target class=role target=(attr :window) =@text
11
+ a href=@target class=role target=(attr :window) data-preview-link=(bool_data_attr :preview)
12
+ =@text
@@ -5,20 +5,20 @@ span class=[@type,role] style=("float: #{attr :float}" if attr? :float)
5
5
  - style_class << "fa-rotate-#{attr :rotate}" if attr? :rotate
6
6
  - style_class << "fa-flip-#{attr :flip}" if attr? :flip
7
7
  - if attr? :link
8
- a.image href=(attr :link) target=(attr :window)
8
+ a.image href=(attr :link) target=(attr :window) data-preview-link=(bool_data_attr :link_preview)
9
9
  i class=style_class title=(attr :title)
10
10
  - else
11
11
  i class=style_class title=(attr :title)
12
12
  - elsif @type == 'icon' && !(@document.attr? :icons)
13
13
  - if attr? :link
14
- a.image href=(attr :link) target=(attr :window)
14
+ a.image href=(attr :link) target=(attr :window) data-preview-link=(bool_data_attr :link_preview)
15
15
  |[#{attr :alt}]
16
16
  - else
17
17
  |[#{attr :alt}]
18
18
  - else
19
19
  - src = (@type == 'icon' ? (icon_uri @target) : (image_uri @target))
20
20
  - if attr? :link
21
- a.image href=(attr :link) target=(attr :window)
21
+ a.image href=(attr :link) target=(attr :window) data-preview-link=(bool_data_attr :link_preview)
22
22
  img src=src alt=(attr :alt) width=(attr :width) height=(attr :height) title=(attr :title)
23
23
  - else
24
24
  img src=src alt=(attr :alt) width=(attr :width) height=(attr :height) title=(attr :title)
@@ -1,6 +1,6 @@
1
1
  - nowrap = (option? 'nowrap') || !(document.attr? 'prewrap')
2
- - syntax_hl = document.syntax_highlighter
3
2
  - if @style == 'source'
3
+ - syntax_hl = document.syntax_highlighter
4
4
  - lang = attr :language
5
5
  - if syntax_hl
6
6
  - doc_attrs = document.attributes
@@ -33,32 +33,42 @@
33
33
  - if attr? 'background-color'
34
34
  - data_background_color = attr 'background-color'
35
35
 
36
+ - parent_section_with_vertical_slides = @level == 1 && !vertical_slides.empty?
37
+
38
+ - content_for :section
39
+ section(id=(titleless ? nil : id)
40
+ class=roles
41
+ data-transition=(attr 'transition')
42
+ data-transition-speed=(attr 'transition-speed')
43
+ data-background-color=data_background_color
44
+ data-background-image=data_background_image
45
+ data-background-size=(data_background_size || attr('background-size'))
46
+ data-background-repeat=(data_background_repeat || attr('background-repeat'))
47
+ data-background-transition=(data_background_transition || attr('background-transition'))
48
+ data-background-position=(data_background_position || attr('background-position'))
49
+ data-background-iframe=(attr "background-iframe")
50
+ data-background-video=(attr "background-video")
51
+ data-background-video-loop=((attr? 'background-video-loop') || (option? 'loop'))
52
+ data-background-video-muted=((attr? 'background-video-muted') || (option? 'muted'))
53
+ data-background-opacity=(attr "background-opacity")
54
+ data-state=(attr 'state'))
55
+ - unless hide_title
56
+ h2=section_title
57
+ - if parent_section_with_vertical_slides
58
+ - unless (_blocks = blocks - vertical_slides).empty?
59
+ div.slide-content
60
+ - _blocks.each do |block|
61
+ =block.convert
62
+ - else
63
+ - unless (_content = content.chomp).empty?
64
+ div.slide-content
65
+ =_content
66
+
36
67
  / RENDERING
37
68
  / render parent section of vertical slides set
38
- - if @level == 1 && !vertical_slides.empty?
69
+ - if parent_section_with_vertical_slides
39
70
  section
40
- / TODO: try to get rid of duplication w/ standalone slide section
41
- section(id=(titleless ? nil : id)
42
- class=roles
43
- data-transition=(attr 'transition')
44
- data-transition-speed=(attr 'transition-speed')
45
- data-background-color=data_background_color
46
- data-background-image=data_background_image
47
- data-background-size=(data_background_size || attr('background-size'))
48
- data-background-repeat=(data_background_repeat || attr('background-repeat'))
49
- data-background-transition=(data_background_transition || attr('background-transition'))
50
- data-background-position=(data_background_position || attr('background-position'))
51
- data-background-iframe=(attr "background-iframe")
52
- data-background-video=(attr "background-video")
53
- data-background-video-loop=((attr? 'background-video-loop') || (option? 'loop'))
54
- data-background-video-muted=((attr? 'background-video-muted') || (option? 'muted'))
55
- data-background-opacity=(attr "background-opacity")
56
- data-state=(attr 'state'))
57
-
58
- - unless hide_title
59
- h2=title
60
- - (blocks - vertical_slides).each do |block|
61
- =block.convert
71
+ - yield_content :section
62
72
  - vertical_slides.each do |subsection|
63
73
  =subsection.convert
64
74
 
@@ -69,23 +79,4 @@
69
79
  h level=(@level) =title
70
80
  =content.chomp
71
81
  - else
72
- section(id=(titleless ? nil : id)
73
- class=roles
74
- data-transition=(attr 'transition')
75
- data-transition-speed=(attr 'transition-speed')
76
- data-background-color=data_background_color
77
- data-background-image=data_background_image
78
- data-background-size=(data_background_size || attr('background-size'))
79
- data-background-repeat=(data_background_repeat || attr('background-repeat'))
80
- data-background-transition=(data_background_transition || attr('background-transition'))
81
- data-background-position=(data_background_position || attr('background-position'))
82
- data-background-iframe=(attr "background-iframe")
83
- data-background-video=(attr "background-video")
84
- data-background-video-loop=((attr? 'background-video-loop') || (option? 'loop'))
85
- data-background-video-muted=((attr? 'background-video-muted') || (option? 'muted'))
86
- data-background-opacity=(attr "background-opacity")
87
- data-state=(attr 'state'))
88
-
89
- - unless hide_title
90
- h2=title
91
- =content.chomp
82
+ - yield_content :section