asciidoctor-revealjs 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +40 -9
  3. data/Gemfile +4 -0
  4. data/HACKING.adoc +104 -39
  5. data/LICENSE.adoc +1 -1
  6. data/README.adoc +57 -27
  7. data/Rakefile +114 -0
  8. data/asciidoctor-revealjs.gemspec +13 -4
  9. data/examples/README.adoc +17 -0
  10. data/examples/admonitions-icons.adoc +37 -0
  11. data/examples/admonitions.adoc +38 -0
  12. data/examples/concealed-slide-titles.adoc +20 -0
  13. data/examples/customcss.adoc +9 -0
  14. data/examples/customcss.css +8 -0
  15. data/examples/data-background-newstyle.adoc +63 -0
  16. data/examples/data-background-oldstyle.adoc +44 -0
  17. data/examples/history-regression-tests.adoc +34 -0
  18. data/examples/history.adoc +19 -0
  19. data/examples/images.adoc +19 -0
  20. data/examples/images/70s.jpg +0 -0
  21. data/examples/images/bio.jpg +0 -0
  22. data/examples/images/cover.jpg +0 -0
  23. data/examples/images/meme-2.jpg +0 -0
  24. data/examples/images/meme-7.png +0 -0
  25. data/examples/images/web_surfing_time.gif +0 -0
  26. data/examples/keyboard-shortcuts.adoc +24 -0
  27. data/examples/level-sections.adoc +44 -0
  28. data/examples/multi-destination-content.adoc +66 -0
  29. data/examples/revealjs-stretch.adoc +22 -0
  30. data/examples/slide-state.adoc +18 -0
  31. data/examples/slide-state.css +6 -0
  32. data/examples/source-callouts.adoc +20 -0
  33. data/examples/speaker-notes.adoc +21 -0
  34. data/examples/theme-custom.adoc +33 -0
  35. data/examples/theme-custom.css +33 -0
  36. data/examples/title-preamble.adoc +10 -0
  37. data/examples/title-slide-color.adoc +10 -0
  38. data/examples/title-slide-image.adoc +13 -0
  39. data/examples/title-slide-video.adoc +13 -0
  40. data/examples/title-subtitle-partitioning.adoc +7 -0
  41. data/examples/transitions.adoc +20 -0
  42. data/examples/vertical-slides.adoc +24 -0
  43. data/examples/video.adoc +32 -0
  44. data/lib/asciidoctor-revealjs.rb +1 -1
  45. data/lib/asciidoctor-revealjs/version.rb +1 -1
  46. data/lib/asciidoctor-templates-compiler.rb +11 -0
  47. data/templates/{slim/block_admonition.html.slim → admonition.html.slim} +2 -2
  48. data/templates/{slim/block_audio.html.slim → audio.html.slim} +0 -0
  49. data/templates/{slim/block_colist.html.slim → colist.html.slim} +0 -0
  50. data/templates/{slim/block_dlist.html.slim → dlist.html.slim} +0 -0
  51. data/templates/{slim/document.html.slim → document.html.slim} +25 -5
  52. data/templates/{slim/embedded.html.slim → embedded.html.slim} +0 -0
  53. data/templates/{slim/block_example.html.slim → example.html.slim} +0 -0
  54. data/templates/floating_title.html.slim +2 -0
  55. data/templates/helpers.rb +99 -0
  56. data/templates/{slim/block_image.html.slim → image.html.slim} +1 -1
  57. data/templates/{slim/inline_anchor.html.slim → inline_anchor.html.slim} +0 -0
  58. data/templates/{slim/inline_break.html.slim → inline_break.html.slim} +0 -0
  59. data/templates/{slim/inline_button.html.slim → inline_button.html.slim} +0 -0
  60. data/templates/{slim/inline_callout.html.slim → inline_callout.html.slim} +0 -0
  61. data/templates/{slim/inline_footnote.html.slim → inline_footnote.html.slim} +0 -0
  62. data/templates/{slim/inline_image.html.slim → inline_image.html.slim} +0 -0
  63. data/templates/{slim/inline_indexterm.html.slim → inline_indexterm.html.slim} +0 -0
  64. data/templates/{slim/inline_kbd.html.slim → inline_kbd.html.slim} +0 -0
  65. data/templates/{slim/inline_menu.html.slim → inline_menu.html.slim} +0 -0
  66. data/templates/{slim/inline_quoted.html.slim → inline_quoted.html.slim} +0 -0
  67. data/templates/{slim/block_listing.html.slim → listing.html.slim} +1 -1
  68. data/templates/{slim/block_literal.html.slim → literal.html.slim} +0 -0
  69. data/templates/{slim/block_olist.html.slim → olist.html.slim} +0 -0
  70. data/templates/{slim/block_open.html.slim → open.html.slim} +0 -0
  71. data/templates/outline.html.slim +9 -0
  72. data/templates/{slim/block_page_break.html.slim → page_break.html.slim} +0 -0
  73. data/templates/{slim/block_paragraph.html.slim → paragraph.html.slim} +0 -0
  74. data/templates/{slim/block_pass.html.slim → pass.html.slim} +0 -0
  75. data/templates/{slim/block_preamble.html.slim → preamble.html.slim} +0 -0
  76. data/templates/{slim/block_quote.html.slim → quote.html.slim} +0 -0
  77. data/templates/{jade/ruler.jade → ruler.html.slim} +0 -0
  78. data/templates/{slim/section.html.slim → section.html.slim} +8 -5
  79. data/templates/{slim/block_sidebar.html.slim → sidebar.html.slim} +0 -0
  80. data/templates/{slim/block_stem.html.slim → stem.html.slim} +0 -0
  81. data/templates/{slim/block_table.html.slim → table.html.slim} +5 -3
  82. data/templates/{jade/thematic_break.jade → thematic_break.html.slim} +0 -0
  83. data/templates/toc.html.slim +17 -0
  84. data/templates/{slim/block_ulist.html.slim → ulist.html.slim} +0 -0
  85. data/templates/{slim/block_verse.html.slim → verse.html.slim} +0 -0
  86. data/templates/{slim/block_video.html.slim → video.html.slim} +0 -0
  87. metadata +179 -89
  88. data/lib/asciidoctor-revealjs/converter.rb +0 -38
  89. data/templates/jade/admonition.jade +0 -17
  90. data/templates/jade/audio.jade +0 -6
  91. data/templates/jade/colist.jade +0 -22
  92. data/templates/jade/dlist.jade +0 -60
  93. data/templates/jade/document.jade +0 -103
  94. data/templates/jade/embedded.jade +0 -11
  95. data/templates/jade/example.jade +0 -4
  96. data/templates/jade/floating_title.jade +0 -2
  97. data/templates/jade/image.jade +0 -12
  98. data/templates/jade/inline_anchor.jade +0 -9
  99. data/templates/jade/inline_break.jade +0 -2
  100. data/templates/jade/inline_button.jade +0 -1
  101. data/templates/jade/inline_callout.jade +0 -9
  102. data/templates/jade/inline_image.jade +0 -24
  103. data/templates/jade/inline_indexterm.jade +0 -2
  104. data/templates/jade/inline_kbd.jade +0 -9
  105. data/templates/jade/inline_quoted.jade +0 -26
  106. data/templates/jade/listing.jade +0 -29
  107. data/templates/jade/literal.jade +0 -5
  108. data/templates/jade/olist.jade +0 -9
  109. data/templates/jade/page_break.jade +0 -1
  110. data/templates/jade/paragraph.jade +0 -7
  111. data/templates/jade/pass.jade +0 -1
  112. data/templates/jade/quote.jade +0 -11
  113. data/templates/jade/section.jade +0 -15
  114. data/templates/jade/sidebar.jade +0 -5
  115. data/templates/jade/table.jade +0 -45
  116. data/templates/jade/ulist.jade +0 -25
  117. data/templates/jade/verse.jade +0 -14
  118. data/templates/jade/video.jade +0 -30
  119. data/templates/slim/block_floating_title.html.slim +0 -1
  120. data/templates/slim/block_ruler.html.slim +0 -1
  121. data/templates/slim/block_thematic_break.html.slim +0 -1
  122. data/templates/slim/block_toc.html.slim +0 -12
  123. data/templates/slim/helpers.rb +0 -38
