asciidoctor-revealjs 3.0.0 → 4.1.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.adoc +1 -1
  3. data/README.adoc +390 -63
  4. data/Rakefile +30 -7
  5. data/asciidoctor-revealjs.gemspec +6 -4
  6. data/bin/asciidoctor-revealjs +7 -0
  7. data/examples/a11y-dark.css +99 -0
  8. data/examples/autoslide.adoc +22 -0
  9. data/examples/custom-layout.adoc +10 -0
  10. data/examples/customcss.adoc +1 -1
  11. data/examples/data-attributes.adoc +245 -0
  12. data/examples/docinfo-footer-revealjs.html +10 -0
  13. data/examples/docinfo-revealjs.html +7 -0
  14. data/examples/font-awesome-specific-version.adoc +11 -0
  15. data/examples/font-awesome.adoc +23 -4
  16. data/examples/font-awesome.css +3 -0
  17. data/examples/footnotes.adoc +46 -0
  18. data/examples/fragments.adoc +44 -0
  19. data/examples/fragments.css +18 -0
  20. data/examples/grid-layout-3x2.adoc +50 -0
  21. data/examples/grid-layout-docinfo-revealjs.html +11 -0
  22. data/examples/grid-layout.adoc +194 -0
  23. data/examples/history-hash.adoc +19 -0
  24. data/examples/history-regression-tests.adoc +0 -5
  25. data/examples/history.adoc +4 -4
  26. data/examples/images/asciidoctor-logo.svg +102 -0
  27. data/examples/images/cute-cat-1.jpg +0 -0
  28. data/examples/images/cute-cat-2.jpg +0 -0
  29. data/examples/images/cute-cat-3.jpg +0 -0
  30. data/examples/images/flock-of-seagulls_daniel-simion.mp3 +0 -0
  31. data/examples/issue-grid-layout-images.adoc +25 -0
  32. data/examples/level-sectnums.adoc +24 -0
  33. data/examples/links-preview.adoc +32 -0
  34. data/examples/links.adoc +39 -0
  35. data/examples/mathjax-cdn.adoc +21 -0
  36. data/examples/mathjax.adoc +20 -0
  37. data/examples/release-4.0.adoc +192 -0
  38. data/examples/release-4.0.css +23 -0
  39. data/examples/release-4.1.adoc +133 -0
  40. data/examples/release-4.1.css +50 -0
  41. data/examples/revealjs-custom-theme.adoc +10 -0
  42. data/examples/source-coderay.adoc +15 -0
  43. data/examples/source-emphasis.adoc +128 -0
  44. data/examples/source-highlightjs-html.adoc +1 -1
  45. data/examples/source-highlightjs-languages.adoc +27 -0
  46. data/examples/source-highlightjs.adoc +85 -2
  47. data/examples/source-pygments.adoc +12 -0
  48. data/examples/source-rouge-docinfo.html +8 -0
  49. data/examples/source-rouge.adoc +18 -0
  50. data/examples/steps.adoc +87 -0
  51. data/examples/text-alignments.adoc +44 -0
  52. data/examples/video.adoc +30 -8
  53. data/examples/with-docinfo-shared.adoc +13 -0
  54. data/lib/asciidoctor-revealjs/converter.rb +1053 -769
  55. data/lib/asciidoctor-revealjs/highlightjs.rb +333 -2
  56. data/lib/asciidoctor-revealjs/version.rb +1 -1
  57. data/templates/admonition.html.slim +1 -1
  58. data/templates/asciidoctor-compatibility.css +390 -0
  59. data/templates/audio.html.slim +1 -1
  60. data/templates/colist.html.slim +1 -1
  61. data/templates/dlist.html.slim +3 -3
  62. data/templates/document.html.slim +76 -59
  63. data/templates/example.html.slim +1 -1
  64. data/templates/helpers.rb +170 -5
  65. data/templates/image.html.slim +3 -3
  66. data/templates/inline_anchor.html.slim +6 -4
  67. data/templates/inline_button.html.slim +2 -1
  68. data/templates/inline_footnote.html.slim +11 -4
  69. data/templates/inline_image.html.slim +5 -8
  70. data/templates/inline_kbd.html.slim +3 -2
  71. data/templates/inline_menu.html.slim +4 -3
  72. data/templates/inline_quoted.html.slim +13 -21
  73. data/templates/listing.html.slim +15 -10
  74. data/templates/literal.html.slim +1 -1
  75. data/templates/olist.html.slim +2 -2
  76. data/templates/open.html.slim +3 -3
  77. data/templates/paragraph.html.slim +1 -1
  78. data/templates/quote.html.slim +1 -1
  79. data/templates/section.html.slim +51 -43
  80. data/templates/sidebar.html.slim +1 -1
  81. data/templates/stem.html.slim +1 -1
  82. data/templates/stretch_nested_elements.js.slim +65 -0
  83. data/templates/table.html.slim +3 -2
  84. data/templates/title_slide.html.slim +28 -0
  85. data/templates/ulist.html.slim +3 -3
  86. data/templates/verse.html.slim +1 -1
  87. data/templates/video.html.slim +14 -8
  88. metadata +81 -18
  89. data/CHANGELOG.adoc +0 -425
  90. data/HACKING.adoc +0 -386
  91. data/examples/revealjs-features.adoc +0 -23
  92. data/templates/asciidoctor_revealjs.css.slim +0 -59
