asciidoctor-revealjs 4.0.1 → 4.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +75 -35
  3. data/Rakefile +18 -3
  4. data/asciidoctor-revealjs.gemspec +1 -1
  5. data/examples/a11y-dark.css +99 -0
  6. data/examples/autoslide.adoc +22 -0
  7. data/examples/custom-layout.adoc +10 -0
  8. data/examples/data-attributes.adoc +245 -0
  9. data/examples/font-awesome-specific-version.adoc +11 -0
  10. data/examples/font-awesome.adoc +16 -2
  11. data/examples/footnotes.adoc +46 -0
  12. data/examples/fragments.adoc +12 -0
  13. data/examples/grid-layout-3x2.adoc +50 -0
  14. data/examples/grid-layout-docinfo-revealjs.html +1 -1
  15. data/examples/grid-layout.adoc +21 -1
  16. data/examples/images/cute-cat-1.jpg +0 -0
  17. data/examples/images/cute-cat-2.jpg +0 -0
  18. data/examples/images/cute-cat-3.jpg +0 -0
  19. data/examples/images/flock-of-seagulls_daniel-simion.mp3 +0 -0
  20. data/examples/issue-grid-layout-images.adoc +25 -0
  21. data/examples/mathjax-cdn.adoc +21 -0
  22. data/examples/mathjax.adoc +20 -0
  23. data/examples/release-4.0.adoc +2 -5
  24. data/examples/release-4.1.adoc +133 -0
  25. data/examples/release-4.1.css +50 -0
  26. data/examples/revealjs-custom-theme.adoc +10 -0
  27. data/examples/steps.adoc +87 -0
  28. data/examples/text-alignments.adoc +44 -0
  29. data/examples/video.adoc +19 -6
  30. data/lib/asciidoctor-revealjs/converter.rb +754 -647
  31. data/lib/asciidoctor-revealjs/version.rb +1 -1
  32. data/templates/admonition.html.slim +1 -1
  33. data/templates/asciidoctor-compatibility.css +303 -54
  34. data/templates/audio.html.slim +1 -1
  35. data/templates/colist.html.slim +1 -1
  36. data/templates/dlist.html.slim +3 -3
  37. data/templates/document.html.slim +12 -7
  38. data/templates/example.html.slim +1 -1
  39. data/templates/helpers.rb +80 -7
  40. data/templates/image.html.slim +2 -2
  41. data/templates/inline_anchor.html.slim +5 -4
  42. data/templates/inline_button.html.slim +2 -1
  43. data/templates/inline_footnote.html.slim +11 -4
  44. data/templates/inline_image.html.slim +2 -5
  45. data/templates/inline_kbd.html.slim +3 -2
  46. data/templates/inline_menu.html.slim +4 -3
  47. data/templates/inline_quoted.html.slim +13 -21
  48. data/templates/listing.html.slim +14 -9
  49. data/templates/literal.html.slim +1 -1
  50. data/templates/olist.html.slim +2 -2
  51. data/templates/open.html.slim +3 -3
  52. data/templates/paragraph.html.slim +1 -1
  53. data/templates/quote.html.slim +1 -1
  54. data/templates/section.html.slim +18 -1
  55. data/templates/sidebar.html.slim +1 -1
  56. data/templates/stem.html.slim +1 -1
  57. data/templates/table.html.slim +3 -2
  58. data/templates/ulist.html.slim +3 -3
  59. data/templates/verse.html.slim +1 -1
  60. data/templates/video.html.slim +14 -8
  61. metadata +26 -10
  62. data/CHANGELOG.adoc +0 -546
  63. data/HACKING.adoc +0 -412