data/Rakefile ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require 'asciidoctor'
4
+ require 'asciidoctor/doctest'
5
+ require 'colorize'
6
+ require 'thread_safe'
7
+ require 'tilt'
8
+
9
+ CONVERTER_FILE = 'lib/asciidoctor-revealjs/converter.rb'
10
+ TEMPLATES_DIR = 'templates'
11
+
12
+ file CONVERTER_FILE => FileList["#{TEMPLATES_DIR}/*"] do
13
+ build_converter :fast
14
+ end
15
+
16
+ namespace :build do
17
+ desc 'Compile Slim templates and generate converter.rb'
18
+ task :converter => 'clean' do
19
+ build_converter
20
+ end
21
+
22
+ desc 'Compile Slim templates and generate converter.rb for Opal'
23
+ task 'converter:opal' => 'clean' do
24
+ build_converter :opal
25
+ end
26
+ end
27
+
28
+ task :build => 'build:converter'
29
+
30
+ task :clean do
31
+ rm_rf CONVERTER_FILE
32
+ end
33
+
34
+ def build_converter(mode = :pretty)
35
+ #require 'asciidoctor-templates-compiler'
36
+ require_relative 'lib/asciidoctor-templates-compiler'
37
+ require 'slim-htag'
38
+
39
+ generator = if mode == :opal
40
+ Temple::Generators::ArrayBuffer.new(freeze_static: false)
41
+ else
42
+ Temple::Generators::StringBuffer
43
+ end
44
+
45
+ File.open(CONVERTER_FILE, 'w') do |file|
46
+ puts "Generating #{file.path} (mode: #{mode})."
47
+
48
+ Asciidoctor::TemplatesCompiler::RevealjsSlim.compile_converter(
49
+ templates_dir: TEMPLATES_DIR,
50
+ class_name: 'Asciidoctor::Revealjs::Converter',
51
+ register_for: ['revealjs'],
52
+ backend_info: {
53
+ basebackend: 'html',
54
+ outfilesuffix: '.html',
55
+ filetype: 'html',
56
+ },
57
+ delegate_backend: 'html5',
58
+ engine_opts: {
59
+ generator: generator,
60
+ },
61
+ pretty: (mode == :pretty),
62
+ output: file
63
+ )
64
+ end
65
+ end
66
+
67
+ DocTest::RakeTasks.new do |t|
68
+ t.output_examples :html, path: 'test/doctest'
69
+ t.input_examples :asciidoc, path: [ *DocTest.examples_path, 'examples' ]
70
+ t.converter = DocTest::HTML::Converter
71
+ t.converter_opts = { backend_name: 'revealjs' }
72
+ end
73
+
74
+ task 'prepare-converter' do
75
+ # Run as an external process to ensure that it will not affect tests
76
+ # environment with extra loaded modules (especially slim).
77
+ `bundle exec rake #{CONVERTER_FILE}`
78
+
79
+ require_relative 'lib/asciidoctor-revealjs'
80
+ end
81
+
82
+ namespace :examples do
83
+ desc 'Converts all the test slides into fully working examples that you can look in a browser'
84
+ # converted slides will be put in examples/ directory
85
+ task :convert do
86
+ require 'slim-htag'
87
+ Dir.glob('examples/*.adoc') do |_file|
88
+ print "Converting file #{_file}... "
89
+ out = Asciidoctor.convert_file _file,
90
+ :safe => 'safe',
91
+ :backend => 'revealjs',
92
+ :base_dir => 'examples',
93
+ :template_dir => 'templates'
94
+ if out.instance_of? Asciidoctor::Document
95
+ puts "✔️".green
96
+ else
97
+ puts "✖️".red
98
+ end
99
+ end
100
+ end
101
+
102
+ task :serve do
103
+ puts "View rendered examples at: http://127.0.0.1:5000/"
104
+ puts "Exit with Ctrl-C"
105
+ Dir.chdir('examples') do
106
+ `ruby -run -e httpd . -p 5000 -b 127.0.0.1`
107
+ end
108
+ end
109
+ end
110
+
111
+ task 'doctest:test' => 'prepare-converter'
112
+ task 'doctest:generate' => 'prepare-converter'
113
+ # When no task specified, run test.
114
+ task :default => :doctest
@@ -1,5 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  require File.expand_path '../lib/asciidoctor-revealjs/version', __FILE__
3
+ require 'open3'
3
4
 
