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,17 @@
|
|
1
|
+
// .basic
|
2
|
+
Paragraphs don't require any special markup in AsciiDoc.
|
3
|
+
A paragraph is just one or more lines of consecutive text.
|
4
|
+
|
5
|
+
To begin a new paragraph, separate it by at least one blank line.
|
6
|
+
|
7
|
+
// .with_title
|
8
|
+
.Paragraphs
|
9
|
+
Paragraphs don't require any special markup in AsciiDoc.
|
10
|
+
A paragraph is just one or more lines of consecutive text.
|
11
|
+
|
12
|
+
To begin a new paragraph, separate it by at least one blank line.
|
13
|
+
|
14
|
+
// .with_id_and_role
|
15
|
+
[#para-1.red]
|
16
|
+
Paragraphs don't require any special markup in AsciiDoc.
|
17
|
+
A paragraph is just one or more lines of consecutive text.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// .basic
|
2
|
+
= The Dangerous and Thrilling Documentation Chronicles
|
3
|
+
|
4
|
+
This journey begins on a bleary Monday morning.
|
5
|
+
Our intrepid team is in desperate need of double shot mochas, but the milk expired eight days ago.
|
6
|
+
|
7
|
+
== Cavern Glow
|
8
|
+
The river rages through the cavern, rattling its content.
|
9
|
+
|
10
|
+
// .toc_placement_preamble
|
11
|
+
= The Dangerous and Thrilling Documentation Chronicles
|
12
|
+
:toc:
|
13
|
+
:toc-placement: preamble
|
14
|
+
|
15
|
+
This journey begins on a bleary Monday morning.
|
16
|
+
Our intrepid team is in desperate need of double shot mochas, but the milk expired eight days ago.
|
17
|
+
|
18
|
+
== Cavern Glow
|
19
|
+
The river rages through the cavern, rattling its content.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// .basic
|
2
|
+
[quote]
|
3
|
+
Four score and seven years ago our fathers brought forth
|
4
|
+
on this continent a new nation...
|
5
|
+
|
6
|
+
// .with_attribution
|
7
|
+
[quote, Albert Einstein]
|
8
|
+
A person who never made a mistake never tried anything new.
|
9
|
+
|
10
|
+
// .with_attribution_and_citetitle
|
11
|
+
[quote, Captain James T. Kirk, Star Trek IV: The Voyage Home]
|
12
|
+
Everybody remember where we parked.
|
13
|
+
|
14
|
+
// .with_title
|
15
|
+
.After landing the cloaked Klingon bird of prey in Golden Gate park:
|
16
|
+
[quote]
|
17
|
+
Everybody remember where we parked.
|
18
|
+
|
19
|
+
// .with_id_and_role
|
20
|
+
[quote, id="parking", role="startrek"]
|
21
|
+
Everybody remember where we parked.
|
22
|
+
|
23
|
+
// .block
|
24
|
+
____
|
25
|
+
Dennis: Come and see the violence inherent in the system. Help! Help! I'm being repressed!
|
26
|
+
|
27
|
+
King Arthur: Bloody peasant!
|
28
|
+
|
29
|
+
Dennis: Oh, what a giveaway! Did you hear that? Did you hear that, eh? That's what I'm on about! Did you see him repressing me? You saw him, Didn't you?
|
30
|
+
____
|
@@ -0,0 +1,22 @@
|
|
1
|
+
// .basic
|
2
|
+
****
|
3
|
+
AsciiDoc was first released in Nov 2002 by Stuart Rackham.
|
4
|
+
It was designed from the start to be a shorthand syntax
|
5
|
+
for producing professional documents like DocBook and LaTeX.
|
6
|
+
****
|
7
|
+
|
8
|
+
// .with_title
|
9
|
+
.AsciiDoc history
|
10
|
+
****
|
11
|
+
AsciiDoc was first released in Nov 2002 by Stuart Rackham.
|
12
|
+
It was designed from the start to be a shorthand syntax
|
13
|
+
for producing professional documents like DocBook and LaTeX.
|
14
|
+
****
|
15
|
+
|
16
|
+
// .with_id_and_role
|
17
|
+
[#origin.center]
|
18
|
+
****
|
19
|
+
AsciiDoc was first released in Nov 2002 by Stuart Rackham.
|
20
|
+
It was designed from the start to be a shorthand syntax
|
21
|
+
for producing professional documents like DocBook and LaTeX.
|
22
|
+
****
|
@@ -0,0 +1,28 @@
|
|
1
|
+
// .asciimath
|
2
|
+
:stem: asciimath
|
3
|
+
[stem]
|
4
|
+
++++
|
5
|
+
sqrt(4) = 2
|
6
|
+
++++
|
7
|
+
|
8
|
+
// .latexmath
|
9
|
+
:stem: latexmath
|
10
|
+
[stem]
|
11
|
+
++++
|
12
|
+
C = \alpha + \beta Y^{\gamma} + \epsilon
|
13
|
+
++++
|
14
|
+
|
15
|
+
// .with_title
|
16
|
+
:stem:
|
17
|
+
[stem]
|
18
|
+
.Equation
|
19
|
+
++++
|
20
|
+
sqrt(4) = 2
|
21
|
+
++++
|
22
|
+
|
23
|
+
// .with_id_and_role
|
24
|
+
:stem:
|
25
|
+
[stem, id="sqrt", role="right"]
|
26
|
+
++++
|
27
|
+
sqrt(4) = 2
|
28
|
+
++++
|
@@ -0,0 +1,168 @@
|
|
1
|
+
// .basic
|
2
|
+
|===
|
3
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1
|
4
|
+
| Cell in column 1, row 2 | Cell in column 2, row 2
|
5
|
+
|===
|
6
|
+
|
7
|
+
// .with_frame_sides
|
8
|
+
[frame=sides]
|
9
|
+
|===
|
10
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1
|
11
|
+
|===
|
12
|
+
|
13
|
+
// .with_grid_cols
|
14
|
+
[grid=cols]
|
15
|
+
|===
|
16
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1
|
17
|
+
|===
|
18
|
+
|
19
|
+
// .with_float
|
20
|
+
[float=left]
|
21
|
+
|===
|
22
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1
|
23
|
+
|===
|
24
|
+
|
25
|
+
// .with_width
|
26
|
+
[width=80]
|
27
|
+
|===
|
28
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1
|
29
|
+
|===
|
30
|
+
|
31
|
+
// .with_autowidth
|
32
|
+
[options="autowidth"]
|
33
|
+
|===
|
34
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1
|
35
|
+
|===
|
36
|
+
|
37
|
+
// .with_title
|
38
|
+
.Table FTW!
|
39
|
+
|===
|
40
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1
|
41
|
+
|===
|
42
|
+
|
43
|
+
// .with_id_and_role
|
44
|
+
[#tabular.center]
|
45
|
+
|===
|
46
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1
|
47
|
+
|===
|
48
|
+
|
49
|
+
// .with_header
|
50
|
+
[options="header"]
|
51
|
+
|===
|
52
|
+
| Name of Column 1 | Name of Column 2
|
53
|
+
|
54
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1
|
55
|
+
| Cell in column 1, row 2 | Cell in column 2, row 2
|
56
|
+
|===
|
57
|
+
|
58
|
+
// .with_footer
|
59
|
+
[options="footer"]
|
60
|
+
|===
|
61
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1
|
62
|
+
| Cell in column 1, row 2 | Cell in column 2, row 2
|
63
|
+
| Footer in column 1, row 3 | Footer in column 2, row 3
|
64
|
+
|===
|
65
|
+
|
66
|
+
// .with_cols_width
|
67
|
+
[cols="50,20,30"]
|
68
|
+
|===
|
69
|
+
|Cell in column 1, row 1
|
70
|
+
|Cell in column 2, row 1
|
71
|
+
|Cell in column 3, row 1
|
72
|
+
|===
|
73
|
+
|
74
|
+
// .with_cols_halign
|
75
|
+
[cols="<,^,>"]
|
76
|
+
|===
|
77
|
+
|Cell in column 1, row 1
|
78
|
+
|Cell in column 2, row 1
|
79
|
+
|Cell in column 3, row 1
|
80
|
+
|===
|
81
|
+
|
82
|
+
// .with_cols_valign
|
83
|
+
[cols=".<,.^,.>"]
|
84
|
+
|===
|
85
|
+
|Cell in column 1, row 1
|
86
|
+
|Cell in column 2, row 1
|
87
|
+
|Cell in column 3, row 1
|
88
|
+
|===
|
89
|
+
|
90
|
+
// .with_cols_styles
|
91
|
+
[cols="a,e,h,l,m,s,v"]
|
92
|
+
|===
|
93
|
+
|image::sunset.jpg[AsciiDoc content]
|
94
|
+
|Emphasized text
|
95
|
+
|Styled like a header
|
96
|
+
|Literal block
|
97
|
+
|Monospaced text
|
98
|
+
|Strong text
|
99
|
+
|Verse block
|
100
|
+
|===
|
101
|
+
|
102
|
+
// .colspan
|
103
|
+
|===
|
104
|
+
|
105
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1 | Cell in column 3, row 1
|
106
|
+
|
107
|
+
2+|Content in a single cell that spans columns 1 and 3 | Cell in column 3, row 1
|
108
|
+
|
109
|
+
|===
|
110
|
+
|
111
|
+
// .rowspan
|
112
|
+
|===
|
113
|
+
|
114
|
+
| Cell in column 1, row 1 | Cell in column 2, row 1 | Cell in column 3, row 1
|
115
|
+
|
116
|
+
.2+|Content in a single cell that spans rows 2 and 3
|
117
|
+
|
118
|
+
| Cell in column 2, row 2 | Cell in column 3, row 2
|
119
|
+
|
120
|
+
| Cell in column 2, row 3 | Cell in column 3, row 3
|
121
|
+
|===
|
122
|
+
|
123
|
+
// .cell_with_paragraphs
|
124
|
+
|===
|
125
|
+
|
126
|
+
|Single paragraph on row 1
|
127
|
+
|
128
|
+
|First paragraph on row 2
|
129
|
+
|
130
|
+
Second paragraph on row 2
|
131
|
+
|===
|
132
|
+
|
133
|
+
// .aligns_per_cell
|
134
|
+
[cols="3"]
|
135
|
+
|===
|
136
|
+
^|Prefix the +{vbar}+ with +{caret}+ to center content horizontally
|
137
|
+
<|Prefix the +{vbar}+ with +<+ to align the content to the left horizontally
|
138
|
+
>|Prefix the +{vbar}+ with +>+ to align the content to the right horizontally
|
139
|
+
|
140
|
+
.^|Prefix the +{vbar}+ with a +.+ and +{caret}+ to center the content in the cell vertically
|
141
|
+
.<|Prefix the +{vbar}+ with a +.+ and +<+ to align the content to the top of the cell
|
142
|
+
.>|Prefix the +{vbar}+ with a +.+ and +>+ to align the content to the bottom of the cell
|
143
|
+
|
144
|
+
3+^.^|This content spans three columns (+3{plus}+) and is centered horizontally (+{caret}+) and vertically (+.{caret}+) within the cell.
|
145
|
+
|
146
|
+
|===
|
147
|
+
|
148
|
+
// .insane_cells_formatting
|
149
|
+
// seriously, this isn't readable anymore ;)
|
150
|
+
|===
|
151
|
+
|
152
|
+
2*>m|This content is duplicated across two columns.
|
153
|
+
|
154
|
+
It is aligned right horizontally.
|
155
|
+
|
156
|
+
And it is monospaced.
|
157
|
+
|
158
|
+
.3+^.>s|This cell spans 3 rows. The content is centered horizontally, aligned to the bottom of the cell, and strong.
|
159
|
+
e|This content is emphasized.
|
160
|
+
|
161
|
+
.^l|This content is aligned to the top of the cell and literal.
|
162
|
+
|
163
|
+
v|This cell contains a verse
|
164
|
+
that may one day expound on the
|
165
|
+
wonders of tables in an
|
166
|
+
epic sonnet.
|
167
|
+
|
168
|
+
|===
|
@@ -0,0 +1,50 @@
|
|
1
|
+
// .basic
|
2
|
+
// The block_toc node is used only with toc::[] macro!
|
3
|
+
// Actual TOC content is rendered in block_outline, this template usually
|
4
|
+
// renders just a "border".
|
5
|
+
= Document Title
|
6
|
+
:toc:
|
7
|
+
:toc-placement!:
|
8
|
+
|
9
|
+
== Introduction
|
10
|
+
|
11
|
+
toc::[]
|
12
|
+
|
13
|
+
== The Ravages of Writing
|
14
|
+
|
15
|
+
=== A Recipe for Potion
|
16
|
+
|
17
|
+
// .with_title
|
18
|
+
= Document Title
|
19
|
+
:toc:
|
20
|
+
:toc-placement!:
|
21
|
+
|
22
|
+
== Introduction
|
23
|
+
|
24
|
+
toc::[title="Table of Adventures"]
|
25
|
+
|
26
|
+
== The Ravages of Writing
|
27
|
+
|
28
|
+
// .with_levels
|
29
|
+
= Document Title
|
30
|
+
:toc:
|
31
|
+
:toc-placement!:
|
32
|
+
|
33
|
+
== Introduction
|
34
|
+
|
35
|
+
toc::[levels=1]
|
36
|
+
|
37
|
+
== The Ravages of Writing
|
38
|
+
|
39
|
+
=== A Recipe for Potion
|
40
|
+
|
41
|
+
// .with_id_and_role
|
42
|
+
= Document Title
|
43
|
+
:toc:
|
44
|
+
:toc-placement!:
|
45
|
+
|
46
|
+
== Introduction
|
47
|
+
|
48
|
+
toc::[id="mytoc", role="taco"]
|
49
|
+
|
50
|
+
== The Ravages of Writing
|
@@ -0,0 +1,43 @@
|
|
1
|
+
// .basic
|
2
|
+
* Edgar Allen Poe
|
3
|
+
* Sheri S. Tepper
|
4
|
+
* Bill Bryson
|
5
|
+
|
6
|
+
// .with_title
|
7
|
+
.Writers
|
8
|
+
* Edgar Allen Poe
|
9
|
+
* Sheri S. Tepper
|
10
|
+
* Bill Bryson
|
11
|
+
|
12
|
+
// .with_id_and_role
|
13
|
+
[#authors.green]
|
14
|
+
* Edgar Allen Poe
|
15
|
+
* Sheri S. Tepper
|
16
|
+
* Bill Bryson
|
17
|
+
|
18
|
+
// .max_nesting
|
19
|
+
* level 1
|
20
|
+
** level 2
|
21
|
+
*** level 3
|
22
|
+
**** level 4
|
23
|
+
***** level 5
|
24
|
+
** level 2
|
25
|
+
|
26
|
+
// .complex_content
|
27
|
+
* Every list item has at least one paragraph of content,
|
28
|
+
which may be wrapped, even using a hanging indent.
|
29
|
+
+
|
30
|
+
Additional paragraphs or blocks are adjoined by putting
|
31
|
+
a list continuation on a line adjacent to both blocks.
|
32
|
+
+
|
33
|
+
list continuation:: a plus sign (`{plus}`) on a line by itself
|
34
|
+
|
35
|
+
* A literal paragraph does not require a list continuation.
|
36
|
+
|
37
|
+
$ gem install asciidoctor
|
38
|
+
|
39
|
+
// .checklist
|
40
|
+
- [*] checked
|
41
|
+
- [x] also checked
|
42
|
+
- [ ] not checked
|
43
|
+
- normal list item
|
@@ -0,0 +1,37 @@
|
|
1
|
+
// .basic
|
2
|
+
[verse]
|
3
|
+
The fog comes
|
4
|
+
on little cat feet.
|
5
|
+
|
6
|
+
// .basic_with_attribution
|
7
|
+
[verse, Carl Sandburg]
|
8
|
+
The fog comes
|
9
|
+
on little cat feet.
|
10
|
+
|
11
|
+
// .basic_with_attribution_and_citetitle
|
12
|
+
[verse, Carl Sandburg, two lines from the poem Fog]
|
13
|
+
The fog comes
|
14
|
+
on little cat feet.
|
15
|
+
|
16
|
+
// .basic_with_title
|
17
|
+
[verse]
|
18
|
+
.Poetry
|
19
|
+
The fog comes
|
20
|
+
on little cat feet.
|
21
|
+
|
22
|
+
// .basic_with_id_and_role
|
23
|
+
[verse, id="sandburg", role="center"]
|
24
|
+
The fog comes
|
25
|
+
on little cat feet.
|
26
|
+
|
27
|
+
// .block
|
28
|
+
[verse]
|
29
|
+
____
|
30
|
+
The fog comes
|
31
|
+
on little cat feet.
|
32
|
+
|
33
|
+
It sits looking
|
34
|
+
over harbor and city
|
35
|
+
on silent haunches
|
36
|
+
and then moves on.
|
37
|
+
____
|
@@ -0,0 +1,24 @@
|
|
1
|
+
// .basic
|
2
|
+
video::video_file.mp4[]
|
3
|
+
|
4
|
+
// .with_poster
|
5
|
+
video::video_file.mp4[poster="sunset.jpg"]
|
6
|
+
|
7
|
+
// .with_dimensions
|
8
|
+
video::video_file.mp4[width=640, height=480]
|
9
|
+
|
10
|
+
// .with_start
|
11
|
+
video::video_file.mp4[start=10]
|
12
|
+
|
13
|
+
// .with_end
|
14
|
+
video::video_file.mp4[end=60]
|
15
|
+
|
16
|
+
// .with_options
|
17
|
+
video::video_file.mp4[options="autoplay, loop, nocontrols"]
|
18
|
+
|
19
|
+
// .with_title
|
20
|
+
.Must watch!
|
21
|
+
video::video_file.mp4[]
|
22
|
+
|
23
|
+
// .with_id_and_role
|
24
|
+
video::video_file.mp4[id="lindsey", role="watch"]
|