@@ -1,412 +0,0 @@
1
- = HACKING asciidoctor-reveal.js
2
- :toc: preamble
3
- :toclevels: 2
4
-
5
- Short instructions that aim to help potential contributors.
6
-
7
- == Getting Started
8
-
9
- * Setup the Asciidoctor-revealjs plugin in <<ruby-localversion,development mode>>
10
- * Modify the http://slim-lang.com/[slim templates] in `templates/`
11
- * Templates need to be compiled before being used, do so with:
12
-
13
- bundle exec rake build
14
-
15
- * Then using the following command will render slides with your template changes baked in:
16
-
17
- bundle exec asciidoctor-revealjs <source.adoc>
18
-
19
- The next section will provide further help on how to use `print` statements or a debugger to assist development.
20
-
21
-
22
- == Inspect the template system
23
-
24
- To understand what you have access to in templates you can inject some ruby.
25
- With the slim templating system, this is done by prepending the lines with a dash (`-`) and inserting a ruby statement.
26
- Two complementary approaches can be used to explore the context offered by asciidoctor through the template system:
27
-
28
- * logging on the command line via print-like statements
29
- * jump into the context through an interactive debugger
30
-
31
- [NOTE]
32
- --
33
- Debugging is only supported via the Ruby ecosystem.
34
- You need to recompile the templates when you make changes to them.
35
- This can be done by running:
36
-
37
- bundle exec rake build
38
- --
39
-
40
- === Print debugging information
41
-
42
- For example to see which attributes are available, you can print them by adding these lines in the `.slim` file of interest:
43
-
44
- ----
45
- - puts @document.attributes.inspect
46
- - puts @attributes.inspect
47
- - puts @document.methods
48
- ----
49
-
50
- Other generally useful ruby specific introspection:
51
-
52
- ----
53
- - puts instance_variables
54
- - puts local_variables
55
- ----
56
-
57
- One might find `pp` to produce better output (and in some cases not):
58
-
59
- ----
60
- - require 'pp'
61
- - pp @document.attributes
62
- ----
63
-
64
- === Interactively debug a template
65
-
66
- Pry is a powerful debugger for ruby that features tab-completion.
67
- It is very useful to discover a complex object hierarchy like what asciidoctor offers.
68
-
69
- ==== Initial Setup
70
-
71
- bundle --path=.bundle/gems --binstubs=.bundle/.bin
72
-
73
- ==== Usage
74
-
75
- 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:
76
-
77
- ----
78
- - require 'pry'
79
- - binding.pry
80
- ----
81
-
82
- Recompile the templates with:
83
-
84
- bundle exec rake build
85
-
86
- Then run `asciidoctor-revealjs` from the command-line to generate your document and you'll be dropped in the debugger:
87
-
88
- ----
89
- $ bundle exec asciidoctor-revealjs examples/video.adoc
90
- asciidoctor: WARNING: level-sections.adoc: line 29: section title out of sequence: expected level 2, got level 3
91
-
92
- From: /home/olivier/src/asciidoc/asciidoctor-reveal.js/templates/slim/section.html.slim @ line 3 :
93
-
94
- 1: - hide_title = (title = self.title) == '!'
95
- 2: - require 'pry'
96
- => 3: - binding.pry
97
- 4: / parent section of vertical slides set
98
- 5: - if @level == 1 && !(subsections = sections).empty?
99
- 6: section
100
- 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')
101
- 8: - unless hide_title
102
-
103
- [1] pry(#<Asciidoctor::Section>)>
104
- ----
105
-
106
- Then using commands like the following allows you to explore interactively asciidoctor's API and object model with syntax highlighting:
107
-
108
- [1] pry(#<Asciidoctor::Section>)> @document
109
-
110
- You can also query asciidoctor's documentation:
111
-
112
- [4] pry(#<Asciidoctor::Section>)> ? find_by
113
-
114
- If you install the `pry-byebug` gem you get additional debugging capabilities.
115
- See the gem's documentation for details.
116
-
117
- Since 1.1.0, templates are compiled.
118
- It is easier to inject the debug triggering statements and use the templates directly instead of debugging compiled templates.
119
- You can call the slim templates directly with:
120
-
121
- bundle exec asciidoctor-revealjs --trace -T templates/ examples/customcss.adoc
122
-
123
- === References
124
-
125
- * https://github.com/asciidoctor/asciidoctor.org/issues/80#issuecomment-145698579
126
- * http://pryrepl.org/
127
- * http://discuss.asciidoctor.org/Interactively-debugging-a-template-with-a-REPL-td4498.html
128
-
129
- == Manual Tests
130
-
131
- In order to help troubleshoot issues and test syntax improvements, some minimalist asciidoc test files are provided.
132
- You can render the tests files and then load them in a browser and check if `asciidoctor-revealjs` behaves as expected.
133
-
134
- === Initial Setup
135
-
136
- Make sure to have a working version of `asciidoctor-reveals` this is usually
137
- done with `bundler`:
138
-
139
- bundle config --local github.https true
140
- bundle --path=.bundle/gems --binstubs=.bundle/.bin
141
- bundle exec rake build
142
-
143
- Go to `test/doctest` folder and install `reveal.js`:
144
-
145
- cd test/doctest/
146
- git clone https://github.com/hakimel/reveal.js.git
147
-
148
- === Render tests into .html
149
-
150
- From the project's root directory:
151
-
152
- bundle exec rake doctest::generate FORCE=yes
153
-
154
- === Open rendered files
155
-
156
- NOTE: Right now, https://github.com/asciidoctor/asciidoctor-doctest/issues/12[doctest issue #12] means that the generated examples will not be pretty.
157
-
158
- You can open the generated `.html` in `test/doctest/` in a Web browser.
159
-
160
-
161
- == Asciidoctor API's gotchas
162
-
163
- === Attribute inheritence
164
-
165
- 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.
166
-
167
- You only want to enable inheritance if you intend to allow an attribute of the same name to be controlled globally.
168
- That might be good for configuring transitions. For instance:
169
-
170
- ----
171
- = My Slides
172
- :transition-speed: fast
173
-
174
- == First Slide
175
- ----
176
-
177
- However, there may be attributes that you don't want to inherit.
178
- If that's the case, you generally use the form:
179
-
180
- attr('name', nil, false)
181
-
182
- The second parameter value is the default attribute value, which is nil by default.
183
-
184
- Relevant documentation: http://www.rubydoc.info/github/asciidoctor/asciidoctor/Asciidoctor%2FAbstractNode%3Aattr
185
-
186
-
187
- == Merge / Review policy
188
-
189
- Any non-trivial change should be integrated in master via a pull-request.
190
- This gives the community a chance to participate and helps write better code because it encourages people to review their own patches.
191
-
192
- Pull requests should come from personal forks in order not the clutter the upstream repository.
193
-
194
- === Wait time
195
-
196
- Once a pull request is submitted, let it sit for 24-48 hours for small changes.
197
- If you get positive feedback you can merge before the sitting time frame.
198
- If you don't get feedback, just merge after the sitting time frame.
199
-
200
- Larger changes should sit longer at around a week.
201
- Positive feedback or no feedback should be handled like for small changes.
202
-
203
- Breaking changes should sit until a prominent contributor comments on the changes.
204
- Ping `@mojavelinux` and `@obilodeau` if necessary.
205
-
206
- Remember that this is a slower moving project since people are not designing slides everyday.
207
- Well, for most people.
208
-
209
- === Work-in-progress pull-requests
210
-
211
- Letting know to the maintainers that you are working on a feature or a fix is useful.
212
- Early communication often times save time consuming mistakes or avoids duplicated effort.
213
- We encourage contributors to communicate with us early.
214
-
215
- Branches on forks of this project are not very visible to maintainers as much as pull requests (PR).
216
- For this reason we used to recommend sending a PR even if it's not ready and prepend "WIP" in front of its name to let everyone see that you are working on a specific topic.
217
- Now, instead of prepending "WIP", we recommend using GitHub "draft pull request" feature instead.
218
-
219
-
220
- === 'needs review' label
221
-
222
- You can apply that label to a pull request that is complete and ready for review.
223
-
224
- Makes triaging easier.
225
-
226
- == Node package
227
-
228
- === Test a local asciidoctor-reveal.js version
229
-
230
- In order to test the Node package, you first need to build the converter into Javascript and create a tarball of the project.
231
-
232
- $ bundle exec rake build:js
233
- $ npm pack
234
-
235
- That last command will produce a file named `asciidoctor-reveal.js-<version>.tgz` in the working directory.
236
-
237
- Then, create a test project adjacent to the clone of the [.path]_asciidoctor-reveal.js_ repository:
238
-
239
- $ mkdir test-project
240
- $ cd test-project
241
-
242
- Now, install the dependencies from the tarball:
243
-
244
- $ npm i --save ../asciidoctor-reveal.js/asciidoctor-reveal.js-<version>.tgz
245
-
246
- NOTE: The relative portion of the last command is where you are installing the local `asciidoctor-reveal.js` version from.
247
-
248
- Then proceed as documented in the `README.adoc`.
249
-
250
- [[node-binary-compatibility]]
251
- === Binary package compatibility with Asciidoctor.js
252
-
253
- Asciidoctor.js is source-to-source compiled into JavaScript from Ruby using Opal.
254
- The JavaScript generated requires a specific version of the Opal-runtime for it to work with Node.js.
255
- This project is source-to-source compiled into JavaScript from Ruby using Opal too.
256
- In order for Asciidoctor.js to be able to call code from this converter, the versions of Opal (both runtime and compiler) must be compatible.
257
- Right now we track the exact git revision of Opal used by Asciidoctor.js and make sure that we match.
258
- Here is how:
259
-
260
- Versions known to work together can be found by looking at the Asciidoctor.js release notes, just replace <tag> with the `asciidoctor.js` release you are interested in: https://github.com/asciidoctor/asciidoctor.js/releases/tag/<tag>.
261
- Then that Opal version and git revision (if required) must be specified in `asciidoctor-revealjs.gemspec`.
262
-
263
- Starting with 3.0.0 we aim to retain binary compatibility between Asciidoctor.js and Asciidoctor-reveal.js.
264
- This should allow other Asciidoctor extensions to be called along with this converter.
265
- Asciidoctor.js is no longer a direct dependency but should be seen as a tool that powers this converter.
266
- We need to allow users to have flexibility in the version they choose to run.
267
- Asciidoctor.js maintainer told us that he is going to consider binary package incompatibility a major break and so we adjusted our README to tell users to install with a specific version range.
268
-
269
- We will track and maintain the README on the major version supported and recommended:
270
-
271
- * In the link:README.adoc#node-install[version range to install by default] for a given release (and on master)
272
- * In the link:README.adoc#asciidoctorjs-compatibility-matrix[compatibility matrix]
273
-
274
- See https://github.com/asciidoctor/asciidoctor-reveal.js/issues/187#issuecomment-570771473[this issue] for background details on that topic.
275
-
276
- Asciidoctor.js versioning policy is https://asciidoctor-docs.netlify.com/asciidoctor.js/project/version-and-lifecycle-policies/[available here].
277
-
278
- === Debugging
279
-
280
- To debug the JavaScript application, just add `--node-arg=--inspect-brk` to the npx command to run the application.
281
- For example:
282
-
283
- npx --node-arg=--inspect-brk asciidoctor-revealjs -v presentation.adoc
284
-
285
- Then open the Chrome Dev Tools and click on the Node logo in the top left corner.
286
-
287
-
288
- == RubyGem package
289
-
290
- [[ruby-localversion]]
291
- === Test a local asciidoctor-revealjs version
292
-
293
- Compile the converter:
294
-
295
- $ bundle exec rake build
296
-
297
- In a clean directory besides the `asciidoctor-reveal.js` repository, create the following `Gemspec` file:
298
-
299
- source 'https://rubygems.org'
300
- gem 'asciidoctor-revealjs', :path => '../asciidoctor-reveal.js'
301
-
302
- Then run:
303
-
304
- $ bundle --path=.bundle/gems --binstubs=.bundle/.bin
305
-
306
-
307
- == Release process
308
-
309
-
310
- . Make sure that the highlight plugin code embed in _lib/asciidoctor-revealjs/highlightjs.rb_ is up-to-date with the version of reveal.js
311
- . Do we need to do anything regarding our Opal dependency and Asciidoctor.js?
312
- See <<node-binary-compatibility,our section on the topic>>.
313
- . Update dependencies and test the package in both languages
314
- +
315
- bundle update
316
- bundle exec rake build
317
- bundle exec rake test
318
- bundle exec rake examples:convert
319
- npm install
320
- npm update --no-save
321
- bundle exec rake build:js
322
- npm test
323
- npm run examples
324
-
325
- . Commit the updated dependencies
326
- . Update the version in `lib/asciidoctor-revealjs/version.rb` and `package.json`
327
- . Update the changelog
328
- ** Generate author list with:
329
- +
330
- git log <prev-version-tag>.. --format="%aN" --reverse | perl -e 'my %dedupe; while (<STDIN>) { print unless $dedupe{$_}++}' | sort
331
-
332
- . Prepare release commit
333
- ** Add the "Slim compiled to Ruby" converter to the git tree (otherwise ignored to avoid noise to the repo)
334
- +
335
- bundle exec rake build
336
- git add -f lib/asciidoctor-revealjs/converter.rb
337
-
338
- ** commit msg: Prepare %version% release
339
- ** release commit (--allow-empty) msg: Release %version%
340
- . Tag the release commit
341
- ** Annotated Tag msg: Version %version%
342
- . Push your changes (including the tag)
343
- . Make a release on github (from changelog and copy from previous releases)
344
- ** Useful vim regex for AsciiDoc to Markdown:
345
- +
346
- :%s/{uri-issue}\(\d\+\)\[#\d\+]/#\1/gc
347
- :%s/{project-name}/asciidoctor-reveal.js/gc
348
- :%s/\(.*\)::/### \1/gc
349
- :%s/{uri-repo}/https:\/\/github.com\/asciidoctor\/asciidoctor-reveal.js/gc
350
-
351
- ** Save as draft
352
-
353
- . Pushing the gem on rubygems.org:
354
- +
355
- $ bundle exec rake build
356
- $ gem build asciidoctor-revealjs.gemspec
357
- $ gem push asciidoctor-revealjs-X.Y.Z.gem
358
-
359
- . Check that the new version is available on https://rubygems.org/gems/asciidoctor-revealjs[rubygems.org]
360
- . Generate the javascript version of the Ruby converter
361
- +
362
- $ bundle exec rake build:js
363
-
364
- . Publish the node package on npm:
365
- +
366
- $ npm login # only required if not already authenticated
367
- $ npm publish
368
-
369
- . Check that the new version is available on https://www.npmjs.com/package/@asciidoctor/reveal.js[npmjs.com]
370
- . Make binaries release
371
- ** Run `npm run package`. Binaries built will be in `dist/`. Upload them to the GitHub release page.
372
- . Publish previously saved GitHub release draft
373
- . Update version in `lib/asciidoctor-revealjs/version.rb` and `package.json` (+1 bugfix and append '-dev')
374
- ** Remove the "Slim compiled to Ruby" converter to the git tree (to avoid noise to the repo and `git status` noise)
375
- +
376
- git rm --cached lib/asciidoctor-revealjs/converter.rb
377
-
378
- ** commit msg: Begin development on next release
379
- . Submit a PR upstream to sync the documentation on asciidoctor.org
380
- ** Modify this page: https://github.com/asciidoctor/asciidoctor.org/edit/master/docs/asciidoctor-revealjs.adoc
381
- . Submit a PR downstream to update Asciidoctor reveal.js version inside docker-asciidoctor
382
- ** Modify the `Dockerfile`, `Makefile` and `README.adoc` of: https://github.com/asciidoctor/docker-asciidoctor
383
- . Submit a PR downstream to update AsciidoctorJ reveal.js version
384
- ** Modify `gradle.properties`, `asciidoctorj-revealjs/gradle.properties` and `asciidoctorj-revealjs/build.gradle` in: https://github.com/asciidoctor/asciidoctorj-reveal.js
385
-
386
- == Ruby and asciidoctor-doctest tests
387
-
388
- === Running tests
389
-
390
- We recommend tests to be run with a fresh install of all dependencies in a local folder that won't affect your ruby install (a `.bundle/` in this directory):
391
-
392
- bundle --path=.bundle/gems --binstubs=.bundle/.bin
393
-
394
- Then you can execute the tests with:
395
-
396
- bundle exec rake doctest
397
-
398
- However, if you have all dependencies properly installed this command should run the tests successfully:
399
-
400
- rake doctest
401
-
402
- === Generating HTML test target
403
-
404
- Tests were bootstrapped by https://github.com/asciidoctor/asciidoctor-doctest/#generate-examples[generating them from asciidoctor-doctest's test corpus] and current asciidoctor-revealjs' slim template engine.
405
- This is done using the following command:
406
-
407
- bundle exec rake doctest:generate FORCE=y
408
-
409
- === Custom tests
410
-
411
- Files in the `examples/` directory are used as tests.
412
- Resulting slides are kept in `test/doctest/`.