asciidoctor-revealjs 1.0.0

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.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.adoc +46 -0
  3. data/HACKING.adoc +250 -0
  4. data/LICENSE.adoc +22 -0
  5. data/README.adoc +671 -0
  6. data/asciidoctor-revealjs.gemspec +32 -0
  7. data/bin/asciidoctor-revealjs +20 -0
  8. data/lib/asciidoctor-revealjs.rb +2 -0
  9. data/lib/asciidoctor-revealjs/converter.rb +36 -0
  10. data/lib/asciidoctor-revealjs/version.rb +5 -0
  11. data/templates/jade/admonition.jade +17 -0
  12. data/templates/jade/audio.jade +6 -0
  13. data/templates/jade/colist.jade +22 -0
  14. data/templates/jade/dlist.jade +60 -0
  15. data/templates/jade/document.jade +103 -0
  16. data/templates/jade/embedded.jade +11 -0
  17. data/templates/jade/example.jade +4 -0
  18. data/templates/jade/floating_title.jade +2 -0
  19. data/templates/jade/image.jade +12 -0
  20. data/templates/jade/inline_anchor.jade +9 -0
  21. data/templates/jade/inline_break.jade +2 -0
  22. data/templates/jade/inline_button.jade +1 -0
  23. data/templates/jade/inline_callout.jade +9 -0
  24. data/templates/jade/inline_image.jade +24 -0
  25. data/templates/jade/inline_indexterm.jade +2 -0
  26. data/templates/jade/inline_kbd.jade +9 -0
  27. data/templates/jade/inline_quoted.jade +26 -0
  28. data/templates/jade/listing.jade +29 -0
  29. data/templates/jade/literal.jade +5 -0
  30. data/templates/jade/olist.jade +9 -0
  31. data/templates/jade/page_break.jade +1 -0
  32. data/templates/jade/paragraph.jade +7 -0
  33. data/templates/jade/pass.jade +1 -0
  34. data/templates/jade/quote.jade +11 -0
  35. data/templates/jade/ruler.jade +1 -0
  36. data/templates/jade/section.jade +15 -0
  37. data/templates/jade/sidebar.jade +5 -0
  38. data/templates/jade/table.jade +45 -0
  39. data/templates/jade/thematic_break.jade +1 -0
  40. data/templates/jade/ulist.jade +25 -0
  41. data/templates/jade/verse.jade +14 -0
  42. data/templates/jade/video.jade +30 -0
  43. data/templates/slim/block_admonition.html.slim +18 -0
  44. data/templates/slim/block_audio.html.slim +6 -0
  45. data/templates/slim/block_colist.html.slim +20 -0
  46. data/templates/slim/block_dlist.html.slim +53 -0
  47. data/templates/slim/block_example.html.slim +4 -0
  48. data/templates/slim/block_floating_title.html.slim +1 -0
  49. data/templates/slim/block_image.html.slim +21 -0
  50. data/templates/slim/block_listing.html.slim +33 -0
  51. data/templates/slim/block_literal.html.slim +4 -0
  52. data/templates/slim/block_olist.html.slim +9 -0
  53. data/templates/slim/block_open.html.slim +15 -0
  54. data/templates/slim/block_page_break.html.slim +1 -0
  55. data/templates/slim/block_paragraph.html.slim +7 -0
  56. data/templates/slim/block_pass.html.slim +1 -0
  57. data/templates/slim/block_preamble.html.slim +2 -0
  58. data/templates/slim/block_quote.html.slim +14 -0
  59. data/templates/slim/block_ruler.html.slim +1 -0
  60. data/templates/slim/block_sidebar.html.slim +5 -0
  61. data/templates/slim/block_stem.html.slim +10 -0
  62. data/templates/slim/block_table.html.slim +45 -0
  63. data/templates/slim/block_thematic_break.html.slim +1 -0
  64. data/templates/slim/block_toc.html.slim +12 -0
  65. data/templates/slim/block_ulist.html.slim +25 -0
  66. data/templates/slim/block_verse.html.slim +14 -0
  67. data/templates/slim/block_video.html.slim +40 -0
  68. data/templates/slim/document.html.slim +184 -0
  69. data/templates/slim/embedded.html.slim +9 -0
  70. data/templates/slim/helpers.rb +34 -0
  71. data/templates/slim/inline_anchor.html.slim +11 -0
  72. data/templates/slim/inline_break.html.slim +2 -0
  73. data/templates/slim/inline_button.html.slim +1 -0
  74. data/templates/slim/inline_callout.html.slim +7 -0
  75. data/templates/slim/inline_footnote.html.slim +6 -0
  76. data/templates/slim/inline_image.html.slim +24 -0
  77. data/templates/slim/inline_indexterm.html.slim +2 -0
  78. data/templates/slim/inline_kbd.html.slim +8 -0
  79. data/templates/slim/inline_menu.html.slim +15 -0
  80. data/templates/slim/inline_quoted.html.slim +22 -0
  81. data/templates/slim/section.html.slim +89 -0
  82. data/templates/slim/section.html.slim.orig +97 -0
  83. metadata +186 -0
