asciidoctor-doctest 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.adoc +0 -0
  3. data/LICENSE +21 -0
  4. data/README.adoc +327 -0
  5. data/Rakefile +12 -0
  6. data/data/examples/asciidoc/block_admonition.adoc +27 -0
  7. data/data/examples/asciidoc/block_audio.adoc +13 -0
  8. data/data/examples/asciidoc/block_colist.adoc +46 -0
  9. data/data/examples/asciidoc/block_dlist.adoc +99 -0
  10. data/data/examples/asciidoc/block_example.adoc +21 -0
  11. data/data/examples/asciidoc/block_floating_title.adoc +27 -0
  12. data/data/examples/asciidoc/block_image.adoc +28 -0
  13. data/data/examples/asciidoc/block_listing.adoc +68 -0
  14. data/data/examples/asciidoc/block_literal.adoc +30 -0
  15. data/data/examples/asciidoc/block_olist.adoc +55 -0
  16. data/data/examples/asciidoc/block_open.adoc +40 -0
  17. data/data/examples/asciidoc/block_outline.adoc +60 -0
  18. data/data/examples/asciidoc/block_page_break.adoc +6 -0
  19. data/data/examples/asciidoc/block_paragraph.adoc +17 -0
  20. data/data/examples/asciidoc/block_pass.adoc +5 -0
  21. data/data/examples/asciidoc/block_preamble.adoc +19 -0
  22. data/data/examples/asciidoc/block_quote.adoc +30 -0
  23. data/data/examples/asciidoc/block_sidebar.adoc +22 -0
  24. data/data/examples/asciidoc/block_stem.adoc +28 -0
  25. data/data/examples/asciidoc/block_table.adoc +168 -0
  26. data/data/examples/asciidoc/block_thematic_break.adoc +2 -0
  27. data/data/examples/asciidoc/block_toc.adoc +50 -0
  28. data/data/examples/asciidoc/block_ulist.adoc +43 -0
  29. data/data/examples/asciidoc/block_verse.adoc +37 -0
  30. data/data/examples/asciidoc/block_video.adoc +24 -0
  31. data/data/examples/asciidoc/document.adoc +51 -0
  32. data/data/examples/asciidoc/embedded.adoc +10 -0
  33. data/data/examples/asciidoc/inline_anchor.adoc +27 -0
  34. data/data/examples/asciidoc/inline_break.adoc +8 -0
  35. data/data/examples/asciidoc/inline_button.adoc +3 -0
  36. data/data/examples/asciidoc/inline_callout.adoc +5 -0
  37. data/data/examples/asciidoc/inline_footnote.adoc +9 -0
  38. data/data/examples/asciidoc/inline_image.adoc +44 -0
  39. data/data/examples/asciidoc/inline_kbd.adoc +7 -0
  40. data/data/examples/asciidoc/inline_menu.adoc +11 -0
  41. data/data/examples/asciidoc/inline_quoted.adoc +59 -0
  42. data/data/examples/asciidoc/section.adoc +74 -0
  43. data/doc/img/doctest-diag.odf +0 -0
  44. data/doc/img/doctest-diag.svg +56 -0
  45. data/doc/img/failing-test-term.gif +0 -0
  46. data/lib/asciidoctor-doctest.rb +1 -0
  47. data/lib/asciidoctor/doctest.rb +30 -0
  48. data/lib/asciidoctor/doctest/asciidoc/examples_suite.rb +44 -0
  49. data/lib/asciidoctor/doctest/asciidoc_renderer.rb +103 -0
  50. data/lib/asciidoctor/doctest/base_example.rb +161 -0
  51. data/lib/asciidoctor/doctest/base_examples_suite.rb +188 -0
  52. data/lib/asciidoctor/doctest/core_ext.rb +49 -0
  53. data/lib/asciidoctor/doctest/generator.rb +63 -0
  54. data/lib/asciidoctor/doctest/generator_task.rb +111 -0
  55. data/lib/asciidoctor/doctest/html/example.rb +21 -0
  56. data/lib/asciidoctor/doctest/html/examples_suite.rb +111 -0
  57. data/lib/asciidoctor/doctest/html/html_beautifier.rb +17 -0
  58. data/lib/asciidoctor/doctest/html/normalizer.rb +118 -0
  59. data/lib/asciidoctor/doctest/minitest_diffy.rb +74 -0
  60. data/lib/asciidoctor/doctest/test.rb +120 -0
  61. data/lib/asciidoctor/doctest/version.rb +5 -0
  62. data/spec/asciidoc/examples_suite_spec.rb +99 -0
  63. data/spec/base_example_spec.rb +176 -0
  64. data/spec/core_ext_spec.rb +67 -0
  65. data/spec/html/examples_suite_spec.rb +249 -0
  66. data/spec/html/normalizer_spec.rb +70 -0
  67. data/spec/shared_examples/base_examples_suite.rb +262 -0
  68. data/spec/spec_helper.rb +33 -0
  69. data/spec/support/matchers.rb +7 -0
  70. data/spec/test_spec.rb +164 -0
  71. metadata +360 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bc9498892db6acc24257809bff779818ee7472f4