@@ -10,10 +10,10 @@
10
10
  - height = "100%"
11
11
 
12
12
  - unless attributes[1] == 'background' || attributes[1] == 'canvas'
13
- .imageblock(id=@id class=roles
14
- style=[("text-align: #{attr :align}" if attr? :align),("float: #{attr :float}" if attr? :float)].compact.join('; '))
13
+ - inline_style = [("text-align: #{attr :align}" if attr? :align),("float: #{attr :float}" if attr? :float)].compact.join('; ')
14
+ = html_tag('div', { :id => @id, :class => ['imageblock', role, ('fragment' if (option? :step) || (attr? 'step'))], :style => inline_style }.merge(data_attrs(@attributes)))
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)
@@ -1,11 +1,13 @@
1
1
  - case @type
2
2
  - when :xref
3
3
  - refid = (attr :refid) || @target
4
- a href=@target =(@text || @document.references[:ids].fetch(refid, "[#{refid}]")).tr_s("\n", ' ')
4
+ = html_tag('a', { :href => @target, :class => [role, ('fragment' if (option? :step) || (attr? 'step'))].compact }.merge(data_attrs(@attributes)))
5
+ =(@text || @document.references[:ids].fetch(refid, "[#{refid}]")).tr_s("\n", ' ')
5
6
  - when :ref
6
- a id=@target
7
+ = html_tag('a', { :id => @target }.merge(data_attrs(@attributes)))
7
8
  - when :bibref