4
5
  Gem::Specification.new do |s|
5
6
  s.name = 'asciidoctor-revealjs'
@@ -17,16 +18,24 @@ Gem::Specification.new do |s|
17
18
  rescue
18
19
  Dir['**/*']
19
20
  end
20
- s.files = files.grep %r/^(?:(?:lib|templates)\/.+|Gemfile|Rakefile|(?:CHANGELOG|LICENSE|README)\.adoc|#{s.name}\.gemspec)$/
21
-
21
+ # TODO should we still package template files now that they are built into ruby?
22
+ s.files = files.grep %r/^(?:(?:examples|lib|templates)\/.+|Gemfile|Rakefile|(?:CHANGELOG|LICENSE|README)\.adoc|#{s.name}\.gemspec)$/
22
23
 
23
24
  s.executables = ['asciidoctor-revealjs']
24
25
  s.extra_rdoc_files = Dir['README.adoc', 'LICENSE.adoc', 'HACKING.adoc']
25
26
  s.require_paths = ['lib']
26
27
 
27
- s.add_runtime_dependency 'asciidoctor', '= 1.5.4'
28
- s.add_runtime_dependency 'slim', '~> 3.0.6'
28
+ s.add_runtime_dependency 'asciidoctor', '~> 1.5.6'
29
29
  s.add_runtime_dependency 'thread_safe', '~> 0.3.5'
30
30
 
31
31
  s.add_development_dependency 'rake', '~> 10.4.2'
32
+ s.add_development_dependency 'asciidoctor-doctest', '= 2.0.0.beta.4'
33
+ s.add_development_dependency 'pry', '~> 0.10.4'
34
+ if RUBY_ENGINE != 'jruby'
35
+ s.add_development_dependency 'pry-byebug'
36
+ end
37
+ s.add_development_dependency 'colorize'
38
+ s.add_development_dependency 'asciidoctor-templates-compiler', '~> 0.3.0'
39
+ s.add_development_dependency 'slim', '~> 3.0.6'
40
+ s.add_development_dependency 'slim-htag', '~> 0.1.0'
32
41
  end
@@ -0,0 +1,17 @@
1
+ = Examples
2
+
3
+ Minimal AsciiDoc slide-decks to showcase reveal.js' features or test for regressions.
4
+
5
+ They are also used in automated testing.
6
+ Because of that some metadata (AsciiDoc comments `//`) is present.
7
+
8
+ == Preview examples (ruby)
9
+
10
+ $ bundle exec rake examples:convert
11
+
12
+ == Preview examples (javascript)
13
+
14
+ $ bundle exec rake build:converter:opal
15
+ $ npm run examples
16
+
17
+ Make sure you have a link between `examples/node_modules/` and `node_modules/` where reveal.js is installed.
@@ -0,0 +1,37 @@
1
+ // .admonitions-font
2
+ // :include: //div[@class="slides"]
3
+ // :header_footer:
4
+ = Admonitions
5
+ :backend: revealjs
6
+
7
+ == Admonition
8
+
9
+ IMPORTANT: This presentation is important
10
+
11
+ == Admonition block
12
+
13
+ [WARNING]
14
+ ====
15
+ This is a warning block
16
+ ====
17
+
18
+ == Admonition block complex
19
+
20
+ [NOTE]
21
+ .Keeping notes
22
+ ====
23
+ These are very thorough notes.
24
+
25
+ * With
26
+ * Bullets
27
+ ====
28
+
29
+ == Admonition with caption
30
+
31
+ [TIP, caption='ProTip(TM)']
32
+ .Reveal.JS
33
+ ====
34
+ Use include blocks to split your talks into small sections.
35
+ It's easier to reorganize afterwards.
36
+ ====
37
+
@@ -0,0 +1,38 @@
1
+ // .admonitions-font
2
+ // :include: //div[@class="slides"]
3
+ // :header_footer:
4
+ = Admonitions
5
+ :backend: revealjs
6
+ :icons: font
7
+
8
+ == Admonition
9
+
10
+ IMPORTANT: This presentation is important
11
+
12
+ == Admonition block
13
+
14
+ [WARNING]
15
+ ====
16
+ This is a warning block
17
+ ====
18
+
19
+ == Admonition block complex
20
+
21
+ [NOTE]
22
+ .Keeping notes
23
+ ====
24
+ These are very thorough notes.
25
+
26
+ * With
27
+ * Bullets
28
+ ====
29
+
30
+ == Admonition with caption
31
+
32
+ [TIP, caption='ProTip(TM)']
33
+ .Reveal.JS
34
+ ====
35
+ Use include blocks to split your talks into small sections.
36
+ It's easier to reorganize afterwards.
37
+ ====
38
+
@@ -0,0 +1,20 @@
1
+ // .concealed-slide-titles
2
+ // The three different ways to hide slide titles
3
+ // :include: //div[@class="slides"]
4
+ // :header_footer:
5
+ = Concealed Slide Titles
6
+ :backend: revealjs
7
+
8
+ == !
9
+
10
+ This
11
+
12
+ [%notitle]
13
+ == Presentation
14
+
15
+ presentation's titles
16
+
17
+ [%conceal]
18
+ == Concealed
19
+
20
+ should be concealed
@@ -0,0 +1,9 @@
1
+ // .customcss
2
+ // Use of the customcss attribute to load external CSS
3
+ // :include: //body/script | //div[@class="slides"]
4
+ // :header_footer:
5
+ = Custom CSS
6
+ Author
7
+ :customcss: customcss.css
8
+
9
+ == Slide 1
@@ -0,0 +1,8 @@
1
+ .reveal section h1 {
2
+ font-family: cursive;
3
+ }
4
+
5
+ .reveal section small {
6
+ margin-top: 15.3em;
7
+ font-family: fantasy;
8
+ }
@@ -0,0 +1,63 @@
1
+ // .images-data-background-new
2
+ // Demonstration of the new image background syntax.
3
+ // See https://github.com/asciidoctor/asciidoctor-reveal.js/pull/52
4
+ // :include: //div[@class="slides"]
5
+ // :header_footer:
6
+ = Test slide deck
7
+ :imagesdir: images
8
+ :backend: revealjs
9
+
10
+ [%notitle]
11
+ == Opening
12
+
13
+ image::cover.jpg[background, size=cover]
14
+
15
+ == canvas
16
+
17
+ image::cover.jpg[canvas, size=cover]
18
+
19
+ == !
20
+
21
+ image::70s.jpg[background, size=cover]
22
+
23
+ image::meme-2.jpg[width=500px]
24
+
25
+ == I have no background
26
+
27
+ == !
28
+
29
+ image::meme-7.png[]
30
+
31
+ == !
32
+
33
+ image::70s.jpg[background,size=contain]
34
+
35
+ == hey
36
+
37
+ image::bio.jpg[background,size=100px]
38
+
39
+ === here
40
+
41
+ image::bio.jpg[background,size=200px]
42
+
43
+ === I
44
+
45
+ image::bio.jpg[background,size=400px]
46
+
47
+ === come
48
+
49
+ image::bio.jpg[background,size=800px]
50
+
51
+ == URL goat
52
+
53
+ image::https://upload.wikimedia.org/wikipedia/commons/b/b2/Hausziege_04.jpg[background,size=contain]
54
+
55
+ [background-color=yellow]
56
+ == No [yellow] regression
57
+
58
+
59
+ == Empty Vertical top
60
+
61
+ === Vertical with background
62
+
63
+ image::70s.jpg[canvas, size=cover]
@@ -0,0 +1,44 @@
1
+ // .images-data-background-old
2
+ // Demonstration of the old image background syntax.
3
+ // We should retain compatibility for a while.
4
+ // See https://github.com/asciidoctor/asciidoctor-reveal.js/pull/52
5
+ // :include: //div[@class="slides"]
6
+ // :header_footer:
7
+ = Test slide deck
8
+ :imagesdir: images
9
+ :backend: revealjs
10
+
11
+ [background-image=cover.jpg,background-size=cover]
12
+ == !
13
+
14
+ [background-image=70s.jpg,background-size=cover]
15
+ == !
16
+
17
+ image::meme-2.jpg[width=500px]
18
+
19
+ == I have no background
20
+
21
+ == !
22
+
23
+ image::meme-7.png[]
24
+
25
+ [background-image=70s.jpg,background-size=contain]
26
+ == !
27
+
28
+ [background-image=bio.jpg,background-size=100px]
29
+ == hey
30
+
31
+ [background-image=bio.jpg,background-size=200px]
32
+ === here
33
+
34
+ [background-image=bio.jpg,background-size=400px]
35
+ === I
36
+
37
+ [background-image=bio.jpg,background-size=800px]
38
+ === come
39
+
40
+ [background-image=https://upload.wikimedia.org/wikipedia/commons/b/b2/Hausziege_04.jpg,background-size=contain]
41
+ == URL Goat
42
+
43
+ [background-color=yellow]
44
+ == No [yellow] regression
@@ -0,0 +1,34 @@
1
+ // .history-regression-tests
2
+ // Demonstration of revealjs history regression.
3
+ // See https://github.com/asciidoctor/asciidoctor-reveal.js/pull/99 and https://github.com/asciidoctor/asciidoctor-reveal.js/issues/127
4
+ // :include: //body/script | //div[@class="slides"]
5
+ // :header_footer:
6
+ = First Slide
7
+ :revealjs_history: true
8
+
9
+ == Second Slide
10
+
11
+ == 3rd Slide
12
+ // slide that starts with a number
13
+
14
+ == P3rhaps this won't work
15
+ // Second char is a number
16
+
17
+ == 5th Slide
18
+ // is it skipped by reveal.js?
19
+
20
+ == Illegal çhàrâctérß
21
+
22
+ [[explicit]]
23
+ == Explicit section id
24
+
25
+ == 67848727
26
+ // Everything should be stripped in the id
27
+
28
+ == Repeated title
29
+
30
+ == !
31
+ // Explicit no title
32
+
33
+ == Repeated title
34
+ // Exact same title means exact same id
@@ -0,0 +1,19 @@
1
+ // .history
2
+ // Enables Reveal.JS' browser history feature
3
+ // :include: //body/script | //div[@class="slides"]
4
+ // :header_footer:
5
+ = History
6
+ :backend: revealjs
7
+ :revealjs_history: true
8
+
9
+ == First slide
10
+
11
+ Uno
12
+
13
+ == Second slide
14
+
15
+ Dos
16
+
17
+ == Third slide
18
+
19
+ Tres