asciidoctor-revealjs 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f17adb228c81df3f330ecd97c9d714daaf373dd7
4
+ data.tar.gz: e9093a912c533f637661ad9eadc8d6661e923199
5
+ SHA512:
6
+ metadata.gz: 7e35b9133b7406edf2d4a0a5e9aec0c38b6672036a06ce32fae84f348c73e1b124ee137f3097328f9005965fa1ab90f0eca97e3d56abeba232154fc5d921a56e
7
+ data.tar.gz: 58b3fa54575ea6af8dd1d5fb27fe7086c6bf9de65a6a7779154fd12b6ea1ddac120d27a9c37d9cd683e4ffb77cb3494eeeabf03e9976f6a9d1f3a0389fc7d1ad
@@ -0,0 +1,46 @@
1
+ = {project-name} Changelog
2
+ :project-name: asciidoctor-reveal.js
3
+ :uri-repo: https://github.com/asciidoctor/asciidoctor-reveal.js
4
+
5
+ This document provides a high-level view of the changes introduced in {project-name} by release.
6
+ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
7
+
8
+ == 1.0.0 (2016-09-06) - @obilodeau
9
+
10
+ Since this is the first ever "release" of asciidoctor-reveal.js (we used to do continuous improvements w/o releases in the past), this list focuses on the major enhancements introduced over the last few weeks.
11
+
12
+ Enhancements::
13
+ * Initial release
14
+ * Ruby package (#93)
15
+ * Node package (#95)
16
+ * `:customcss:` attribute for easy per-presentation CSS (#85)
17
+ * Video support improvements (#81)
18
+ * Reveal.js `data-state` support (#61)
19
+ * Subtitle partioning (#70)
20
+ * Background image rework (#52)
21
+ * `:imagesdir:` properly enforced (#17, #67)
22
+
23
+ ////
24
+ Compliance::
25
+ * item
26
+
27
+ Bug fixes::
28
+ * item
29
+
30
+ Infrastructure::
31
+ * item
32
+ ////
33
+
34
+ === Release meta
35
+
36
+ Released by @obilodeau
37
+
38
+ {uri-repo}/issues?q=milestone%3A1.0[issues resolved] |
39
+ {uri-repo}/releases/tag/1.0[git tag]
40
+ // TODO full-diff when we can at the next release
41
+
42
+ === Credits
43
+
44
+ Thanks to the following people who contributed to this release:
45
+
46
+ Alexander Heusingfeld, Andrea Bedini, Antoine Sabot-Durand, Brian Street, Charles Moulliard, Dan Allen, Danny Hyun, Emmanuel Bernard, gtoast, Guillaume Grossetie, Jacob Aae Mikkelsen, Jakub Jirutka, Jozef Skrabo, Julien Grenier, Julien Kirch, kubamarchwicki, lifei, Nico Rikken, nipa, Olivier Bilodeau, Patrick van Dissel, phrix32, Rahman Usta, Robert Panzer, Rob Winch, Thomas and Wendell Smith
@@ -0,0 +1,250 @@
1
+ = HACKING asciidoctor-reveal.js
2
+ :toc: preamble
3
+ :toclevels: 2
4
+
5
+ Short instructions that aim to help potential contributors.
6
+
7
+ == Inspect the template system
8
+
9
+
10
+ To understand what you have access to in templates you can inject some ruby.
11
+ With the slim templating system, this is done by prepending the lines with a dash (`-`) and inserting a ruby statement.
12
+ Two complementary approaches can be used to explore the context offered by asciidoctor through the template system:
13
+
14
+ * logging on the command line via print-like statements
15
+ * jump into the context through an interactive debugger
16
+
17
+ === Print debugging information
18
+
19
+ For example to see which attributes are available, you can print them by adding these lines in the `.slim` file of interest:
20
+
21
+ ----
22
+ - puts @document.attributes.inspect
23
+ - puts @attributes.inspect
24
+ - puts @document.methods
25
+ ----
26
+
27
+ Other generally useful ruby specific introspection:
28
+
29
+ ----
30
+ - puts instance_variables
31
+ - puts local_variables
32
+ ----
33
+
34
+ One might find `pp` to produce better output (and in some cases not):
35
+
36
+ ----
37
+ - require 'pp'
38
+ - pp @document.attributes
39
+ ----
40
+
41
+ === Interactively debug a template
42
+
43
+ Pry is a powerful debugger for ruby that features tab-completion.
44
+ It is very useful to discover a complex object hierarchy like what asciidoctor offers.
45
+
46
+ ==== Initial Setup
47
+
48
+ gem install pry
49
+
50
+ ==== Usage
51
+
52
+ In order to be dropped into the debugger at a specific point in a template simply add the following two lines in the relevant `.slim` template file:
53
+
54
+ ----
55
+ - require 'pry'
56
+ - binding.pry
57
+ ----
58
+
59
+ Then run asciidoctor from the command-line to generate your document and you'll be dropped in the debugger:
60
+
61
+ ----
62
+ $ make
63
+ asciidoctor -T templates/slim -b revealjs test/level-sections.adoc
64
+ asciidoctor: WARNING: level-sections.adoc: line 29: section title out of sequence: expected level 2, got level 3
65
+
66
+ From: /home/olivier/src/asciidoc/asciidoctor-reveal.js/templates/slim/section.html.slim @ line 3 :
67
+
68
+ 1: - hide_title = (title = self.title) == '!'
69
+ 2: - require 'pry'
70
+ => 3: - binding.pry
71
+ 4: / parent section of vertical slides set
72
+ 5: - if @level == 1 && !(subsections = sections).empty?
73
+ 6: section
74
+ 7: section id=(hide_title ? nil : @id) data-transition=(attr 'data-transition') data-transition-speed=(attr 'data-transition-speed') data-background=(attr 'data-background') data-background-size=(attr 'data-background-size') data-background-repeat=(attr 'data-background-repeat') data-background-transition=(attr 'data-background-transition')
75
+ 8: - unless hide_title
76
+
77
+ [1] pry(#<Asciidoctor::Section>)>
78
+ ----
79
+
80
+ Then using commands like the following allows you to explore interactively asciidoctor's API and object model with syntax highlighting:
81
+
82
+ [1] pry(#<Asciidoctor::Section>)> @document
83
+
84
+ You can also query asciidoctor's documentation:
85
+
86
+ [4] pry(#<Asciidoctor::Section>)> ? find_by
87
+
88
+ === References
89
+
90
+ * https://github.com/asciidoctor/asciidoctor.org/issues/80#issuecomment-145698579
91
+ * http://pryrepl.org/
92
+ * http://discuss.asciidoctor.org/Interactively-debugging-a-template-with-a-REPL-td4498.html
93
+
94
+ == Tests
95
+
96
+ In order to help troubleshoot issues and test syntax improvements, some minimalist asciidoc test files are provided.
97
+ You can render the tests files and then load them in a browser and check if `asciidoctor-reveal.js` behaves as expected.
98
+
99
+ === Initial Setup
100
+
101
+ cd test/
102
+ git clone https://github.com/hakimel/reveal.js.git
103
+
104
+ === Render tests into .html
105
+
106
+ From the project's root directory:
107
+
108
+ make
109
+
110
+ === Open rendered files
111
+
112
+ You can open the generated `.html` in a Web browser.
113
+ For convenience the following command will open the last modified file:
114
+
115
+ make open
116
+
117
+ Additionally, if you want to test with a minimalist web server:
118
+
119
+ make serve
120
+
121
+ The server is running in the foreground and needs `Ctrl-C` to be killed.
122
+
123
+ == Jade templates
124
+
125
+ Jade templates are used by AsciidocFX. Since they are separate they might be
126
+ out of sync with our asciidoctor's slim templates.
127
+
128
+ To test the jade templates, install AsciidocFX and copy the jade templates
129
+ over to AsciidocFX's `conf/slide/templates/revealjs/` directory. Then use
130
+ AsciidocFX to render the slides.
131
+
132
+
133
+ == Attribute inheritence
134
+
135
+ The attr and attr? methods inherit by default. That means if they don't find the attribute defined on the node, they look on the document.
136
+
137
+ You only want to enable inheritance if you intend to allow an attribute of the same name to be controlled globally.
138
+ That might be good for configuring transitions. For instance:
139
+
140
+ ----
141
+ = My Slides
142
+ :transition-speed: fast
143
+
144
+ == First Slide
145
+ ----
146
+
147
+ However, there may be attributes that you don't want to inherit.
148
+ If that's the case, you generally use the form:
149
+
150
+ attr('name', nil, false)
151
+
152
+ The second parameter value is the default attribute value, which is nil by default.
153
+
154
+ Relevant documentation: http://www.rubydoc.info/github/asciidoctor/asciidoctor/Asciidoctor%2FAbstractNode%3Aattr
155
+
156
+
157
+ == Merge / Review policy
158
+
159
+ Any non-trivial change should be integrated in master via a pull-request.
160
+ This gives the community a chance to participate and helps write better code because it encourages people to review their own patches.
161
+
162
+ Pull requests should come from personal forks in order not the clutter the upstream repository.
163
+
164
+ === Wait time
165
+
166
+ Once a pull request is submitted, let it sit for 24-48 hours for small changes.
167
+ If you get positive feedback you can merge before the sitting time frame.
168
+ If you don't get feedback, just merge after the sitting time frame.
169
+
170
+ Larger changes should sit longer at around a week.
171
+ Positive feedback or no feedback should be handled like for small changes.
172
+
173
+ Breaking changes should sit until a prominent contributor comments on the changes.
174
+ Ping `@mojavelinux` and `@obilodeau` if necessary.
175
+
176
+ Remember that this is a slower moving project since people are not designing slides everyday.
177
+ Well, for most people.
178
+
179
+ === Work-in-progress pull-requests
180
+
181
+ If you prepend "WIP" in front of your pull request we will understand that it is not complete and we will not merge it before you remove the WIP string.
182
+
183
+ This is useful to let people know that you are working on stuff.
184
+ Branches are not that visible otherwise but pull requests are.
185
+
186
+ You might even be able to get some feedback early which could save you some time.
187
+
188
+ === 'needs review' label
189
+
190
+ You can apply that label to a pull request that is complete and ready for review.
191
+
192
+ Makes triaging easier.
193
+
194
+
195
+ == Node package
196
+
197
+ === Test a local asciidoctor-reveal.js version
198
+
199
+ In order to test the Node package, you need to create a test project adjacent to the clone of the `asciidoctor-reveal.js` repository:
200
+
201
+ $ mkdir test-project
202
+ $ cd test-project
203
+ $ npm init -y
204
+
205
+ Now, install the dependencies:
206
+
207
+ $ npm i --save asciidoctor.js@1.5.5-2
208
+ $ npm i --save asciidoctor-template.js@1.5.5-2
209
+ $ npm i --save ../asciidoctor-reveal.js
210
+
211
+ NOTE: The relative portion of the last command is where you are installing the local `asciidoctor-reveal.js` version from.
212
+
213
+ Then proceed as documented in the `README.adoc`.
214
+
215
+
216
+ === Publish a new version
217
+
218
+ . Update the "version" field in `package.json`
219
+ . Commit and push your changes
220
+ . Create a tag
221
+ . Using npm:
222
+ +
223
+ $ npm login
224
+ $ npm publish
225
+
226
+ . Check that the new version is available on https://www.npmjs.com/package/asciidoctor-reveal.js[npmjs.com]
227
+
228
+
229
+ == Ruby gem
230
+
231
+ === Publish a new version
232
+
233
+ . Update the version in `lib/asciidoctor-revealjs/version.rb`
234
+ . Update the changelog
235
+ ** Generate author list with `git log <commit>.. --format="%aN" --reverse | perl -e 'my %dedupe; while (<STDIN>) { print unless $dedupe{$_}++}' | sort `
236
+ . Prepare release commit
237
+ ** commit msg: Prepare %version% release
238
+ ** release commit (--allow-empty) msg: Release %version%
239
+ . Tag the release commit
240
+ ** Annotated Tag msg: Version %version%
241
+ . Push your changes (including the tag)
242
+ . Pushing the gem on rubygems.org:
243
+ +
244
+ $ gem build asciidoctor-revealjs.gemspec
245
+ $ gem push asciidoctor-revealjs-X.Y.Z.gem
246
+
247
+ . Check that the new version is available on https://rubygems.org/gems/asciidoctor-revealjs[rubygems.org]
248
+ . Update version (+1 bugfix and append '.dev') and commit
249
+ ** commit msg: Begin development on next release
250
+
@@ -0,0 +1,22 @@
1
+ .The MIT License
2
+ ....
3
+ Copyright (C) 2012-2016 Olivier Bilodeau, Charles Moulliard, Dan Allen and the Asciidoctor Project
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+ ....
@@ -0,0 +1,671 @@
1
+ = reveal.js backend for Asciidoctor
2
+ :toc: preamble
3
+ :toclevels: 2
4
+ :uri-us: https://github.com/asciidoctor/asciidoctor-reveal.js
5
+ :uri-asciidoctor: https://github.com/asciidoctor/asciidoctor
6
+ :uri-asciidoctorjs: https://github.com/asciidoctor/asciidoctor.js
7
+ :uri-revealjs-home: http://lab.hakim.se/reveal-js/
8
+ :uri-revealjs-gh: https://github.com/hakimel/reveal.js
9
+ :uri-nodejs-download: https://nodejs.org/en/download/
10
+
11
+ // Changes made here should be sync'ed in packages.json's readme field
12
+ The {uri-us}[reveal.js backend] is a collection of templates for {uri-asciidoctor}[Asciidoctor] (or {uri-asciidoctorjs}[Asciidoctor.js]) that transform an AsciiDoc document into HTML5 slides animated by {uri-revealjs-home}[reveal.js].
13
+
14
+ //image:https://travis-ci.org/asciidoctor/asciidoctor-reveal.js.svg?branch=master[Build Status,link=https://travis-ci.org/asciidoctor/asciidoctor-reveal.js]
15
+
16
+ There are two main technology stacks that can transform AsciiDoc into HTML5 / Reveal.js:
17
+
18
+ * Asciidoctor / Ruby / Slim / Bundler (<<ruby, instructions here>>)
19
+ * Asciidoctor.js / JavaScript / Jade / Node.js (<<javascript, instructions here>>)
20
+
21
+ Right now the Ruby / Slim templates are more featureful but that is changing quickly.
22
+
23
+
24
+ [[ruby]]
25
+ == Ruby Setup
26
+
27
+ NOTE: asciidoctor-reveal.js is now a Ruby Gem.
28
+ To ensure repeatability, we recommend that you manage your presentation projects using bundler.
29
+
30
+ For a quick start clone our https://github.com/obilodeau/presentation-revealjs-starter[starter repository] and follow instructions there.
31
+
32
+ For more complete instructions, read on.
33
+
34
+ NOTE: If you want to use reveal.js 2, please clone the asciidoctor-reveal.js repo and switch to the reveal.js-2.x branch.
35
+
36
+
37
+ === Prerequisites
38
+
39
+ . Install http://bundler.io/[bundler] (if not already installed) using your system's package manager or with:
40
+
41
+ $ gem install bundler
42
+
43
+ . If you're using RVM, make sure you switch away from any gemset:
44
+
45
+ $ rvm use default
46
+ +
47
+ or
48
+ +
49
+ $ rvm use system
50
+
51
+
52
+ === Install
53
+
54
+ NOTE: These instructions should be repeated for every presentation project.
55
+
56
+ . Create project directory
57
+
58
+ $ mkdir my-awesome-presentation
59
+ $ cd my-awesome-presentation
60
+
61
+ . Create a file named `Gemfile` with the following content:
62
+ +
63
+ ----
64
+ source 'https://rubygems.org'
65
+
66
+ gem 'asciidoctor-revealjs', github: 'asciidoctor/asciidoctor-reveal.js'
67
+ ----
68
+ +
69
+ NOTE: For some reason, when you use the system Ruby on Fedora, you also have to add the json gem to the Gemfile.
70
+ +
71
+ . Install the gems into the project
72
+
73
+ $ bundle config --local github.https true
74
+ $ bundle --path=.bundle/gems --binstubs=.bundle/.bin
75
+
76
+ . Optional: Copy or clone reveal.js presentation framework.
77
+ Allows you to modify themes or view slides offline.
78
+
79
+ $ git clone -b 3.3.0 --depth 1 https://github.com/hakimel/reveal.js.git
80
+
81
+
82
+ === Rendering the AsciiDoc into slides
83
+
84
+ . Create content in a file (*.adoc, *.ad, etc.).
85
+ See examples in <<Syntax Examples>> section to get started or look at files in `test/`.
86
+
87
+ . Generate HTML presentation from the AsciiDoc source
88
+
89
+ $ bundle exec asciidoctor-revealjs CONTENT_FILE.adoc
90
+
91
+ TIP: If you are using https://pages.github.com/[GitHub Pages], plan ahead by keeping your source files on `master` branch and all output files on the `gh-pages` branch.
92
+
93
+
94
+ [[javascript]]
95
+ == Node / JavaScript Setup
96
+
97
+ === Prerequisites
98
+
99
+ First you must install and configure {uri-nodejs-download}[Node.js] on your machine.
100
+
101
+ === Install
102
+
103
+ Using npm:
104
+
105
+ $ npm i --save asciidoctor.js@1.5.5-2
106
+ $ npm i --save asciidoctor-template.js@1.5.5-2
107
+ $ npm i --save asciidoctor-reveal.js@1.5.5-2
108
+
109
+ === Rendering the AsciiDoc into slides
110
+
111
+ Once the package is installed, you can convert AsciiDoc files using Reveal.js backend.
112
+ Here we are converting a file named `presentation.adoc` into a Reveal.js presentation using Node.js:
113
+
114
+ .asciidoctor-revealjs.js
115
+ [source, javascript]
116
+ ----
117
+ // Load asciidoctor.js + asciidoctor-template.js
118
+ var asciidoctor = require('asciidoctor.js')();
119
+ var Asciidoctor = asciidoctor.Asciidoctor();
120
+ var Opal = asciidoctor.Opal;
121
+ Opal.load('nodejs');
122
+ Opal.load('pathname');
123
+ require('asciidoctor-template.js');
124
+
125
+ // Convert the document 'presentation.adoc' using Reveal.js backend
126
+ var attributes = 'revealjsdir=node_modules/reveal.js@';
127
+ var options = Opal.hash({safe: 'safe',
128
+ backend: 'revealjs',
129
+ attributes: attributes});
130
+ Asciidoctor.$convert_file('presentation.adoc', options); // <1>
131
+ ----
132
+ <1> Creates a file named `presentation.html` (in the directory where command is run)
133
+
134
+ .presentation.adoc
135
+ [source, asciidoc]
136
+ ----
137
+ = Title Slide
138
+ // depending on your npm version, you might need to override the default
139
+ // 'revealjsdir' value by removing the comments from the line below:
140
+ //:revealjsdir: node_modules/asciidoctor-reveal.js/node_modules/reveal.js
141
+
142
+ == Slide One
143
+
144
+ * Foo
145
+ * Bar
146
+ * World
147
+
148
+ ----
149
+
150
+ To render the slides, run:
151
+
152
+ node asciidoctor-reveal.js
153
+
154
+ You can open the `presentation.html` file in your browser and enjoy!
155
+
156
+
157
+ == Syntax Examples
158
+
159
+ // FIXME: incomplete
160
+
161
+ Let's see some examples of `revealjs` backend features.
162
+
163
+ === Basic presentation with speaker notes
164
+
165
+ ----
166
+ = Title Slide
167
+
168
+ == Slide One
169
+
170
+ * Foo
171
+ * Bar
172
+ * World
173
+
174
+ == Slide Two
175
+
176
+ Hello World - Good Bye Cruel World
177
+
178
+ [NOTE.speaker]
179
+ --
180
+ Actually things aren't that bad
181
+ --
182
+ ----
183
+
184
+ In previous snippet we are creating a slide titled Slide One with bullets and another one titled Slide Two with centered text (reveal.js' default behavior) with {uri-revealjs-gh}#speaker-notes[speaker notes].
185
+
186
+
187
+ === Slides without titles
188
+
189
+ There are a few ways to have no titles on slides.
190
+
191
+ * Setting your title to `!`
192
+ * Adding the `notitle` option to your slide
193
+ * Adding the `conceal` option to your slide
194
+
195
+ Here is an example of the three techniques in action:
196
+
197
+ ----
198
+ include::test/concealed-slide-titles.adoc[]
199
+ ----
200
+
201
+ NOTE: `conceal` and `notitle` have the advantage that the slide still has an id so it can be linked to.
202
+
203
+
204
+ === Background colors
205
+
206
+ ----
207
+ [background-color="yellow"]
208
+ == Slide Three
209
+
210
+ Is very yellow
211
+ ----
212
+
213
+ Slide Three applies the attribute {uri-revealjs-gh}#slide-backgrounds[data-background-color] to the `reveal.js` <section> tag.
214
+ Anything accepted by CSS color formats works.
215
+
216
+
217
+ === Background images
218
+
219
+ ----
220
+ [%notitle]
221
+ == Grand Announcement
222
+
223
+ image::cover.jpg[background, size=cover]
224
+ ----
225
+
226
+ This will put `cover.jpg` as the slide's background image.
227
+ It sets `reveal.js'` `data-background-image` attribute.
228
+ The `size` attribute is also supported.
229
+ See the {uri-revealjs-gh}#image-backgrounds[relevant reveal.js documentation] for details.
230
+
231
+ NOTE: Background images file names are now relative to the `:imagedir:` attribute if set.
232
+
233
+ NOTE: The `canvas` keyword can be used instead of `background` for the same effect.
234
+
235
+ ----
236
+ [%notitle]
237
+ == The Great Goat
238
+
239
+ image::https://upload.wikimedia.org/wikipedia/commons/b/b2/Hausziege_04.jpg[canvas,size=contain]
240
+ ----
241
+
242
+ As you can see, you can use a URL to specify your image resource too.
243
+
244
+
245
+ [#background_videos]
246
+ === Background videos
247
+
248
+ A background video for a slide can be specified using the `background-video` element attribute.
249
+
250
+ ----
251
+ [background-video="https://my.video/file.mp4",background-video-loop=true,background-video-muted=true]
252
+ == Nice background!
253
+ ----
254
+
255
+ For convenience `background-video-loop` and `background-video-muted` attributes are mapped to `loop` and `muted` options which can be specified with `options="loop,muted"`.
256
+
257
+ For example:
258
+
259
+ ----
260
+ [background-video="https://my.video/file.mp4",options="loop,muted"]
261
+ == Nice background!
262
+ ----
263
+
264
+ See {uri-revealjs-gh}#video-backgrounds[the relevant reveal.js documentation] for details.
265
+ Note that the `data-` prefix is not required in asciidoc files.
266
+
267
+
268
+ === Background iframes
269
+
270
+ The background can be replaced with anything a browser can render in an iframe using the `background-iframe` reveal.js feature.
271
+
272
+ ----
273
+ [%notitle,background-iframe="https://www.youtube.com/embed/LaApqL4QjH8?rel=0&start=3&enablejsapi=1&autoplay=1&loop=1&controls=0&modestbranding=1"]
274
+ == a youtube video
275
+ ----
276
+
277
+ See {uri-revealjs-gh}#iframe-backgrounds[the relevant reveal.js documentation] for details.
278
+
279
+
280
+ === Slide Transitions
281
+
282
+ ----
283
+ [transition=zoom, %notitle]
284
+ == Zoom zoom
285
+
286
+ This slide will override the presentation transition and zoom!
287
+
288
+ [transition-speed=fast, %notitle]
289
+ == Speed
290
+
291
+ Choose from three transition speeds: default, fast or slow!
292
+ ----
293
+
294
+ See {uri-revealjs-gh}#slide-transitions[the relevant reveal.js documentation] for details.
295
+
296
+
297
+ === Fragments
298
+
299
+ ----
300
+ == Slide Four
301
+
302
+ [%step]
303
+ * this
304
+ * is
305
+ * revealed
306
+ * gradually
307
+ ----
308
+
309
+ Slide Four has bullets that are revealed one after the other.
310
+ This is what `reveal.js` calls http://lab.hakim.se/reveal-js/#/fragments[fragments].
311
+ Applying the step option or role on a list (`[%step]` or `[.step]`) will do the trick.
312
+ Here is {uri-revealjs-gh}#fragments[the relevant reveal.js
313
+ documentation] on the topic.
314
+ Note that only `fade-in` is supported for lists at the moment.
315
+
316
+
317
+ === Stretch class attribute
318
+
319
+ Reveal.js supports a special class that will give all available screen space to an HTML node.
320
+ This class element is named `stretch`.
321
+
322
+ __
323
+ Sometimes it's desirable to have an element, like an image or video, stretch to consume as much space as possible within a given slide.
324
+ __
325
+
326
+ To apply that class to block simply use asciidoctor's class assignment:
327
+
328
+ [.stretch]
329
+
330
+ See {uri-revealjs-gh}#stretching-elements[reveal.js documentation on stretching elements].
331
+
332
+
333
+ === Videos
334
+
335
+ In addition to <<background_videos,background videos>>, videos can be inserted directly into slides.
336
+ The syntax is the standard http://asciidoctor.org/docs/user-manual/#video[asciidoc video block macro] syntax.
337
+
338
+ ----
339
+ == Trains, we love trains!
340
+
341
+ video::kZH9JtPBq7k[youtube, start=34, options=autoplay]
342
+ ----
343
+
344
+ By default videos are given as much space as possible.
345
+ To override that behavior use the `width` and `height` named attributes.
346
+
347
+
348
+ === Syntax highlighting
349
+
350
+ [listing]
351
+ ....
352
+ == Slide Five
353
+
354
+ Uses highlighted code
355
+
356
+ ----
357
+ print "Hello World"
358
+ ----
359
+ ....
360
+
361
+ `revealjs` uses https://highlightjs.org/[highlight.js] to do its syntax highlighting by default.
362
+ By default `[source]` blocks and blocks delimited by `----` will be highlighted.
363
+ An explicit `[listing]` block will not be highlighted.
364
+ `highlight.js` does language auto-detection but using the `language="..."` attribute will hint the highlighter.
365
+ For example this will highlight this source code as Perl:
366
+
367
+ [listing]
368
+ ....
369
+ == Slide Five
370
+
371
+ [source,perl]
372
+ ----
373
+ print "$0: hello world\n"
374
+ ----
375
+ ....
376
+
377
+ [NOTE]
378
+ Currently `revealjs` uses a rather old version of https://highlightjs.org/[highlight.js] that does not handle callouts correctly.
379
+ To fix this download a current version of https://highlightjs.org/[highlight.js] and copy it to `reveal.js/plugin/highlight/highlight.js`.
380
+
381
+ Alternatively, you can use http://coderay.rubychan.de[Coderay] or http://pygments.org[Pygments] as the highlighter.
382
+ These handle callouts correctly.
383
+
384
+ To use http://coderay.rubychan.de[Coderay]:
385
+
386
+ ----
387
+ = Title slide
388
+ :source-highlighter: coderay
389
+ ----
390
+
391
+ To use http://pygments.org[Pygments]:
392
+
393
+ ----
394
+ = Title slide
395
+ :source-highlighter: pygments
396
+ ----
397
+
398
+ === Vertical slides
399
+
400
+ [listing]
401
+ ....
402
+ == Slide Six
403
+
404
+ Top slide
405
+
406
+ === Slide Six.One
407
+
408
+ This is a vertical subslide
409
+ ....
410
+
411
+ Slide Six uses the vertical slide feature of `reveal.js`.
412
+ Slide Six.One will be rendered vertically below Slide Six.
413
+ Here is {uri-revealjs-gh}#markup[the relevant reveal.js
414
+ documentation] on that topic.
415
+
416
+
417
+
418
+ === Title slide customization
419
+
420
+ The title slide is customized via Asciidoc attributes.
421
+ These are the global variable assigned at the top of a document under the lead
422
+ title that look like this: `:name: value`.
423
+
424
+ This back-end supports changing the color, image, video, iframe and
425
+ transitions of the title slide.
426
+
427
+ Read {uri-revealjs-gh}#slide-backgrounds[the relevant
428
+ reveal.js documentation] to understand what attributes need to be set.
429
+ Keep in mind that for title slides you must replace `data-` with
430
+ `title-slide-`.
431
+
432
+ Here is an example:
433
+
434
+ ----
435
+ include::test/title-slide-image.adoc[]
436
+ ----
437
+
438
+ The title slide is also added a `title` CSS class to help with template
439
+ customization.
440
+
441
+ === Content meant for multiple back-ends
442
+
443
+ Some content can be created with both slides and book in mind.
444
+
445
+ To mark slides split points you can use preprocessor conditionals combined
446
+ with back-end declaration.
447
+ Breaking points are set using slides with no title `=== !` wrapped in a
448
+ conditional: `ifdef::backend-revealjs[=== !]`.
449
+ In the end, the whole document has to be compiled with the back-end option:
450
+ `-b revealjs`
451
+
452
+ For example:
453
+
454
+ ----
455
+ == Main section
456
+
457
+ === Sub Section
458
+
459
+ Small +
460
+ Multiline +
461
+ intro
462
+
463
+ . very
464
+ . long
465
+ . list
466
+ . of
467
+ . items
468
+
469
+ \ifdef::backend-revealjs[=== !]
470
+
471
+ Some overview diagram
472
+
473
+ \ifdef::backend-revealjs[=== !]
474
+
475
+ Detailed view diagram
476
+ ----
477
+
478
+
479
+ === CSS override
480
+
481
+ If you use the `:customcss:` document attribute, a CSS file of the name given in the attribute is added to the list of CSS resources loaded by the rendered HTML.
482
+ Doing so, you can then easily override specific elements of your theme per presentation.
483
+
484
+ For example, to do proper position-independent text placement of a title slide with a specific background you can use:
485
+
486
+ ----
487
+ .reveal section.title h1 {
488
+ margin-top: 2.3em;
489
+ }
490
+
491
+ .reveal section.title small {
492
+ margin-top: 15.3em;
493
+ font-weight: bold;
494
+ color: white;
495
+ }
496
+ ----
497
+
498
+ If the `:customcss:` attribute value is empty then `asciidoctor-revealjs.css` is the CSS resource that the presentation is linked to.
499
+
500
+
501
+ === Slide state
502
+
503
+ Reveal.js supports a {uri-revealjs-gh}#slide-states[data-state] tag that can be added on slides which gets rendered into `<section>` tags.
504
+ In AsciiDoc the `data-state` can be applied to a slide by adding a state attribute to a section like this:
505
+
506
+ ----
507
+ [state=topic]
508
+ == Epic Topic
509
+ ----
510
+
511
+ That state can be queried from Javascript or used in CSS to apply further customization to your slide deck.
512
+ For example, by combining this feature with the <<_css_override, CSS override>> one, you can alter fonts for specific pages with this CSS:
513
+
514
+ ----
515
+ @import 'https://fonts.googleapis.com/css?family=Baloo+Bhai';
516
+
517
+ section[data-state="topic"] h2 {
518
+ font-family: 'Baloo Bhai', cursive;
519
+ font-size: 4em;
520
+ }
521
+ ----
522
+
523
+
524
+ // FIXME this is no longer accurate
525
+ == About Jade Templates
526
+
527
+ `/templates/jade` directory contains jade template files they are ported from `/templates/slim` templates. These templates were written to support reveal.js backend for Asciidoctor.js environment that is currently using in https://github.com/asciidocfx/AsciidocFX[AsciidocFX] editor. You can look at the https://github.com/asciidocfx/asciidoctor.js-reveal-demo[demo].
528
+
529
+ == reveal.js Options
530
+
531
+ There are some attributes that can be set at the top of the document which they are specific of +revealjs+ backend.
532
+
533
+ NOTE: Default settings are based on `reveal.js` default settings.
534
+
535
+ [cols="1m,1,2"]
536
+ |===
537
+ |Attribute |Value(s) |Description
538
+
539
+ |:revealjs_theme:
540
+ |beige, *black*, league, night, serif, simple, sky, solarized, white
541
+ |Chooses one of reveal.js' {uri-revealjs-gh}#theming[built-in themes].
542
+
543
+ |:revealjs_customtheme:
544
+ |<file\|URL>
545
+ |Overrides CSS with given file or URL.
546
+ Default is disabled.
547
+
548
+ |:highlightjs-theme:
549
+ |<file\|URL>
550
+ |Overrides https://highlightjs.org[highlight.js] CSS style with given file or URL.
551
+ Default is built-in [path]_lib/css/zenburn.css_.
552
+
553
+ |:revealjsdir:
554
+ |<file\|URL>
555
+ |Overrides reveal.js directory.
556
+ Example: ../reveal.js or
557
+ https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.3.0
558
+
559
+ |:revealjs_controls:
560
+ |*true*, false
561
+ |Display controls in the bottom right corner.
562
+
563
+ |:revealjs_progress:
564
+ |*true*, false
565
+ |Display a presentation progress bar.
566
+
567
+ |:revealjs_slideNumber:
568
+ |true, *false*
569
+ |Display the page number of the current slide.
570
+
571
+ |:revealjs_history:
572
+ |true, *false*
573
+ |Push each slide change to the browser history.
574
+
575
+ |:revealjs_keyboard:
576
+ |*true*, false
577
+ |Enable keyboard shortcuts for navigation.
578
+
579
+ |:revealjs_overview:
580
+ |*true*, false
581
+ |Enable the slide overview mode.
582
+
583
+ |:revealjs_touch:
584
+ |*true*, false
585
+ |Enables touch navigation on devices with touch input.
586
+
587
+ |:revealjs_center:
588
+ |*true*, false
589
+ |Vertical centering of slides.
590
+
591
+ |:revealjs_loop:
592
+ |true, *false*
593
+ |Loop the presentation.
594
+
595
+ |:revealjs_rtl:
596
+ |true, *false*
597
+ |Change the presentation direction to be RTL.
598
+
599
+ |:revealjs_fragments:
600
+ |*true*, false
601
+ |Turns fragments on and off globally.
602
+
603
+ |:revealjs_embedded:
604
+ |true, *false*
605
+ |Flags if the presentation is running in an embedded mode (i.e., contained within a limited portion of the screen).
606
+
607
+ |:revealjs_autoSlide:
608
+ |<integer>
609
+ |Delay in milliseconds between automatically proceeding to the next slide.
610
+ Disabled when set to *0* (the default).
611
+ This value can be overwritten by using a `data-autoslide` attribute on your slides.
612
+
613
+ |:revealjs_autoSlideStoppable:
614
+ |*true*, false
615
+ |Stop auto-sliding after user input.
616
+
617
+ |:revealjs_mouseWheel:
618
+ |true, *false*
619
+ |Enable slide navigation via mouse wheel.
620
+
621
+ |:revealjs_hideAddressBar:
622
+ |*true*, false
623
+ |Hides the address bar on mobile devices.
624
+
625
+ |:revealjs_previewLinks:
626
+ |true, *false*
627
+ |Opens links in an iframe preview overlay.
628
+
629
+ |:revealjs_transition:
630
+ |none, fade, *slide*, convex, concave, zoom
631
+ |Transition style.
632
+
633
+ |:revealjs_transitionSpeed:
634
+ |*default*, fast, slow
635
+ |Transition speed.
636
+
637
+ |:revealjs_backgroundTransition:
638
+ |none, *fade*, slide, convex, concave, zoom
639
+ |Transition style for full page slide backgrounds.
640
+
641
+ |:revealjs_viewDistance:
642
+ |<integer>
643
+ |Number of slides away from the current that are visible. Default: 3
644
+
645
+ |:revealjs_parallaxBackgroundImage:
646
+ |<file\|URL>
647
+ |Parallax background image.
648
+ Defaults to none
649
+
650
+ |:revealjs_parallaxBackgroundSize:
651
+ |<CSS size syntax>
652
+ |Parallax background size (accepts any CSS syntax).
653
+ Defaults to none
654
+ |===
655
+
656
+ If you want to build a custom theme or customize an existing one you should
657
+ look at the
658
+ {uri-revealjs-gh}/blob/master/css/theme/README.md[reveal.js
659
+ theme documentation] and use the `revealjs_customtheme` AsciiDoc attribute to
660
+ activate it.
661
+
662
+ == Minimum Requirements
663
+
664
+ * asciidoctor 1.5.4
665
+
666
+ == Copyright and Licensing
667
+
668
+ Copyright (C) 2012-2016 Olivier Bilodeau, Charles Moulliard, Dan Allen and the Asciidoctor Project.
669
+ Free use of this software is granted under the terms of the MIT License.
670
+
671
+ See the <<LICENSE#,LICENSE>> file for details.