8
- a id=@target
9
+ = html_tag('a', { :id => @target }.merge(data_attrs(@attributes)))
9
10
  |[#{@target}]
10
11
  - else
11
- a href=@target class=role target=(attr :window) =@text
12
+ = html_tag('a', { :href => @target, :class => [role, ('fragment' if (option? :step) || (attr? 'step'))].compact, :target => (attr :window), 'data-preview-link' => (bool_data_attr :preview) }.merge(data_attrs(@attributes)))
13
+ =@text
@@ -1 +1,2 @@
1
- b.button=@text
1
+ = html_tag('b', { :class => ['button'] }.merge(data_attrs(@attributes)))
2
+ = @text
@@ -1,6 +1,13 @@
1
+ - footnote = slide_footnote(self)
2
+ - index = footnote.attr(:index)
3
+ - id = footnote.id
1
4
  - if @type == :xref
2
- span.footnoteref
3
- | [<a class="footnote" href="#_footnote_#{attr :index}" title="View footnote.">#{attr :index}</a>]
5
+ = html_tag('sup', { :class => ['footnoteref'] }.merge(data_attrs(footnote.attributes)))
6
+ | [
7
+ span(class="footnote" title="View footnote.") = index
8
+ | ]
4
9
  - else
5
- span.footnote id=("_footnote_#{@id}" if @id)
6
- | [<a id="_footnoteref_#{attr :index}" class="footnote" href="#_footnote_#{attr :index}" title="View footnote.">#{attr :index}</a>]
10
+ = html_tag('sup', { :id => ("_footnote_#{id}" if id), :class => ['footnote'] }.merge(data_attrs(footnote.attributes)))
11
+ | [
12
+ span(class="footnote" title="View footnote.") = index
13
+ | ]
@@ -1,24 +1,21 @@
1
- span class=[@type,role] style=("float: #{attr :float}" if attr? :float)
1
+ = html_tag('span', { :class => [@type, role, ('fragment' if (option? :step) || (attr? 'step'))], :style => ("float: #{attr :float}" if attr? :float) }.merge(data_attrs(@attributes)))
2
2
  - if @type == 'icon' && (@document.attr? :icons, 'font')
3
- - style_class = ["fa fa-#{@target}"]
4
- - style_class << "fa-#{attr :size}" if attr? :size
5
- - style_class << "fa-rotate-#{attr :rotate}" if attr? :rotate
6
- - style_class << "fa-flip-#{attr :flip}" if attr? :flip
3
+ - style_class = [(attr :set, 'fa'), "fa-#{@target}", ("fa-#{attr :size}" if attr? :size), ("fa-rotate-#{attr :rotate}" if attr? :rotate), ("fa-flip-#{attr :flip}" if attr? :flip)]
7
4
  - if attr? :link
8
- a.image href=(attr :link) target=(attr :window)
5
+ a.image href=(attr :link) target=(attr :window) data-preview-link=(bool_data_attr :link_preview)
9
6
  i class=style_class title=(attr :title)
10
7
  - else
11
8
  i class=style_class title=(attr :title)
12
9
  - elsif @type == 'icon' && !(@document.attr? :icons)
13
10
  - if attr? :link
14
- a.image href=(attr :link) target=(attr :window)
11
+ a.image href=(attr :link) target=(attr :window) data-preview-link=(bool_data_attr :link_preview)
15
12
  |[#{attr :alt}]
16
13
  - else
17
14
  |[#{attr :alt}]
18
15
  - else
19
16
  - src = (@type == 'icon' ? (icon_uri @target) : (image_uri @target))
20
17
  - if attr? :link
21
- a.image href=(attr :link) target=(attr :window)
18
+ a.image href=(attr :link) target=(attr :window) data-preview-link=(bool_data_attr :link_preview)
22
19
  img src=src alt=(attr :alt) width=(attr :width) height=(attr :height) title=(attr :title)
23
20
  - else
24
21
  img src=src alt=(attr :alt) width=(attr :width) height=(attr :height) title=(attr :title)
@@ -1,7 +1,8 @@
1
1
  - if (keys = attr 'keys').size == 1
2
- kbd=keys.first
2
+ = html_tag('kbd', data_attrs(@attributes))
3
+ = keys.first
3
4
  - else
4
- span.keyseq
5
+ = html_tag('span', { :class => ['keyseq'] }.merge(data_attrs(@attributes)))
5
6
  - keys.each_with_index do |key, idx|
6
7
  - unless idx.zero?
7
8
  |+
@@ -1,15 +1,16 @@
1
1
  - menu = attr 'menu'
2
2
  - menuitem = attr 'menuitem'
3
3
  - if !(submenus = attr 'submenus').empty?
4
- span.menuseq
4
+ = html_tag('span', { :class => ['menuseq'] }.merge(data_attrs(@attributes)))
5
5
  span.menu=menu
6
6
  |&#160;&#9656;&#32;
7
7
  =submenus.map {|submenu| %(<span class="submenu">#{submenu}</span>&#160;&#9656;&#32;) }.join
8
8
  span.menuitem=menuitem
9
9
  - elsif !menuitem.nil?
10
- span.menuseq
10
+ = html_tag('span', { :class => ['menuseq'] }.merge(data_attrs(@attributes)))
11
11
  span.menu=menu
12
12
  |&#160;&#9656;&#32;
13
13
  span.menuitem=menuitem
14
14
  - else
15
- span.menu=menu
15
+ = html_tag('span', { :class => ['menu'] }.merge(data_attrs(@attributes)))
16
+ = menu
@@ -1,22 +1,14 @@
1
- - unless @id.nil?
2
- a id=@id
3
- - case @type
4
- - when :emphasis
5
- em class=role =@text
6
- - when :strong
7
- strong class=role =@text
8
- - when :monospaced
9
- code class=role =@text
10
- - when :superscript
11
- sup class=role =@text
12
- - when :subscript
13
- sub class=role =@text
14
- - when :double
15
- =role? ? %(<span class="#{role}">&#8220;#{@text}&#8221;</span>) : %(&#8220;#{@text}&#8221;)
16
- - when :single
17
- =role? ? %(<span class="#{role}">&#8216;#{@text}&#8217;</span>) : %(&#8216;#{@text}&#8217;)
18
- - when :asciimath, :latexmath
19
- - open, close = Asciidoctor::INLINE_MATH_DELIMITERS[@type]
20
- |#{open}#{@text}#{close}
1
+ - quote_tags = { emphasis: 'em', strong: 'strong', monospaced: 'code', superscript: 'sup', subscript: 'sup' }
2
+ - if (quote_tag = quote_tags[@type])
3
+ = html_tag(quote_tag, { :id => @id, :class => [role, ('fragment' if (option? :step) || (attr? 'step'))].compact }.merge(data_attrs(@attributes)), @text)
21
4
  - else
22
- =role? ? %(<span class="#{role}">#{@text}</span>) : @text
5
+ - case @type
6
+ - when :double
7
+ - inline_text_container("&#8220;#{@text}&#8221;")
8
+ - when :single
9
+ = inline_text_container("&#8216;#{@text}&#8217;")
10
+ - when :asciimath, :latexmath
11
+ - open, close = Asciidoctor::INLINE_MATH_DELIMITERS[@type]
12
+ = inline_text_container("#{open}#{@text}#{close}")
13
+ - else
14
+ = inline_text_container(@text)
@@ -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
@@ -8,12 +8,17 @@
8
8
  - style = doc_attrs[%(#{syntax_hl.name}-style)]
9
9
  - opts = syntax_hl.highlight? ? { css_mode: css_mode, style: style } : {}
10
10
  - opts[:nowrap] = nowrap
11
- - else
12
- - pre_open = %(<pre class="highlight#{nowrap ? ' nowrap' : ''}"><code#{lang ? %[ class="language-#{lang}" data-lang="#{lang}"] : ''}>)
13
- - pre_close = '</code></pre>'
14
- - else
15
- - pre_open = %(<pre#{nowrap ? ' class="nowrap"' : ''}>)
16
- - pre_close = '</pre>'
17
- - id_attribute = id ? %( id="#{id}") : ''
18
- - title_element = title? ? %(<div class="title">#{captioned_title}</div>\n) : ''
19
- =%(<div#{id_attribute} class="listingblock#{(role = self.role) ? " #{role}" : ''}">#{title_element}<div class="content">#{syntax_hl ? (syntax_hl.format self, lang, opts) : pre_open + (content || '') + pre_close}</div></div>)
11
+ = html_tag('div', { :id => id, :class => ['listingblock', role, ('fragment' if (option? :step) || (attr? 'step'))] }.merge(data_attrs(@attributes)))
12
+ - if title?
13
+ div.title= captioned_title
14
+ div.content
15
+ - if syntax_hl
16
+ = (syntax_hl.format self, lang, opts)
17
+ - else
18
+ - if @style == 'source'
19
+ pre class = ['highlight', ('nowrap' if nowrap)]
20
+ code class = [("language-#{lang}" if lang)] data-lang = ("#{lang}" if lang)
21
+ = content || ''
22
+ - else
23
+ pre class = [('nowrap' if nowrap)]
24
+ = content || ''
@@ -1,4 +1,4 @@
1
- .literalblock id=@id class=role
1
+ = html_tag('div', { :id => id, :class => ['literalblock', role, ('fragment' if (option? :step) || (attr? 'step'))] }.merge(data_attrs(@attributes)))
2
2
  - if title?
3
3
  .title=title
4
4
  .content: pre class=(!(@document.attr? :prewrap) || (option? 'nowrap') ? 'nowrap' : nil) =content
@@ -1,9 +1,9 @@
1
- .olist id=@id class=[@style,role]
1
+ = html_tag('div', { :id => @id, :class => ['olist', @style, role] }.merge(data_attrs(@attributes)))
2
2
  - if title?
3
3
  .title=title
4
4
  ol class=@style start=(attr :start) type=list_marker_keyword
5
5
  - items.each do |item|
6
- li class=('fragment' if (option? :step) or (has_role? 'step'))
6
+ li class=('fragment' if (option? :step) || (has_role? 'step') || (attr? 'step'))
7
7
  p=item.text
8
8
  - if item.blocks?
9
9
  =item.content
@@ -2,17 +2,17 @@
2
2
  - if @parent == @document && @document.doctype == 'book'
3
3
  - puts 'asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. Excluding block content.'
4
4
  - else
5
- .quoteblock.abstract id=@id class=role
5
+ = html_tag('div', { :id => @id, :class => ['quoteblock', 'abstract', role, ('fragment' if (option? :step) || (attr? 'step'))] }.merge(data_attrs(@attributes)))
6
6
  - if title?
7
7
  .title=title
8
8
  blockquote=content
9
9
  - elsif @style == 'partintro' && (@level != 0 || @parent.context != :section || @document.doctype != 'book')
10
- - puts 'asciidoctor: ERROR: partintro block can only be used when doctype is book and it\'s a child of a book part. Excluding block content.'
10
+ - puts 'asciidoctor: ERROR: partintro block can only be used when doctype is book and it\'s a child of a book part. Excluding block content.'
11
11
  - else
12
12
  - if (has_role? 'aside') or (has_role? 'speaker') or (has_role? 'notes')
13
13
  include notes.html.slim
14
14
  - else
15
- .openblock id=@id class=[(@style != 'open' ? @style : nil),role]
15
+ = html_tag('div', { :id => @id, :class => ['openblock', (@style != 'open' ? @style : nil), role, ('fragment' if (option? :step) || (attr? 'step'))] }.merge(data_attrs(@attributes)))
16
16
  - if title?
17
17
  .title=title
18
18
  .content=content
@@ -1,4 +1,4 @@
1
- .paragraph id=@id class=role
1
+ = html_tag('div', { :id => @id, :class => ['paragraph', role, ('fragment' if (option? :step) || (attr? 'step'))] }.merge(data_attrs(@attributes)))
2
2
  - if title?
3
3
  .title=title
4
4
  - if has_role? 'small'
@@ -1,4 +1,4 @@
1
- .quoteblock id=@id class=role
1
+ = html_tag('div', { :id => @id, :class => ['quoteblock', role, ('fragment' if (option? :step) || (attr? 'step'))] }.merge(data_attrs(@attributes)))
2
2
  - if title?
3
3
  .title=title
4
4
  blockquote=content
@@ -30,35 +30,62 @@
30
30
  - if attr? 'background-image'
31
31
  - data_background_image = image_uri(attr 'background-image')
32
32
 
33
+ - if attr? 'background-video'
34
+ - data_background_video = media_uri(attr 'background-video')
35
+
33
36
  - if attr? 'background-color'
34
37
  - data_background_color = attr 'background-color'
35
38
 
39
+ - parent_section_with_vertical_slides = @level == 1 && !vertical_slides.empty?
40
+
41
+ - content_for :footnotes
42
+ - slide_footnotes = slide_footnotes(self)
43
+ - if document.footnotes? && !(parent.attr? 'nofootnotes') && !slide_footnotes.empty?
44
+ .footnotes
45
+ - slide_footnotes.each do |footnote|
46
+ .footnote
47
+ = "#{footnote.index}. #{footnote.text}"
48
+
49
+ - content_for :section
50
+ section(id=(titleless ? nil : id)
51
+ class=roles
52
+ data-transition=(attr 'transition')
53
+ data-transition-speed=(attr 'transition-speed')
54
+ data-background-color=data_background_color
55
+ data-background-image=data_background_image
56
+ data-background-size=(data_background_size || attr('background-size'))
57
+ data-background-repeat=(data_background_repeat || attr('background-repeat'))
58
+ data-background-transition=(data_background_transition || attr('background-transition'))
59
+ data-background-position=(data_background_position || attr('background-position'))
60
+ data-background-iframe=(attr "background-iframe")
61
+ data-background-video=data_background_video
62
+ data-background-video-loop=((attr? 'background-video-loop') || (option? 'loop'))
63
+ data-background-video-muted=((attr? 'background-video-muted') || (option? 'muted'))
64
+ data-background-opacity=(attr "background-opacity")
65
+ data-autoslide=(attr "autoslide")
66
+ data-state=(attr 'state'))
67
+ - unless hide_title
68
+ h2=section_title
69
+ - if parent_section_with_vertical_slides
70
+ - unless (_blocks = blocks - vertical_slides).empty?
71
+ div.slide-content
72
+ - _blocks.each do |block|
73
+ =block.convert
74
+ - yield_content :footnotes
75
+
76
+ - else
77
+ - unless (_content = content.chomp).empty?
78
+ div.slide-content
79
+ =_content
80
+ - yield_content :footnotes
81
+
82
+ - clear_slide_footnotes
83
+
36
84
  / RENDERING
37
85
  / render parent section of vertical slides set
38
- - if @level == 1 && !vertical_slides.empty?
86
+ - if parent_section_with_vertical_slides
39
87
  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
88
+ - yield_content :section
62
89
  - vertical_slides.each do |subsection|
63
90
  =subsection.convert
64
91
 
@@ -69,23 +96,4 @@
69
96
  h level=(@level) =title
70
97
  =content.chomp
71
98
  - 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
99
+ - yield_content :section
@@ -1,7 +1,7 @@
1
1
  - if (has_role? 'aside') or (has_role? 'speaker') or (has_role? 'notes')
2
2
  include notes.html.slim
3
3
  - else
4
- .sidebarblock id=@id class=role
4
+ = html_tag('div', { :id => @id, :class => ['sidebarblock', role, ('fragment' if (option? :step) || (has_role? 'step') || (attr? 'step'))] }.merge(data_attrs(@attributes)))
5
5
  .content
6
6
  - if title?
7
7
  .title=title
@@ -4,7 +4,7 @@
4
4
  - equation = sub_specialcharacters equation
5
5
  - unless (equation.start_with? open) && (equation.end_with? close)
6
6
  - equation = %(#{open}#{equation}#{close})
7
- .stemblock id=@id class=role
7
+ = html_tag('div', { :id => @id, :class => ['stemblock', role, ('fragment' if (option? :step) || (has_role? 'step') || (attr? 'step'))] }.merge(data_attrs(@attributes)))
8
8
  - if title?
9
9
  .title=title
10
10
  .content=equation
@@ -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
+ });
@@ -1,5 +1,6 @@
1
- table(id=@id class=['tableblock',"frame-#{attr :frame, 'all'}","grid-#{attr :grid, 'all'}",role]
2
- style=[("width:#{attr :tablepcwidth}%" unless option? 'autowidth'),("float:#{attr :float}" if attr? :float)].compact.join('; '))
1
+ - classes = ['tableblock', "frame-#{attr :frame, 'all'}", "grid-#{attr :grid, 'all'}", role, ('fragment' if (option? :step) || (attr? 'step'))]
2
+ - styles = [("width:#{attr :tablepcwidth}%" unless option? 'autowidth'), ("float:#{attr :float}" if attr? :float)].compact.join('; ')
3
+ = html_tag('table', { :id => @id, :class => classes, :style => styles }.merge(data_attrs(@attributes)))
3
4
  - if title?
4
5
  caption.title=captioned_title
5
6
  - unless (attr :rowcount).zero?