@@ -0,0 +1,29 @@
1
+ div.listingblock(id=node.$id(),class=node.$role())
2
+ if node.$title() != false
3
+ div.title !{node.$captioned_title()}
4
+ div.content
5
+ - var nowrap = !(node.document.$attr("prewrap",false)) || node['$option?']('nowrap')
6
+ if node.$style() == "source" || (node.$style() == 'listing' && node.$attr(1, 'listing'))
7
+ - language = node.$attr('language',false)
8
+ - var code_class = language ? [language, "language-#{language}"] : ""
9
+ - var pre_class = ['highlight']
10
+ - var pre_lang = ""
11
+ case node.$attr("source-highlighter")
12
+ when "coderay"
13
+ - pre_class = ['CodeRay']
14
+ when 'pygments'
15
+ - pre_class = ['pygments','highlight']
16
+ when 'prettify'
17
+ - pre_class = ['prettyprint']
18
+ - pre_class.push(node.$attr("linenums",''));
19
+ - pre_class.push(language ? language : '');
20
+ - pre_class.push(language ? "language-#{language}" : '');
21
+ when 'html-pipeline'
22
+ - pre_lang = language
23
+ - pre_class = code_class = ''
24
+ - nowrap = false
25
+ - pre_class.push(nowrap ? nowrap : '')
26
+ pre(class=pre_class,lang=pre_lang)
27
+ code(class=[code_class]) !{node.$content()}
28
+ else
29
+ pre(class=nowrap ? "nowrap" : "") !{node.$content()}
@@ -0,0 +1,5 @@
1
+ div.literalblock(id=node.$id(),class=node.$role())
2
+ if node.$title() != false
3
+ div.title !{node.$title()}
4
+ div.content
5
+ | !{node.$content()}
@@ -0,0 +1,9 @@
1
+ div.olist(id=node.$id(),class=[node.$style(), node.$role()])
2
+ if node['$title?']()
3
+ div.title !{node.$title()}
4
+ ol(class=node.$style(),start=node.$attr('start', ""),type=node.$list_marker_keyword())
5
+ each item in node.$items()
6
+ li(class=[(node['$option?']('step') || node['$has_role?']('step')) ? "fragment" : ""])
7
+ p !{item.$text()}
8
+ if item['$blocks?']()
9
+ | !{item.$content()}
@@ -0,0 +1 @@
1
+ div(style="page-break-after: always;")
@@ -0,0 +1,7 @@
1
+ div.paragraph(id=node.$id(),class=node.$role())
2
+ if node.$title() != false
3
+ div(class="title") !{node.$title()}
4
+ if node['$has_role?']('small')
5
+ small !{node.$content()}
6
+ else
7
+ p !{node.$content()}
@@ -0,0 +1 @@
1
+ div !{node.$content()}
@@ -0,0 +1,11 @@
1
+ div.quoteblock(id=node.$id(),class=node.$role())
2
+ if node['$title?']()
3
+ div.title !{node.$title()}
4
+ blockquote !{node.$content()}
5
+ if node.$attr("attribution", false) || node.$attr("citetitle", false)
6
+ div.attribution
7
+ if node.$attr("citetitle", false)
8
+ cite !{node.$attr("citetitle")}
9
+ if node.$attr("attribution", false) && node.$attr("citetitle", false)
10
+ br
11
+ | — !{node.$attr("attribution", "")}
@@ -0,0 +1 @@
1
+ hr
@@ -0,0 +1,15 @@
1
+ - hide_title = false
2
+ if node.$level() == 1
3
+ section
4
+ section(id=node.$id(),data-transition=node.$attr("data-transition", ""),data-transition-speed=node.$attr("data-transition-speed", ""),data-background=node.$attr("data-background", ""),data-background-size=node.$attr("data-background-size", ""),data-background-repeat=node.$attr("data-background-repeat", ""),data-background-transition=node.$attr("data-background-transition", ""))
5
+ if !hide_title
6
+ h2 !{node.$title()}
7
+ each block in (node.$blocks()['$-'](node.$sections()))
8
+ | !{block["$convert"]()}
9
+ each subsection in node.$sections()
10
+ | !{subsection["$convert"]()}
11
+ else
12
+ section(id=node.$id(),data-transition=(node.$attr('data-transition', "")),data-transition-speed=(node.$attr('data-transition-speed', "")),data-background=(node.$attr('data-background', "")),data-background-size=(node.$attr('data-background-size', "")),data-background-repeat=(node.$attr('data-background-repeat', "")),data-background-transition=(node.$attr('data-background-transition', "")))
13
+ if !hide_title
14
+ h2 !{node.$title()}
15
+ | !{node.$content()}
@@ -0,0 +1,5 @@
1
+ .sidebarblock(id=node.$id(),class=node.$role())
2
+ .content
3
+ if node.$title() != false
4
+ .title !{node.$title()}
5
+ | !{node.$content()}
@@ -0,0 +1,45 @@
1
+ table(id=node.$id(),class=["table-block", "frame-#{ node.$attr('frame', 'all') }", "frame-#{ node.$attr('grid', 'all') }", node.$role()])
2
+ if node['$title?']()
3
+ caption.title !{node.$captioned_title()}
4
+ if node.$attr("rowcount") != 0
5
+ colgroup
6
+ if node['$option?']('autowidth')
7
+ each ccc in node.$columns()
8
+ col
9
+ else
10
+ each col in node.$columns()
11
+ col(style={width: col.$attr("colpcwidth")})
12
+ - tblsecs =["$head","$foot","$body"]
13
+ each tblsec in tblsecs
14
+ if node.$rows()[tblsec]().length != 0
15
+ - var tag = "t" + tblsec.substr(1);
16
+ #{tag}
17
+ each row in node.$rows()[tblsec]()
18
+ tr
19
+ each cell in row
20
+ if tblsec == "$head"
21
+ - cell_content = cell.$text()
22
+ else
23
+ if cell.$style() == "verse" || cell.$style() == "literal"
24
+ - cell_content = cell.$text()
25
+ else
26
+ - cell_content = cell.$content()
27
+ #{tblsec == "$head" ? "th" : "td"}(class=['tableblock', "halign-#{cell.$attr('halign')}", "valign-#{cell.$attr('valign')}"],
28
+ colspan=cell.$colspan(), rowspan=cell.$rowspan(),style=node.document.$attr("cellbgcolor", false) ? "background-color:#{node.document.$attr('cellbgcolor')}" : "")
29
+ if tblsec == "$head"
30
+ | !{cell_content}
31
+ else
32
+ case cell.$style()
33
+ when "asciidoc"
34
+ div !{cell_content}
35
+ when "verse"
36
+ div.verse !{cell_content}
37
+ when "literal"
38
+ div.literal
39
+ pre !{cell_content}
40
+ when "header"
41
+ each text in cell_content
42
+ p.tableblock.header !{text}
43
+ default
44
+ each text in cell_content
45
+ p.tableblock !{text}
@@ -0,0 +1,25 @@
1
+ - checklist = node['$option?']('checklist') ? "checklist": null;
2
+ if checklist
3
+ if node['$option?']('interactive')
4
+ - marker_checked = '<input type="checkbox" data-item-complete="1" checked>'
5
+ - marker_unchecked = '<input type="checkbox" data-item-complete="0">'
6
+ else
7
+ if node.document.$attr("icons") == "font"
8
+ - marker_checked = '<i class="icon-check"></i>'
9
+ - marker_unchecked = '<i class="icon-check-empty"></i>'
10
+ else
11
+ - marker_checked = '<input type="checkbox" data-item-complete="1" checked disabled>'
12
+ - marker_unchecked = '<input type="checkbox" data-item-complete="0" disabled>'
13
+ div.ulist(id=id,class=[checklist, node.$style(), node.$role()])
14
+ if node['$title?']()
15
+ div.title !{node.$title()}
16
+ ul(class=[checklist || node.$style()])
17
+ each item in node.$items()
18
+ li(class=[(node['$option?']('step') || node['$has_role?']('step')) ? "fragment" : ""])
19
+ p
20
+ if checklist && item.$attr('checkbox', false)
21
+ | !{item.$attr('checked') ? marker_checked : marker_unchecked}!{item.$text()}
22
+ else
23
+ | !{item.$text()}
24
+ if item['$blocks?']()
25
+ | !{item.$content()}
@@ -0,0 +1,14 @@
1
+ div.verseblock(id=node.$id(),class=node.$role())
2
+ if node['$title()']
3
+ div.title !{node.$title()}
4
+ pre.content !{node.$content()}
5
+ - attribution = node.$attr('attribution',null)
6
+ - citetitle = node.$attr('citetitle',null)
7
+ if attribution || citetitle
8
+ div.attribution
9
+ if citetitle
10
+ cite !{citetitle}
11
+ if attribution
12
+ if citetitle
13
+ br
14
+ | &#8212; #{attribution}
@@ -0,0 +1,30 @@
1
+ div.videoblock(id=node.$id(),class=[node.$style(), node.$role()])
2
+ if node['$title?']()
3
+ .title node.$captioned_title()
4
+ .content
5
+ case node.$attr('poster')
6
+ when "vimeo"
7
+ - start_anchor = node['$attr?']('start') ? "#at=" + node.$attr("start") : ''
8
+ - delimeter = "?"
9
+ - autoplay_param = node['$option?']('autoplay') ? delimeter + "autoplay=1" : ''
10
+ - delimeter = node['$option?']('autoplay') ? '&' : ''
11
+ - loop_param = node['$option?']('loop') ? delimeter + "loop=1" : ''
12
+ - src = "//player.vimeo.com/video/" + node.$attr('target') + start_anchor + autoplay_param + loop_param
13
+ iframe(width=node.$attr('width'),height=node.$attr('height'),src=src,frameborder=0,webkitAllowFullScreen=true,mozallowfullscreen=true,allowFullScreen=true)
14
+ when "youtube"
15
+ - amp = '&'
16
+ - params = ['rel=0']
17
+ - params.push(node.$attr('start', false) ? (amp + "start=" + node.$attr('start')) : "")
18
+ - params.push(node.$attr('end', false) ? (amp + "end=" + node.$attr('end')) : "")
19
+ - params.push(node['$option?']('autoplay') ? amp + "autoplay=1" : "")
20
+ - params.push(node['$option?']('loop') ? (amp + "loop=1") : "")
21
+ - params.push(node['$option?']('nocontrols') ? (amp + "controls=0") : "")
22
+ - src = "//www.youtube.com/embed/" + node.$attr('target') + "/?" + params.join('')
23
+ iframe(width=node.$attr('width'),height=node.$attr('height'),src=src,frameborder=0,allowfullscreen=!node['$option?']('nofullscreen'))
24
+ default
25
+ video(src=node.$media_uri(node.$attr('target')),width=node.$attr('width'),height=node.$attr('height'),
26
+ poster=node.$attr('poster', false) ? node.$media_uri(node.$attr('poster')) : '',
27
+ autoplay=node['$option?']('autoplay'),controls=!node['$option?']('nocontrols'),
28
+ loop=node['$option?']('loop'))
29
+ | Your browser does not support the video tag.
30
+
@@ -0,0 +1,18 @@
1
+ - if (has_role? 'aside') or (has_role? 'speaker')
2
+ aside.notes
3
+ =content
4
+ - else
5
+ .admonitionblock id=@id class=[(attr :name),role]
6
+ table: tr
7
+ td.icon
8
+ - if @document.attr? :icons, 'font'
9
+ - icon_mapping = Hash['caution', 'fire', 'important', 'exclamation-circle', 'note', 'info-circle', 'tip', 'lightbulb-o', 'warning', 'warning']
10
+ i class=%(fa fa-#{icon_mapping[attr :name]}) title=@caption
11
+ - elsif @document.attr? :icons
12
+ img src=icon_uri(attr :name) alt=@caption
13
+ - else
14
+ .title=@caption
15
+ td.content
16
+ - if title?
17
+ .title=title
18
+ =content
@@ -0,0 +1,6 @@
1
+ .audioblock id=@id class=[@style,role]
2
+ - if title?
3
+ .title=captioned_title
4
+ .content
5
+ audio src=media_uri(attr :target) autoplay=(option? 'autoplay') controls=!(option? 'nocontrols') loop=(option? 'loop')
6
+ |Your browser does not support the audio tag.
@@ -0,0 +1,20 @@
1
+ .colist id=@id class=[@style,role]
2
+ - if title?
3
+ .title=title
4
+ - if @document.attr? :icons
5
+ - font_icons = @document.attr? :icons, 'font'
6
+ table
7
+ - items.each_with_index do |item, i|
8
+ - num = i + 1
9
+ tr
10
+ td
11
+ - if font_icons
12
+ i.conum data-value=num
13
+ b=num
14
+ - else
15
+ img src=icon_uri("callouts/#{num}") alt=num
16
+ td=item.text
17
+ - else
18
+ ol
19
+ - items.each do |item|
20
+ li: p=item.text
@@ -0,0 +1,53 @@
1
+ - case @style
2
+ - when 'qanda'
3
+ .qlist id=@id class=['qanda',role]
4
+ - if title?
5
+ .title=title
6
+ ol
7
+ - items.each do |questions, answer|
8
+ li
9
+ - [*questions].each do |question|
10
+ p: em=question.text
11
+ - unless answer.nil?
12
+ - if answer.text?
13
+ p=answer.text
14
+ - if answer.blocks?
15
+ =answer.content
16
+ - when 'horizontal'
17
+ .hdlist id=@id class=role
18
+ - if title?
19
+ .title=title
20
+ table
21
+ - if (attr? :labelwidth) || (attr? :itemwidth)
22
+ colgroup
23
+ col style=((attr? :labelwidth) ? %(width:#{(attr :labelwidth).chomp '%'}%;) : nil)
24
+ col style=((attr? :itemwidth) ? %(width:#{(attr :itemwidth).chomp '%'}%;) : nil)
25
+ - items.each do |terms, dd|
26
+ tr
27
+ td class=['hdlist1',('strong' if option? 'strong')]
28
+ - terms = [*terms]
29
+ - last_term = terms.last
30
+ - terms.each do |dt|
31
+ =dt.text
32
+ - if dt != last_term
33
+ br
34
+ td.hdlist2
35
+ - unless dd.nil?
36
+ - if dd.text?
37
+ p=dd.text
38
+ - if dd.blocks?
39
+ =dd.content
40
+ - else
41
+ .dlist id=@id class=[@style,role]
42
+ - if title?
43
+ .title=title
44
+ dl
45
+ - items.each do |terms, dd|
46
+ - [*terms].each do |dt|
47
+ dt class=('hdlist1' unless @style) =dt.text
48
+ - unless dd.nil?
49
+ dd
50
+ - if dd.text?
51
+ p=dd.text
52
+ - if dd.blocks?
53
+ =dd.content
@@ -0,0 +1,4 @@
1
+ .exampleblock id=@id class=role
2
+ - if title?
3
+ .title=captioned_title
4
+ .content=content
@@ -0,0 +1 @@
1
+ *{:tag=>"h#{@level + 1}", :id=>@id, :class=>[@style,role].compact} =title
@@ -0,0 +1,21 @@
1
+ - width = (attr? :width) ? (attr :width) : nil
2
+ - height = (attr? :height) ? (attr :height) : nil
3
+
4
+ / When the stretch class is present, block images will take the most space
5
+ / they can take. Setting width and height can override that.
6
+ / We pinned the 100% to height to avoid aspect ratio breakage and since
7
+ / widescreen monitors are the most popular, chances are that height will
8
+ / be the biggest constraint
9
+ - if (has_role? 'stretch') && !((attr? :width) || (attr? :height))
10
+ - height = "100%"
11
+
12
+ - unless attr(1) == 'background' || attr(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('; '))
15
+ - if attr? :link
16
+ a.image href=(attr :link)
17
+ img src=image_uri(attr :target) alt=(attr :alt) width=(width) height=(height) style=((attr? :background) ? "background: #{attr :background}" : nil)
18
+ - else
19
+ img src=image_uri(attr :target) alt=(attr :alt) width=(width) height=(height) style=((attr? :background) ? "background: #{attr :background}" : nil)
20
+ - if title?
21
+ .title=captioned_title
@@ -0,0 +1,33 @@
1
+ .listingblock id=@id class=role
2
+ - if title?
3
+ .title=captioned_title
4
+ .content
5
+ - nowrap = !(@document.attr? :prewrap) || (option? 'nowrap')
6
+ / implicit listing blocks and source blocks are rendered as code
7
+ / explicit listing blocks stay listing
8
+ - if @style == 'source' || (@style == 'listing' && !(attr? 1, 'listing'))
9
+ - language = attr :language
10
+ - code_class = language ? [language, "language-#{language}"] : nil
11
+ - pre_class = ['highlight']
12
+ - pre_lang = nil
13
+ - case attr 'source-highlighter'
14
+ - when 'coderay'
15
+ - pre_class = ['CodeRay']
16
+ - when 'pygments'
17
+ - pre_class = ['pygments','highlight']
18
+ - when 'prettify'
19
+ - pre_class = ['prettyprint']
20
+ - pre_class << 'linenums' if attr? :linenums
21
+ - pre_class << language if language
22
+ - pre_class << "language-#{language}" if language
23
+ - code_class = nil
24
+ - when 'html-pipeline'
25
+ - pre_lang = language
26
+ - pre_class = code_class = nil
27
+ - nowrap = false
28
+ /- when 'highlightjs', 'highlight.js'
29
+ - pre_class << 'nowrap' if nowrap
30
+ pre class=pre_class lang=pre_lang
31
+ code class=code_class =content
32
+ - else
33
+ pre class=(nowrap ? 'nowrap' : nil) =content
@@ -0,0 +1,4 @@
1
+ .literalblock id=@id class=role
2
+ - if title?
3
+ .title=title
4
+ .content: pre class=(!(@document.attr? :prewrap) || (option? 'nowrap') ? 'nowrap' : nil) =content
@@ -0,0 +1,9 @@
1
+ .olist id=@id class=[@style,role]
2
+ - if title?
3
+ .title=title
4
+ ol class=@style start=(attr :start) type=list_marker_keyword
5
+ - items.each do |item|
6
+ li class=('fragment' if (option? :step) or (has_role? 'step'))
7
+ p=item.text
8
+ - if item.blocks?
9
+ =item.content
@@ -0,0 +1,15 @@
1
+ - if @style == 'abstract'
2
+ - if @parent == @document && @document.doctype == 'book'
3
+ - puts 'asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. Excluding block content.'
4
+ - else
5
+ .quoteblock.abstract id=@id class=role
6
+ - if title?
7
+ .title=title
8
+ blockquote=content
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.'
11
+ - else
12
+ .openblock id=@id class=[(@style != 'open' ? @style : nil),role]
13
+ - if title?
14
+ .title=title
15
+ .content=content
@@ -0,0 +1 @@
1
+ div style='page-break-after: always;'
@@ -0,0 +1,7 @@
1
+ .paragraph id=@id class=role
2
+ - if title?
3
+ .title=title
4
+ - if has_role? 'small'
5
+ small=content
6
+ - else
7
+ p=content
@@ -0,0 +1 @@
1
+ =content
@@ -0,0 +1,2 @@
1
+ / file intentionally left blank
2
+ / preamble is shown on the title slide which is rendered by document template