4
+ data.tar.gz: a8a13d69add1fe26c44d6bb14c5931e521f73aff
5
+ SHA512:
6
+ metadata.gz: 3afb3a87af3908787ca1a3b6e450217ee6e38e4b3fd7d454c2547d60197b3f657b2b5efe024e1fb4317dd77660df9421896905806df9829ea125e3393a51f607
7
+ data.tar.gz: ffa8177c85f0437636060d786b2174cb4dbb42624b17b45cfa4b81c38fc8bd030f35ae36bb9fc3e6918efc7efda4ed0aed336277cb718fcb54582629da797556
data/CHANGELOG.adoc ADDED
File without changes
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright 2014 Jakub Jirutka <jakub@jirutka.cz> 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.
data/README.adoc ADDED
@@ -0,0 +1,327 @@
1
+ = Asciidoctor::DocTest
2
+ Jakub Jirutka <https://github.com/jirutka[@jirutka]>
3
+ :page-layout: base
4
+ :idprefix:
5
+ ifdef::env-github[:idprefix: user-content-]
6
+ :idseparator: -
7
+ :source-language: ruby
8
+ :language: {source-language}
9
+ // links
10
+ :doctor-man-uri: http://asciidoctor.org/docs/user-manual
11
+ :src-base: lib/asciidoctor/doctest
12
+
13
+ image:https://travis-ci.org/asciidoctor/asciidoctor-doctest.svg?branch=master[Build Status, link=https://travis-ci.org/asciidoctor/asciidoctor-doctest]
14
+ image:https://codeclimate.com/github/asciidoctor/asciidoctor-doctest/badges/coverage.svg[Test Coverage, link="https://codeclimate.com/github/asciidoctor/asciidoctor-doctest"]
15
+ image:https://codeclimate.com/github/asciidoctor/asciidoctor-doctest/badges/gpa.svg[Code Climate, link="https://codeclimate.com/github/asciidoctor/asciidoctor-doctest"]
16
+ image:http://inch-ci.org/github/asciidoctor/asciidoctor-doctest.svg?branch=master[Inline docs, link="http://inch-ci.org/github/asciidoctor/asciidoctor-doctest"]
17
+ image:https://badge.fury.io/rb/asciidoctor-doctest.svg[Gem Version, link="http://badge.fury.io/rb/asciidoctor-doctest"]
18
+ image:https://img.shields.io/badge/yard-docs-blue.svg[Yard Docs, link="http://www.rubydoc.info/github/asciidoctor/asciidoctor-doctest/frames"]
19
+
20
+ DocTest is a tool for end-to-end testing of Asciidoctor _backends_ based on comparing of textual output.
21
+
22
+ It provides a collection of categorized <<input-examples, input _examples_>> (documents in AsciiDoc syntax) to simplify and systematize writing tests for new backends.
23
+ You just write or <<generate-examples, generate>> the expected output, i.e. what the backend should produce for the given input.
24
+
25
+ image::https://cdn.rawgit.com/asciidoctor/asciidoctor-doctest/master/doc/img/doctest-diag.svg[diagram, align="center"]
26
+
27
+ Each example should be focused on one use case, so when writing a new backend, you can incrementally implement new features following the reference input examples.
28
+ However, they are not strictly isolated like unit tests.
29
+ For example, if you change a format of a paragraph, it may affect a variety of other examples.
30
+
31
+ When test fails, DocTest prints a nicely formatted diff of the expected and actual output (see <<run-tests>>), so you see exactly what went wrong.
32
+ Insignificant differences, such as attributes order in HTML, are ignored.
33
+
34
+ DocTest supports HTML-based backends and can be easily <<how-to-extend-it, extended>> to support any other backend with textual output.
35
+
36
+
37
+ == Setup DocTest
38
+
39
+ Let’s say that you’re developing a new shiny HTML template-based backend named “shiny” and assume that you have templates in the directory `data/templates`.
40
+
41
+ . Create a directory for your output examples:
42
+ +
43
+ [source, sh]
44
+ mkdir -p test/examples/shiny
45
+ +
46
+ and optionally a directory for your extra input examples:
47
+ +
48
+ [source, sh]
49
+ mkdir -p test/examples/asciidoc
50
+
51
+ . Add development dependency on `asciidoctor-doctest` to your gemspec:
52
+ +
53
+ [source]
54
+ s.add_development_dependency 'asciidoctor-doctest', '~> 1.5'
55
+ +
56
+ or Gemfile if you’re not distributing the backend as a gem:
57
+ +
58
+ [source]
59
+ gem 'asciidoctor-doctest', '~> 1.5'
60
+ +
61
+ and run `bundle install`.
62
+
63
+ . Create or edit `test/test_helper.rb`; require test dependencies and setup `examples_path`:
64
+ +
65
+ [source]
66
+ ----
67
+ require 'asciidoctor/doctest'
68
+ require 'minitest/autorun'
69
+
70
+ # used to colorize output
71
+ require 'minitest/rg'
72
+
73
+ # needed if you're testing templates-based backend
74
+ require 'tilt'
75
+
76
+ # extra input examples (optional)
77
+ DocTest.examples_path.unshift 'test/examples/asciidoc'
78
+
79
+ # output examples
80
+ DocTest.examples_path.unshift 'test/examples/shiny'
81
+ ----
82
+
83
+ . Create test file `test/templates_test.rb` and extend class link:{src-base}/test.rb[DocTest::Test]. Specify `renderer_opts` and then call `generate_tests!` macro with a specific subclass of `BaseExamplesSuite`:
84
+ +
85
+ [source]
86
+ ----
87
+ require 'test_helper'
88
+
89
+ class TestTemplates < DocTest::Test
90
+ renderer_opts template_dirs: 'data/templates'
91
+ generate_tests! DocTest::HTML::ExamplesSuite
92
+ end
93
+ ----
94
+
95
+ . Create or edit `Rakefile`; add tasks to run tests and optionally a generator of output examples:
96
+ +
97
+ [source]
98
+ ----
99
+ require 'asciidoctor/doctest'
100
+ require 'rake/testtask'
101
+ require 'thread_safe'
102
+ require 'tilt'
103
+
104
+ Rake::TestTask.new(:test) do |task|
105
+ task.description = 'Run tests for templates'
106
+ task.pattern = 'test/templates_test.rb'
107
+ task.libs << 'test'
108
+ end
109
+
110
+ DocTest::GeneratorTask.new(:generate) do |task|
111
+ task.output_suite = DocTest::HTML::ExamplesSuite.new(examples_path: 'test/examples/shiny')
112
+ task.renderer_opts[:template_dirs] = 'data/templates'
113
+ #
114
+ # add extra input examples (optional)
115
+ task.examples_path.unshift 'test/examples/asciidoc'
116
+ end
117
+
118
+ # When no task specified, run test.
119
+ task :default => :test
120
+ ----
121
+
122
+
123
+ == Run tests
124
+
125
+ Assume that you have defined the test Rake task named `:test` (see above).
126
+ Then you can simply run:
127
+
128
+ [source, sh]
129
+ bundle exec rake test
130
+
131
+ image::doc/img/failing-test-term.gif[Failing test in term, align="center"]
132
+
133
+
134
+ == Examples
135
+
136
+ Test _example_ is just a document fragment in AsciiDoc syntax (a reference input), or the backend’s target syntax (an expected output).
137
+ Example should consider one case of the generated output, i.e. it should reflect one code branch in a converter or template.
138
+ Examples are grouped in _example groups_.
139
+ Each group focuses on one block or inline element — more precisely Asciidoctor’s AST node (paragraph, table, anchor, footnote…).
140
+
141
+ Examples group is a text file named similar to Asciidoctor templates, i.e. the AST node name with an extension according to syntax, for example `block_table.adoc`, `block_table.html`. See below for a list of the AST nodes.
142
+ Individual examples in the group file are separated by a special header with the name of the example, an optional description and options.
143
+
144
+ Each example is identified by its name and the group name like this: `{group_name}:{example_name}` (e.g. `block_table:with_title`).
145
+ Input and output examples are paired — for every input example there should be an output example with the same identifier.
146
+ When you <<run-tests, run tests>>, the input example is converted using the tested backend (or templates) and its actual output is compared with the expected output example.
147
+
148
+ [horizontal]
149
+ .List of Asciidoctor’s AST nodes
150
+ document:: TODO
151
+ embedded:: TODO
152
+ section:: {doctor-man-uri}/#sections[document sections], i.e. headings
153
+ block_admonition:: {doctor-man-uri}/#admonition[an admonition block]
154
+ block_audio:: {doctor-man-uri}/#audio[an audio block]
155
+ block_colist:: {doctor-man-uri}/#callouts[a code callouts] list
156
+ block_dlist:: {doctor-man-uri}/#labeled-list[a labeled list] (aka definition list) and {doctor-man-uri}/#question-and-answer-style-list[a Q&A style list]
157
+ block_example:: {doctor-man-uri}/#example[an example block]
158
+ block_floating_title:: {doctor-man-uri}/#discrete-or-floating-section-titles[a discrete or floating section title]
159
+ block_image:: {doctor-man-uri}/#images[an image block]
160
+ block_listing:: {doctor-man-uri}/#listing-blocks[a listing and source code block]
161
+ block_literal:: {doctor-man-uri}/#literal-text-and-blocks[a literal block]
162
+ block_olist:: {doctor-man-uri}/#ordered-lists[an ordered list] (i.e. numbered list)
163
+ block_open:: {doctor-man-uri}/#open-blocks[open blocks], {doctor-man-uri}/#user-abstractabstract[abstract], …
164
+ block_outline:: an actual {doctor-man-uri}/#user-toc[TOC] content (i.e. list of links), usually recursively called
165
+ block_page_break:: {doctor-man-uri}/#page-break[page break]
166
+ block_paragraph:: {doctor-man-uri}/#paragraph[a paragraph]
167
+ block_pass:: {doctor-man-uri}/#pass-bl[a passthrough block]
168
+ block_preamble:: {doctor-man-uri}/#doc-preamble[a preamble], optionally with a TOC
169
+ block_quote:: {doctor-man-uri}/#quote[a quote block]
170
+ block_sidebar:: {doctor-man-uri}/#sidebar[a sidebar]
171
+ block_stem:: {doctor-man-uri}/#stem[a STEM block] (Science, Technology, Engineering and Math)
172
+ block_table:: {doctor-man-uri}/#tables[a table]
173
+ block_thematic_break:: {doctor-man-uri}/#horizontal-rules[a thematic break] (i.e. horizontal rule)
174
+ block_toc:: {doctor-man-uri}/#manual-placement[a TOC macro] (i.e. manually placed TOC); This block is used for `toc::[]` macro only and it’s responsible just for rendering of a the TOC “envelope,” not an actual TOC content.
175
+ block_ulist:: {doctor-man-uri}/#unordered-lists[an unordered list] (aka bullet list) and a {doctor-man-uri}/#checklist[checklist] (e.g. TODO list)
176
+ block_verse:: {doctor-man-uri}/#verse[a verse block]
177
+ block_video:: {doctor-man-uri}/#video[a video block]
178
+ inline_anchor:: {doctor-man-uri}/#url[anchors] (links, cross references and bibliography references)
179
+ inline_break:: {doctor-man-uri}/#line-breaks[line break]
180
+ inline_button:: {doctor-man-uri}/#ui-buttons[UI button]
181
+ inline_callout:: {doctor-man-uri}/#callouts[code callout] icon/mark inside a code block
182
+ inline_footnote:: {doctor-man-uri}/#user-footnotes[footnote]
183
+ inline_image:: {doctor-man-uri}/#images[inline image] and {doctor-man-uri}/#inline-icons[inline icon]
184
+ inline_kbd:: {doctor-man-uri}/#keyboard-shortcuts[keyboard shortcut]
185
+ inline_menu:: {doctor-man-uri}/#menu-selections[menu section]
186
+ inline_quoted:: {doctor-man-uri}/#quotes[text formatting]; emphasis, strong, monospaced, superscript, subscript, curved quotes and inline STEM
187
+
188
+
189
+ === Input examples
190
+
191
+ DocTest provides a collection of the reference input examples that should be suitable for most backends.
192
+ You can find them in link:data/examples/asciidoc[].footnote:[Since GitHub implicitly renders them as a plain AsciiDoc, you must view a Raw source if you want to see what’s going on there.]
193
+ There are a lot of test examples and some of them may not be relevant to your backend — that’s okay, when some output example is not found, it’s marked as skipped in test.
194
+
195
+ You can also write your own input examples and use them together with those provided (or replace them).
196
+ Just add another directory to your examples_path (e.g. `test/examples/asciidoc`) and create example group files with `.adoc` suffix here (e.g. `block_video.adoc`).
197
+ When DocTest is looking for examples to test, it indexes all examples found in files with `.adoc` suffix on the examples_path.
198
+ If there are two files with the same name, it simply merges their content, and if they contain two examples with the same name, then the first wins (i.e. that from the file that is ahead on the examples_path).
199
+
200
+ ==== Format
201
+
202
+ [source, asciidoc]
203
+ ----
204
+ // .first_example
205
+ // Each block must be preceded by a header (comment); the first line must
206
+ // contain the example’s name prefixed with a dot. This text is interpreted
207
+ // as a description.
208
+ The example’s content in *Asciidoc*.
209
+
210
+ NOTE: The trailing new line (below this) will be removed.
211
+
212
+ // .second_example
213
+ * List item level 1
214
+ ** List item level 2
215
+
216
+ ----
217
+
218
+ === HTML-based examples
219
+
220
+ HtmlTest assumes that paragraphs are enclosed in `<p></p>` tags and implicitly sets the _include_ option to `./p/node()` for `inline_*:*` examples (if _include_ is not already set).
221
+ If it’s not your case, then you must overwrite it:
222
+
223
+ [source]
224
+ ----
225
+ class TestShiny < DocTest::Test
226
+ renderer_opts template_dirs: 'data/templates'
227
+ generate_tests! DocTest::HTML::ExamplesSuite.new(paragraph_xpath: './div/p/node()')
228
+ end
229
+ ----
230
+
231
+ ==== Options
232
+
233
+ List of options that can be set in the header of HTML example.
234
+
235
+ include::
236
+ XPath expression that specifies a subsection of the document that should be
237
+ compared (asserted). Default is `./p/node()` for `inline_*:*` groups and
238
+ empty (i.e. `.`) for others.
239
+ exclude::
240
+ XPath expression that specifies parts of the document that should _not_ be
241
+ compared (asserted). Always start the expression with a dot (e.g. `.//h1`).
242
+ This option may be used multiple times per example.
243
+ header_footer::
244
+ Option for Asciidoctor to render a full document (instead of embedded).
245
+ This is default for `document:*` group.
246
+
247
+ ==== Format
248
+
249
+ [source, html]
250
+ ----
251
+ <!-- .first_example
252
+ Each example must be preceded by a header (comment); the first line must
253
+ contain the example’s name prefixed with a dot. This text is interpreted
254
+ as a description.
255
+ -->
256
+ <p>The example’s content in <strong>HTML</strong>.</p>
257
+
258
+ <div class="note">The trailing new line (below this) will be removed.</div>
259
+
260
+ <!-- .second_example
261
+ You may also specify options for comparing or Asciidoctor renderer. Option
262
+ line starts with a semicolon, then comes the option name ended by a
263
+ semicolon and after that the option’s value (may be omitted for boolean
264
+ options).
265
+ :option_1: value 1
266
+ :option_2: value 1
267
+ :option_2: value 2
268
+ :boolean_option:
269
+ -->
270
+ <div class="colist">
271
+ <ol>
272
+ <li>Method signature</li>
273
+ <li>Some stuff inside</li>
274
+ <li>Return statement</li>
275
+ </ol>
276
+ </div>
277
+
278
+ ----
279
+
280
+
281
+ === Generate examples
282
+
283
+ Writing examples of an expected output for all the input examples from scratch is quite a chore.
284
+ Therefore DocTest provides a generator.
285
+ When you have at least partially working Asciidoctor _backend_ (converter or a set of templates), you can pass the input examples through it and generate your output examples.
286
+ Then you should verify them and modify if needed.
287
+
288
+ Assume that you have defined the generator Rake task named `:generator` (see <<setup-doctest>>).
289
+
290
+ Now you can generate output examples from all the input examples (those with `.adoc` extension) found on the examples_path that doesn’t already exist (i.e. it doesn’t rewrite existing):
291
+
292
+ [source, sh]
293
+ bundle exec rake generate
294
+
295
+ Same as previous, but rewrite existing tested examples:
296
+
297
+ [source, sh]
298
+ bundle exec rake generate FORCE=yes
299
+
300
+ Generate just examples for `block_ulist` node (i.e. all examples in `block_ulist.adoc` file(s) found on the examples_path) that doesn’t exist yet:
301
+
302
+ [source, sh]
303
+ bundle exec rake generate PATTERN='block_ulist:*'
304
+
305
+ (Re)generate examples which name starts with `basic` for all _block_ nodes (i.e. files that starts with `block_`):
306
+
307
+ [source, sh]
308
+ bundle exec rake generate PATTERN='block_*:basic*' FORCE=yes
309
+
310
+
311
+ == How to extend it
312
+
313
+ You can extend DocTest to support any textual format you want.
314
+ All what you need is to subclass link:{src-base}/base_examples_suite.rb[BaseExamplesSuite] and usually also link:{src-base}/base_example.rb[BaseExample].
315
+
316
+
317
+ == Contributing
318
+
319
+ . Fork it
320
+ . Create your feature branch (`git checkout -b my-new-feature`)
321
+ . Commit your changes (`git commit -am 'Add some feature'`)
322
+ . Push to the branch (`git push origin my-new-feature`)
323
+ . Create new Pull Request
324
+
325
+ == License
326
+
327
+ This project is licensed under http://opensource.org/licenses/MIT/[MIT License]. For the full text of the license, see the link:LICENSE[LICENSE] file.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :test => :spec
9
+ task :default => :spec
10
+ rescue LoadError
11
+ warn 'no rspec available'
12
+ end
@@ -0,0 +1,27 @@
1
+ // .basic
2
+ WARNING: Watch out for dragons!
3
+
4
+ // .basic_multiline
5
+ NOTE: An admonition paragraph draws the reader's attention to
6
+ auxiliary information.
7
+ Its purpose is determined by the label
8
+ at the beginning of the paragraph.
9
+
10
+ // .block
11
+ [IMPORTANT]
12
+ ====
13
+ While werewolves are hardy community members, keep in mind some dietary concerns.
14
+ ====
15
+
16
+ // .block_with_title
17
+ [IMPORTANT]
18
+ .Feeding the Werewolves
19
+ ====
20
+ While werewolves are hardy community members, keep in mind some dietary concerns.
21
+ ====
22
+
23
+ // .block_with_id_and_role
24
+ [IMPORTANT, id=werewolve, role=member]
25
+ ====
26
+ While werewolves are hardy community members, keep in mind some dietary concerns.
27
+ ====
@@ -0,0 +1,13 @@
1
+ // .basic
2
+ audio::ocean_waves.mp3[]
3
+
4
+ // .with_all_options
5
+ audio::ocean_waves.mp3[options="autoplay, nocontrols, loop"]
6
+
7
+ // .with_title
8
+ .Waves!
9
+ audio::ocean_waves.mp3[]
10
+
11
+ // .with_id_and_role
12
+ [#ocean.wave]
13
+ audio::ocean_waves.mp3[]
@@ -0,0 +1,46 @@
1
+ // .basic
2
+ // This example should assert only callouts list below the code listing.
3
+ // For callouts inside the listing is responsible inline_callout.
4
+ [source, ruby]
5
+ ----
6
+ require 'sinatra' // <1>
7
+
8
+ get '/hi' do # <2>
9
+ "Hello World!" ;; <3>
10
+ end
11
+ ----
12
+ <1> Library import
13
+ <2> URL mapping
14
+ <3> Content for response
15
+
16
+ // .with_title
17
+ // This example should assert only callouts list below the code listing.
18
+ // For callouts inside the listing is responsible inline_callout.
19
+ [source, ruby]
20
+ ----
21
+ require 'sinatra' // <1>
22
+
23
+ get '/hi' do # <2>
24
+ "Hello World!" ;; <3>
25
+ end
26
+ ----
27
+ .Description
28
+ <1> Library import
29
+ <2> URL mapping
30
+ <3> Content for response
31
+
32
+ // .with_id_and_role
33
+ // This example should assert only callouts list below the code listing.
34
+ // For callouts inside the listing is responsible inline_callout.
35
+ [source, ruby]
36
+ ----
37
+ require 'sinatra' // <1>
38
+
39
+ get '/hi' do # <2>
40
+ "Hello World!" ;; <3>
41
+ end
42
+ ----
43
+ [#call.sinatra]
44
+ <1> Library import
45
+ <2> URL mapping
46
+ <3> Content for response