asciidoctor-doctest 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.adoc +0 -0
- data/LICENSE +21 -0
- data/README.adoc +327 -0
- data/Rakefile +12 -0
- data/data/examples/asciidoc/block_admonition.adoc +27 -0
- data/data/examples/asciidoc/block_audio.adoc +13 -0
- data/data/examples/asciidoc/block_colist.adoc +46 -0
- data/data/examples/asciidoc/block_dlist.adoc +99 -0
- data/data/examples/asciidoc/block_example.adoc +21 -0
- data/data/examples/asciidoc/block_floating_title.adoc +27 -0
- data/data/examples/asciidoc/block_image.adoc +28 -0
- data/data/examples/asciidoc/block_listing.adoc +68 -0
- data/data/examples/asciidoc/block_literal.adoc +30 -0
- data/data/examples/asciidoc/block_olist.adoc +55 -0
- data/data/examples/asciidoc/block_open.adoc +40 -0
- data/data/examples/asciidoc/block_outline.adoc +60 -0
- data/data/examples/asciidoc/block_page_break.adoc +6 -0
- data/data/examples/asciidoc/block_paragraph.adoc +17 -0
- data/data/examples/asciidoc/block_pass.adoc +5 -0
- data/data/examples/asciidoc/block_preamble.adoc +19 -0
- data/data/examples/asciidoc/block_quote.adoc +30 -0
- data/data/examples/asciidoc/block_sidebar.adoc +22 -0
- data/data/examples/asciidoc/block_stem.adoc +28 -0
- data/data/examples/asciidoc/block_table.adoc +168 -0
- data/data/examples/asciidoc/block_thematic_break.adoc +2 -0
- data/data/examples/asciidoc/block_toc.adoc +50 -0
- data/data/examples/asciidoc/block_ulist.adoc +43 -0
- data/data/examples/asciidoc/block_verse.adoc +37 -0
- data/data/examples/asciidoc/block_video.adoc +24 -0
- data/data/examples/asciidoc/document.adoc +51 -0
- data/data/examples/asciidoc/embedded.adoc +10 -0
- data/data/examples/asciidoc/inline_anchor.adoc +27 -0
- data/data/examples/asciidoc/inline_break.adoc +8 -0
- data/data/examples/asciidoc/inline_button.adoc +3 -0
- data/data/examples/asciidoc/inline_callout.adoc +5 -0
- data/data/examples/asciidoc/inline_footnote.adoc +9 -0
- data/data/examples/asciidoc/inline_image.adoc +44 -0
- data/data/examples/asciidoc/inline_kbd.adoc +7 -0
- data/data/examples/asciidoc/inline_menu.adoc +11 -0
- data/data/examples/asciidoc/inline_quoted.adoc +59 -0
- data/data/examples/asciidoc/section.adoc +74 -0
- data/doc/img/doctest-diag.odf +0 -0
- data/doc/img/doctest-diag.svg +56 -0
- data/doc/img/failing-test-term.gif +0 -0
- data/lib/asciidoctor-doctest.rb +1 -0
- data/lib/asciidoctor/doctest.rb +30 -0
- data/lib/asciidoctor/doctest/asciidoc/examples_suite.rb +44 -0
- data/lib/asciidoctor/doctest/asciidoc_renderer.rb +103 -0
- data/lib/asciidoctor/doctest/base_example.rb +161 -0
- data/lib/asciidoctor/doctest/base_examples_suite.rb +188 -0
- data/lib/asciidoctor/doctest/core_ext.rb +49 -0
- data/lib/asciidoctor/doctest/generator.rb +63 -0
- data/lib/asciidoctor/doctest/generator_task.rb +111 -0
- data/lib/asciidoctor/doctest/html/example.rb +21 -0
- data/lib/asciidoctor/doctest/html/examples_suite.rb +111 -0
- data/lib/asciidoctor/doctest/html/html_beautifier.rb +17 -0
- data/lib/asciidoctor/doctest/html/normalizer.rb +118 -0
- data/lib/asciidoctor/doctest/minitest_diffy.rb +74 -0
- data/lib/asciidoctor/doctest/test.rb +120 -0
- data/lib/asciidoctor/doctest/version.rb +5 -0
- data/spec/asciidoc/examples_suite_spec.rb +99 -0
- data/spec/base_example_spec.rb +176 -0
- data/spec/core_ext_spec.rb +67 -0
- data/spec/html/examples_suite_spec.rb +249 -0
- data/spec/html/normalizer_spec.rb +70 -0
- data/spec/shared_examples/base_examples_suite.rb +262 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/matchers.rb +7 -0
- data/spec/test_spec.rb +164 -0
- metadata +360 -0
@@ -0,0 +1,99 @@
|
|
1
|
+
// .basic
|
2
|
+
Asciidoctor:: An implementation of the AsciiDoc processor in Ruby.
|
3
|
+
Asciidoc::
|
4
|
+
A text document format for writing notes, documentation, articles, books,
|
5
|
+
ebooks, slideshows, web pages, man pages and blogs.
|
6
|
+
|
7
|
+
// .basic_block
|
8
|
+
About::
|
9
|
+
* An implementation of the AsciiDoc processor in Ruby.
|
10
|
+
* Fast text processor and publishing toolchain.
|
11
|
+
|
12
|
+
Authors::
|
13
|
+
Asciidoctor is lead by Dan Allen and Sarah White and has received contributions
|
14
|
+
from many other individuals in Asciidoctor’s awesome community.
|
15
|
+
+
|
16
|
+
AsciiDoc was started by Stuart Rackham.
|
17
|
+
|
18
|
+
// .basic_missing_description
|
19
|
+
Definition without a description::
|
20
|
+
|
21
|
+
// .basic_with_title
|
22
|
+
.Asciidoctor
|
23
|
+
License:: MIT
|
24
|
+
|
25
|
+
// .basic_with_id_and_role
|
26
|
+
[#licenses.open]
|
27
|
+
License:: MIT
|
28
|
+
|
29
|
+
// .qanda
|
30
|
+
[qanda]
|
31
|
+
What is Asciidoctor?::
|
32
|
+
An implementation of the AsciiDoc processor in Ruby.
|
33
|
+
What is the answer to the Ultimate Question?:: 42
|
34
|
+
|
35
|
+
// .qanda_block
|
36
|
+
[qanda]
|
37
|
+
What is Asciidoctor?::
|
38
|
+
* An implementation of the AsciiDoc processor in Ruby.
|
39
|
+
* Fast text processor and publishing toolchain.
|
40
|
+
|
41
|
+
Who is behind Asciidoctor?::
|
42
|
+
Asciidoctor is lead by Dan Allen and Sarah White and has received contributions
|
43
|
+
from many other individuals in Asciidoctor’s awesome community.
|
44
|
+
+
|
45
|
+
AsciiDoc was started by Stuart Rackham.
|
46
|
+
|
47
|
+
// .qanda_missing_answer
|
48
|
+
[qanda]
|
49
|
+
Who knows the answer?::
|
50
|
+
|
51
|
+
// .qanda_with_title
|
52
|
+
[qanda]
|
53
|
+
.The most important questions
|
54
|
+
What is the answer to the Ultimate Question?:: 42
|
55
|
+
|
56
|
+
// .qanda_with_id_and_role
|
57
|
+
[qanda, id=faq, role=galaxy]
|
58
|
+
What is the answer to the Ultimate Question?:: 42
|
59
|
+
|
60
|
+
// .horizontal
|
61
|
+
[horizontal]
|
62
|
+
Hard drive:: Permanent storage for operating system and/or user files.
|
63
|
+
RAM:: Temporarily stores information the CPU uses during operation.
|
64
|
+
|
65
|
+
// .horizontal_with_dimensions
|
66
|
+
[horizontal, labelwidth="20", itemwidth="50%"]
|
67
|
+
Hard drive:: Permanent storage for operating system and/or user files.
|
68
|
+
RAM:: Temporarily stores information the CPU uses during operation.
|
69
|
+
|
70
|
+
// .horizontal_with_title
|
71
|
+
[horizontal]
|
72
|
+
.Computer terminology for noobs
|
73
|
+
Hard drive:: Permanent storage for operating system and/or user files.
|
74
|
+
RAM:: Temporarily stores information the CPU uses during operation.
|
75
|
+
|
76
|
+
// .horizontal_with_id_and_role
|
77
|
+
[horizontal, id=computer, role=terms]
|
78
|
+
Hard drive:: Permanent storage for operating system and/or user files.
|
79
|
+
RAM:: Temporarily stores information the CPU uses during operation.
|
80
|
+
|
81
|
+
// .mixed
|
82
|
+
Operating Systems::
|
83
|
+
Linux:::
|
84
|
+
. Fedora
|
85
|
+
* Desktop
|
86
|
+
. Ubuntu
|
87
|
+
* Desktop
|
88
|
+
* Server
|
89
|
+
BSD:::
|
90
|
+
. FreeBSD
|
91
|
+
. NetBSD
|
92
|
+
|
93
|
+
Cloud Providers::
|
94
|
+
PaaS:::
|
95
|
+
. OpenShift
|
96
|
+
. CloudBees
|
97
|
+
IaaS:::
|
98
|
+
. Amazon EC2
|
99
|
+
. Rackspace
|
@@ -0,0 +1,21 @@
|
|
1
|
+
// .basic
|
2
|
+
====
|
3
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
4
|
+
incididunt ut labore et dolore magna aliqua.
|
5
|
+
====
|
6
|
+
|
7
|
+
// .with_title
|
8
|
+
.Sample document
|
9
|
+
====
|
10
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
11
|
+
incididunt ut labore et dolore magna aliqua.
|
12
|
+
|
13
|
+
The document header is useful, but not required.
|
14
|
+
====
|
15
|
+
|
16
|
+
// .with_id_and_role
|
17
|
+
[#lorem.ipsum]
|
18
|
+
====
|
19
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
20
|
+
incididunt ut labore et dolore magna aliqua.
|
21
|
+
====
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// .level1
|
2
|
+
[discrete]
|
3
|
+
== Discrete Title Level 1
|
4
|
+
|
5
|
+
// .level2
|
6
|
+
[discrete]
|
7
|
+
=== Discrete Title Level 2
|
8
|
+
|
9
|
+
// .level3
|
10
|
+
[discrete]
|
11
|
+
==== Discrete Title Level 3
|
12
|
+
|
13
|
+
// .level4
|
14
|
+
[discrete]
|
15
|
+
===== Discrete Title Level 4
|
16
|
+
|
17
|
+
// .level5
|
18
|
+
[discrete]
|
19
|
+
====== Discrete Title Level 5
|
20
|
+
|
21
|
+
// .with_custom_id
|
22
|
+
[discrete, id=flying]
|
23
|
+
== Discrete Title Level 1
|
24
|
+
|
25
|
+
// .with_roles
|
26
|
+
[discrete.flying.circus]
|
27
|
+
=== Discrete Title Level 2
|
@@ -0,0 +1,28 @@
|
|
1
|
+
// .basic
|
2
|
+
image::sunset.jpg[]
|
3
|
+
|
4
|
+
// .with_alt_text
|
5
|
+
image::sunset.jpg[Shining sun]
|
6
|
+
|
7
|
+
// .with_align
|
8
|
+
image::sunset.jpg[align="center"]
|
9
|
+
|
10
|
+
// .with_float
|
11
|
+
image::sunset.jpg[float="right"]
|
12
|
+
|
13
|
+
// .with_dimensions
|
14
|
+
image::sunset.jpg[Shining sun, 300, 200]
|
15
|
+
|
16
|
+
// .with_link
|
17
|
+
image::sunset.jpg[link="http://www.flickr.com/photos/javh/5448336655"]
|
18
|
+
|
19
|
+
// .with_title
|
20
|
+
.A mountain sunset
|
21
|
+
image::sunset.jpg[]
|
22
|
+
|
23
|
+
// .with_id
|
24
|
+
[[img-sunset]]
|
25
|
+
image::sunset.jpg[]
|
26
|
+
|
27
|
+
// .with_roles
|
28
|
+
image::sunset.jpg[role="right text-center"]
|
@@ -0,0 +1,68 @@
|
|
1
|
+
// .basic
|
2
|
+
----
|
3
|
+
echo -n "Please enter your name: "
|
4
|
+
read name
|
5
|
+
echo "Hello, $name!"
|
6
|
+
----
|
7
|
+
|
8
|
+
// .basic_with_title
|
9
|
+
.Reading user input
|
10
|
+
----
|
11
|
+
echo -n "Please enter your name: "
|
12
|
+
read name
|
13
|
+
echo "Hello, $name!"
|
14
|
+
----
|
15
|
+
|
16
|
+
// .basic_nowrap
|
17
|
+
[options="nowrap"]
|
18
|
+
----
|
19
|
+
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
20
|
+
----
|
21
|
+
|
22
|
+
// .basic_with_id_and_role
|
23
|
+
[#code.example]
|
24
|
+
----
|
25
|
+
echo -n "Please enter your name: "
|
26
|
+
read name
|
27
|
+
echo "Hello, $name!"
|
28
|
+
----
|
29
|
+
|
30
|
+
// .source
|
31
|
+
[source]
|
32
|
+
----
|
33
|
+
5.times do
|
34
|
+
print "Odelay!"
|
35
|
+
end
|
36
|
+
----
|
37
|
+
|
38
|
+
// .source_with_title
|
39
|
+
[source]
|
40
|
+
.Odelay!
|
41
|
+
----
|
42
|
+
5.times do
|
43
|
+
print "Odelay!"
|
44
|
+
end
|
45
|
+
----
|
46
|
+
|
47
|
+
// .source_with_language
|
48
|
+
[source, ruby]
|
49
|
+
----
|
50
|
+
5.times do
|
51
|
+
print "Odelay!"
|
52
|
+
end
|
53
|
+
----
|
54
|
+
|
55
|
+
// .source_nowrap
|
56
|
+
[source, java, options="nowrap"]
|
57
|
+
----
|
58
|
+
public class ApplicationConfigurationProvider extends HttpConfigurationProvider {
|
59
|
+
|
60
|
+
public Configuration getConfiguration(ServletContext context) {
|
61
|
+
return ConfigurationBuilder.begin()
|
62
|
+
.addRule()
|
63
|
+
.when(Direction.isInbound().and(Path.matches("/{path}")))
|
64
|
+
.perform(Log.message(Level.INFO, "Client requested path: {path}"))
|
65
|
+
.where("path").matches(".*");
|
66
|
+
}
|
67
|
+
}
|
68
|
+
----
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// .basic
|
2
|
+
....
|
3
|
+
error: The requested operation returned error: 1954 Forbidden search for defensive operations manual
|
4
|
+
absolutely fatal: operation initiation lost in the dodecahedron of doom
|
5
|
+
would you like to die again? y/n
|
6
|
+
....
|
7
|
+
|
8
|
+
// .with_title
|
9
|
+
.Die again?
|
10
|
+
....
|
11
|
+
error: The requested operation returned error: 1954 Forbidden search for defensive operations manual
|
12
|
+
absolutely fatal: operation initiation lost in the dodecahedron of doom
|
13
|
+
would you like to die again? y/n
|
14
|
+
....
|
15
|
+
|
16
|
+
// .with_id_and_role
|
17
|
+
[#error.fatal]
|
18
|
+
....
|
19
|
+
error: The requested operation returned error: 1954 Forbidden search for defensive operations manual
|
20
|
+
absolutely fatal: operation initiation lost in the dodecahedron of doom
|
21
|
+
would you like to die again? y/n
|
22
|
+
....
|
23
|
+
|
24
|
+
// .nowrap
|
25
|
+
[options="nowrap"]
|
26
|
+
....
|
27
|
+
error: The requested operation returned error: 1954 Forbidden search for defensive operations manual
|
28
|
+
absolutely fatal: operation initiation lost in the dodecahedron of doom
|
29
|
+
would you like to die again? y/n
|
30
|
+
....
|
@@ -0,0 +1,55 @@
|
|
1
|
+
// .basic
|
2
|
+
. Step 1
|
3
|
+
. Step 2
|
4
|
+
. Step 3
|
5
|
+
|
6
|
+
// .with_start
|
7
|
+
[start=6]
|
8
|
+
. Step 1
|
9
|
+
. Step 2
|
10
|
+
. Step 3
|
11
|
+
|
12
|
+
// .with_numeration_styles
|
13
|
+
[decimal]
|
14
|
+
. level 1
|
15
|
+
[upperalpha]
|
16
|
+
.. level 2
|
17
|
+
[loweralpha]
|
18
|
+
... level 3
|
19
|
+
[lowerroman]
|
20
|
+
.... level 4
|
21
|
+
[lowergreek]
|
22
|
+
..... level 5
|
23
|
+
|
24
|
+
// .with_title
|
25
|
+
.Steps
|
26
|
+
. Step 1
|
27
|
+
. Step 2
|
28
|
+
. Step 3
|
29
|
+
|
30
|
+
// .with_id_and_role
|
31
|
+
[#steps.green]
|
32
|
+
. Step 1
|
33
|
+
. Step 2
|
34
|
+
. Step 3
|
35
|
+
|
36
|
+
// .max_nesting
|
37
|
+
. level 1
|
38
|
+
.. level 2
|
39
|
+
... level 3
|
40
|
+
.... level 4
|
41
|
+
..... level 5
|
42
|
+
.. level 2
|
43
|
+
|
44
|
+
// .complex_content
|
45
|
+
. Every list item has at least one paragraph of content,
|
46
|
+
which may be wrapped, even using a hanging indent.
|
47
|
+
+
|
48
|
+
Additional paragraphs or blocks are adjoined by putting
|
49
|
+
a list continuation on a line adjacent to both blocks.
|
50
|
+
+
|
51
|
+
list continuation:: a plus sign (`{plus}`) on a line by itself
|
52
|
+
|
53
|
+
. A literal paragraph does not require a list continuation.
|
54
|
+
|
55
|
+
$ gem install asciidoctor
|
@@ -0,0 +1,40 @@
|
|
1
|
+
// .basic
|
2
|
+
--
|
3
|
+
An open block can be an anonymous container,
|
4
|
+
or it can masquerade as any other block.
|
5
|
+
--
|
6
|
+
|
7
|
+
// .basic_with_title
|
8
|
+
.An open block
|
9
|
+
--
|
10
|
+
An open block can be an anonymous container,
|
11
|
+
or it can masquerade as any other block.
|
12
|
+
--
|
13
|
+
|
14
|
+
// .basic_with_id_and_role
|
15
|
+
[#open.example]
|
16
|
+
--
|
17
|
+
An open block can be an anonymous container,
|
18
|
+
or it can masquerade as any other block.
|
19
|
+
--
|
20
|
+
|
21
|
+
// .abstract
|
22
|
+
[abstract]
|
23
|
+
--
|
24
|
+
This is an abstract quote block.
|
25
|
+
--
|
26
|
+
|
27
|
+
// .abstract_with_title
|
28
|
+
[abstract]
|
29
|
+
.Abstract title is abstract
|
30
|
+
--
|
31
|
+
This is an abstract quote block.
|
32
|
+
Who knows what it really means?
|
33
|
+
--
|
34
|
+
|
35
|
+
// .abstract_with_id_and_role
|
36
|
+
[abstract, id="open", role="example"]
|
37
|
+
--
|
38
|
+
This is an abstract quote block.
|
39
|
+
Who knows what it really means?
|
40
|
+
--
|
@@ -0,0 +1,60 @@
|
|
1
|
+
// .basic
|
2
|
+
= Document Title
|
3
|
+
:toc:
|
4
|
+
|
5
|
+
== Section 1
|
6
|
+
|
7
|
+
== Section 2
|
8
|
+
|
9
|
+
=== Section 2.1
|
10
|
+
|
11
|
+
==== Section 2.1.1
|
12
|
+
|
13
|
+
== Section 3
|
14
|
+
|
15
|
+
// .toclevels
|
16
|
+
= Document Title
|
17
|
+
:toc:
|
18
|
+
:toclevels: 1
|
19
|
+
|
20
|
+
== Section 1
|
21
|
+
|
22
|
+
=== Section 1.1
|
23
|
+
|
24
|
+
==== Section 1.1.1
|
25
|
+
|
26
|
+
== Section 2
|
27
|
+
|
28
|
+
// .numbered
|
29
|
+
= Document Title
|
30
|
+
:toc:
|
31
|
+
:numbered:
|
32
|
+
|
33
|
+
== Section 1
|
34
|
+
|
35
|
+
:numbered!:
|
36
|
+
|
37
|
+
== Unnumbered Section
|
38
|
+
|
39
|
+
:numbered:
|
40
|
+
|
41
|
+
== Section 2
|
42
|
+
|
43
|
+
=== Section 2.1
|
44
|
+
|
45
|
+
== Section 3
|
46
|
+
|
47
|
+
// .sectnumlevels
|
48
|
+
= Document Title
|
49
|
+
:toc:
|
50
|
+
:toclevels: 3
|
51
|
+
:numbered:
|
52
|
+
:sectnumlevels: 1
|
53
|
+
|
54
|
+
== Section 1
|
55
|
+
|
56
|
+
=== Section 1.1
|
57
|
+
|
58
|
+
==== Section 1.1.1
|
59
|
+
|
60
|
+
== Section 2
|