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.
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
@@ -0,0 +1,51 @@
1
+ // .title
2
+ = The Dangerous and Thrilling Documentation Chronicles
3
+
4
+ // .title_with_author
5
+ = The Dangerous and Thrilling Documentation Chronicles
6
+ Kismet Rainbow Chameleon <kismet@asciidoctor.org>
7
+
8
+ // .title_with_author_no_email
9
+ = The Dangerous and Thrilling Documentation Chronicles
10
+ Kismet Rainbow Chameleon
11
+
12
+ // .title_with_multiple_authors
13
+ = The Dangerous and Thrilling Documentation Chronicles
14
+ Kismet Rainbow Chameleon <kismet@asciidoctor.org>; Lazarus het_Draeke <lazarus@asciidoctor.org>
15
+
16
+ // .title_with_revnumber
17
+ = Document Title
18
+ Kismet Chameleon
19
+ v1.0
20
+
21
+ // .title_with_revdate
22
+ = Document Title
23
+ Kismet Chameleon
24
+ v1.0, 2013-10-02
25
+
26
+ // .title_with_revremark
27
+ = Document Title
28
+ Kismet Chameleon
29
+ v1.0, October 2, 2013: First incarnation
30
+
31
+ // .footnotes
32
+ The hail-and-rainbow protocol can be initiated at five levels: double, tertiary, supernumerary,
33
+ supermassive, and apocalyptic party.footnote:[The double hail-and-rainbow level makes my toes tingle.]
34
+ A bold statement.footnoteref:[disclaimer,Opinions are my own.]
35
+
36
+ Another outrageous statement.footnoteref:[disclaimer]
37
+
38
+ // .toc
39
+ // Actual TOC content is rendered in block_outline, this template usually
40
+ // renders just a "border".
41
+ = Document Title
42
+ :toc:
43
+
44
+ == Cavern Glow
45
+
46
+ // .toc_title
47
+ = Document Title
48
+ :toc:
49
+ :toc-title: Table of Adventures
50
+
51
+ == Cavern Glow
@@ -0,0 +1,10 @@
1
+ // .title
2
+ :showtitle:
3
+ = The Dangerous and Thrilling Documentation Chronicles
4
+
5
+ // .footnotes
6
+ The hail-and-rainbow protocol can be initiated at five levels: double, tertiary, supernumerary,
7
+ supermassive, and apocalyptic party.footnote:[The double hail-and-rainbow level makes my toes tingle.]
8
+ A bold statement.footnoteref:[disclaimer,Opinions are my own.]
9
+
10
+ Another outrageous statement.footnoteref:[disclaimer]
@@ -0,0 +1,27 @@
1
+ // .basic
2
+ http://www.asciidoctor.org
3
+
4
+ // .basic_with_text
5
+ irc://irc.freenode.org/#asciidoctor[Asciidoctor IRC channel]
6
+
7
+ // .basic_with_target_blank
8
+ link:view-source:asciidoctor.org[Asciidoctor homepage^]
9
+
10
+ // .basic_with_role
11
+ :linkattrs:
12
+ http://discuss.asciidoctor.org/[*mailing list*, role="green"]
13
+
14
+ // .xref
15
+ The section <<page-break>> describes how to add a page break.
16
+
17
+ // .xref_with_text
18
+ The section <<page-break, Page break>> describes how to add a page break.
19
+
20
+ // .xref_resolved_text
21
+ Refer to <<Section A>>.
22
+
23
+ == Section A
24
+
25
+ // .bibref
26
+ // This is an item (anchor) in the bibliography, not a link to it.
27
+ [[[prag]]] Andy Hunt & Dave Thomas. The Pragmatic Programmer
@@ -0,0 +1,8 @@
1
+ // .plus_sign
2
+ Rubies are red, +
3
+ Topazes are blue.
4
+
5
+ // .hardbreaks
6
+ [%hardbreaks]
7
+ Ruby is red.
8
+ Java is black.
@@ -0,0 +1,3 @@
1
+ // .basic
2
+ :experimental:
3
+ btn:[OK]
@@ -0,0 +1,5 @@
1
+ // .basic
2
+ [source]
3
+ ----
4
+ "Hello world!" // <1>
5
+ ----
@@ -0,0 +1,9 @@
1
+ // .basic
2
+ Apocalyptic party.footnote:[The double hail-and-rainbow level makes my toes tingle.]
3
+
4
+ // .xref
5
+ A bold statement.footnoteref:[disclaimer,Opinions are my own.]
6
+ Another outrageous statement.footnoteref:[disclaimer]
7
+
8
+ // .xref_unresolved
9
+ A bold statement.footnoteref:[foobar]
@@ -0,0 +1,44 @@
1
+ // .image
2
+ image:linux.svg[]
3
+
4
+ // .image_with_alt_text
5
+ image:linux.svg[Tux]
6
+
7
+ // .image_with_dimensions
8
+ image:linux.svg[Tux, 25, 35]
9
+
10
+ // .image_with_float
11
+ image:linux.svg[float="right"]
12
+
13
+ // .image_with_link
14
+ image:linux.svg[link="http://inkscape.org/doc/examples/tux.svg"]
15
+
16
+ // .image_with_role
17
+ image:linux.svg[role="black"]
18
+
19
+ // .icon
20
+ :icons:
21
+ icon:tags[]
22
+
23
+ // .icon_with_dimensions
24
+ :icons:
25
+ icon:tags[height=25, width=35]
26
+
27
+ // .icon_with_float
28
+ :icons:
29
+ icon:heart[float="right"]
30
+
31
+ // .icon_with_link
32
+ :icons:
33
+ icon:download[link="http://rubygems.org/downloads/asciidoctor-1.5.2.gem"]
34
+
35
+ // .icon_with_title
36
+ :icons:
37
+ icon:heart[title="I <3 Asciidoctor"]
38
+
39
+ // .icon_with_role
40
+ :icons:
41
+ icon:tags[role="blue"]
42
+
43
+ // .icon_no_icons
44
+ icon:tags[]
@@ -0,0 +1,7 @@
1
+ // .basic
2
+ :experimental:
3
+ kbd:[F11]
4
+
5
+ // .keyseq
6
+ :experimental:
7
+ kbd:[Ctrl+Shift+N]
@@ -0,0 +1,11 @@
1
+ // .menu
2
+ :experimental:
3
+ menu:File[]
4
+
5
+ // .menuitem
6
+ :experimental:
7
+ menu:File[Save]
8
+
9
+ // .submenu
10
+ :experimental:
11
+ menu:View[Zoom > Reset]
@@ -0,0 +1,59 @@
1
+ // .basic
2
+ [why]#chunky bacon#
3
+
4
+ // .emphasis
5
+ _chunky bacon_
6
+
7
+ // .emphasis_with_role
8
+ [why]_chunky bacon_
9
+
10
+ // .strong
11
+ *chunky bacon*
12
+
13
+ // .strong_with_role
14
+ [why]*chunky bacon*
15
+
16
+ // .monospaced
17
+ `hello world!`
18
+
19
+ // .monospaced_with_role
20
+ [why]`hello world!`
21
+
22
+ // .superscript
23
+ ^super^chunky bacon
24
+
25
+ // .superscript_with_role
26
+ [why]^super^chunky bacon
27
+
28
+ // .subscript
29
+ ~sub~chunky bacon
30
+
31
+ // .subscript_with_role
32
+ [why]~sub~chunky bacon
33
+
34
+ // .mark
35
+ #chunky bacon#
36
+
37
+ // .double
38
+ "`chunky bacon`"
39
+
40
+ // .double_with_role
41
+ [why]"`chunky bacon`"
42
+
43
+ // .single
44
+ '`chunky bacon`'
45
+
46
+ // .single_with_role
47
+ [why]'`chunky bacon`'
48
+
49
+ // .asciimath
50
+ asciimath:[sqrt(4) = 2]
51
+
52
+ // .latexmath
53
+ latexmath:[$C = \alpha + \beta Y^{\gamma} + \epsilon$]
54
+
55
+ // .with_id
56
+ [#why]_chunky bacon_
57
+
58
+ // .mixed_monospace_bold_italic
59
+ `*_monospace bold italic phrase_*` and le``**__tt__**``ers
@@ -0,0 +1,74 @@
1
+ // .level1
2
+ == Section Level 1
3
+
4
+ // .level2
5
+ === Section Level 2
6
+
7
+ // .level3
8
+ ==== Section Level 3
9
+
10
+ // .level4
11
+ ===== Section Level 4
12
+
13
+ // .level5
14
+ ====== Section Level 5
15
+
16
+ // .max_nesting
17
+ == Section Level 1
18
+
19
+ === Section Level 2
20
+
21
+ ==== Section Level 3
22
+
23
+ ===== Section Level 4
24
+
25
+ ====== Section Level 5
26
+
27
+ === Section Level 2
28
+
29
+ // .with_custom_id
30
+ [#foo]
31
+ == Section Title
32
+
33
+ // .with_roles
34
+ [.center.red]
35
+ == Section Title
36
+
37
+ // .sectanchors
38
+ :sectanchors:
39
+ == Title with anchor
40
+
41
+ // .sectlinks
42
+ :sectlinks:
43
+ == Linked title
44
+
45
+ // .numbered
46
+ :numbered:
47
+ == Introduction to Asciidoctor
48
+
49
+ == Quick Starts
50
+
51
+ === Usage
52
+
53
+ ==== Using the Command Line Interface
54
+
55
+ ===== Processing Your Content
56
+
57
+ === Syntax
58
+
59
+ == Terms and Concepts
60
+
61
+ // .numbered_sectnumlevels_1
62
+ :numbered:
63
+ :sectnumlevels: 1
64
+ == Introduction to Asciidoctor
65
+
66
+ == Quick Starts
67
+
68
+ === Usage
69
+
70
+ ==== Using the Command Line Interface
71
+
72
+ === Syntax
73
+
74
+ == Terms and Concepts
Binary file
@@ -0,0 +1,56 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny" width="180mm" height="100mm" viewBox="0 0 18000 10000" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round">
3
+ <path fill="none" stroke="#000" stroke-width="100" stroke-linejoin="round" d="M4300 2700h1528" />
4
+ <path d="M5834 2923l447-199 14-10 5-13-5-15-12-9-449-200-6-2h-4l-9 2-9 6-6 7-2 9v402l2 9 6 9 9 4 9 2h4l6-2z" />
5
+ <text font-family="Arial, sans-serif" font-size="388px" font-weight="400" x="4350" y="2218">AsciiDoc</text>
6
+ <path fill="none" stroke="#000" stroke-width="100" stroke-linejoin="round" d="M7900 4400v728" />
7
+ <path d="M7677 5134l199 447 10 14 13 5 15-5 9-12 200-449 2-6v-4l-2-9-6-9-7-6-9-2h-402l-9 2-9 6-4 9-2 9v4l2 6z" />
8
+ <text font-family="Arial, sans-serif" font-size="388px" font-weight="400" x="6850" y="4693">AST</text>
9
+ <text font-family="Arial, sans-serif" font-size="494px" font-weight="400" x="654" y="1172">reference input</text>
10
+ <path fill="none" stroke="#000" stroke-width="100" stroke-linejoin="round" d="M10476 2726h1528" />
11
+ <path d="M12010 2949l447-199 14-10 5-13-5-15-12-9-449-200-6-2h-4l-9 2-9 6-6 7-2 9v402l2 9 6 9 9 4 9 2h4l6-2z" />
12
+ <text font-family="Arial, sans-serif" font-size="388px" font-weight="400" x="10748" y="2244">HTML</text>
13
+ <text font-family="Courier New, monospace" font-size="353px" font-weight="700">
14
+ <tspan x="1450" y="2572">* Linux</tspan>
15
+ <tspan x="1450" y="2970">* FreeBSD</tspan>
16
+ </text>
17
+ <path fill="#fff" d="M1001 5201h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V5201zm0 0zm2521 3201z" />
18
+ <path fill="none" stroke="#000" stroke-width="50" stroke-linejoin="round" d="M1001 5201h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V5201z" />
19
+ <path fill="#fff" d="M1090 5000h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V5000zm0 0zm2521 3201z" />
20
+ <path fill="none" stroke="#000" stroke-width="50" stroke-linejoin="round" d="M1090 5000h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V5000z" />
21
+ <path fill="#fff" d="M1180 4800h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V4800zm0 0zm2521 3201z" />
22
+ <path fill="none" stroke="#000" stroke-width="50" stroke-linejoin="round" d="M1180 4800h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V4800zM1450 5200h1980M1450 5500h1980M1450 6100h1980M1450 6400h1980M1450 7000h1980M1450 7300h990" />
23
+ <path fill="#fff" d="M13600 5301h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V5301zm0 0zm2521 3201z" />
24
+ <path fill="none" stroke="#000" stroke-width="50" stroke-linejoin="round" d="M13600 5301h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V5301z" />
25
+ <path fill="#fff" d="M13689 5100h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V5100zm0 0zm2521 3201z" />
26
+ <path fill="none" stroke="#000" stroke-width="50" stroke-linejoin="round" d="M13689 5100h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V5100z" />
27
+ <path fill="#fff" d="M13779 4900h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V4900zm0 0zm2521 3201z" />
28
+ <path fill="none" stroke="#000" stroke-width="50" stroke-linejoin="round" d="M13779 4900h2521v2572c-998-21-965 505-1866 629-322-75-440-134-655-220V4900zM14049 5300h1980M14049 5600h1980M14049 6200h1980M14049 6500h1980M14049 7100h1980M14049 7400h990" />
29
+ <path fill="none" stroke="#000" stroke-width="100" stroke-linejoin="round" d="M14949 5117v-945" />
30
+ <path d="M14981 5098l32 9 31 16 29 22 22 29 16 31 9 32 4 32-4 32-9 33-16 31-22 28-29 22-31 16-32 10-33 3-31-3-33-10-30-16-29-22-22-28-16-31-9-33-4-32 4-32 9-32 16-31 22-29 29-22 30-16 33-9 31-4 33 4zM15172 4166l-199-447-10-14-13-5-15 5-9 12-200 449-2 6v4l2 9 6 9 7 6 9 2h402l9-2 9-6 4-9 2-9v-4l-2-6z" />
31
+ <path fill="none" stroke="#000" stroke-width="100" stroke-linejoin="round" d="M2350 5042v-970" />
32
+ <path d="M2382 5023l32 9 31 16 29 22 22 29 16 31 9 32 4 32-4 32-9 33-16 31-22 28-29 22-31 16-32 10-33 3-31-3-33-10-30-16-29-22-22-28-16-31-9-33-4-32 4-32 9-32 16-31 22-29 29-22 30-16 33-9 31-4 33 4zM2573 4066l-199-447-10-14-13-5-15 5-9 12-200 449-2 6v4l2 9 6 9 7 6 9 2h402l9-2 9-6 4-9 2-9v-4l-2-6z" />
33
+ <text font-family="Arial, sans-serif" font-size="494px" font-weight="400">
34
+ <tspan x="14295" y="670">output</tspan>
35
+ <tspan x="13114" y="1217">actual / expected</tspan>
36
+ </text>
37
+ <path fill="none" stroke="#000" stroke-width="50" stroke-linejoin="round" d="M15500 2000l-2688 1800" />
38
+ <path d="M13219 2117l115 63c6 4 9 6 11 9 2 2 3 6 3 10 0 5-2 9-5 12-4 4-8 6-13 6-3 0-7-2-14-5l-170-95 170-95c7-3 11-5 14-5 5 0 9 2 13 5 3 4 5 8 5 13 0 4-1 7-3 10-2 2-5 5-11 8l-115 64zm323-56v121c8 0 13 2 17 5 4 4 5 8 5 13s-1 9-5 13c-4 3-10 5-18 5h-34v-9c-10 5-20 8-29 11-9 2-18 3-26 3-12 0-22-2-30-7-9-5-15-12-20-20-4-7-6-14-6-24v-76h-6c-8 0-14-1-18-5-4-3-5-7-5-12 0-6 1-10 5-13s10-5 18-5h42v105c0 8 1 13 5 17 4 3 9 5 17 5 7 0 14-1 23-4 8-3 18-8 30-16v-72h-13c-8 0-14-1-18-5-3-3-5-7-5-12 0-6 2-10 5-13 4-3 10-5 18-5h48zm155-67v188h42c9 0 15 2 19 5 3 3 5 8 5 13s-2 9-5 13c-4 3-10 5-19 5h-120c-8 0-14-2-18-5-3-4-5-8-5-13s2-10 5-13c4-3 10-5 18-5h43v-153h-29c-8 0-14-1-18-5-3-3-5-7-5-12 0-6 1-10 5-13s10-5 18-5h64zm232 123l-115-64c-5-3-9-6-11-8-2-3-3-6-3-10 0-5 2-9 5-13 4-3 8-5 13-5 3 0 7 2 14 5l170 95-170 95c-7 3-11 5-14 5-5 0-9-2-13-5-3-4-5-8-5-13 0-4 1-8 3-10 2-3 6-5 11-9l115-63zm-498 398l115 63c6 4 9 6 11 9 2 2 3 6 3 10 0 5-2 9-5 12-4 4-8 6-13 6-3 0-7-2-14-5l-170-95 170-95c7-3 11-5 14-5 5 0 9 2 13 5 3 4 5 8 5 13 0 4-1 7-3 10-2 2-5 5-11 8l-115 64zm267-123v188h42c9 0 15 2 19 5 3 3 5 8 5 13s-2 9-5 13c-4 3-10 5-19 5h-120c-8 0-14-2-18-5-3-4-5-8-5-13s2-10 5-13c4-3 10-5 18-5h43v-153h-29c-8 0-14-1-18-5-3-3-5-7-5-12 0-6 1-10 5-13s10-5 18-5h64zm207 0v37h-42v-37h42zm5 67v121h42c9 0 15 2 18 5 4 3 6 8 6 13s-2 9-6 13c-3 3-9 5-18 5h-120c-8 0-14-2-18-5-4-4-5-8-5-13s1-10 5-13 10-5 18-5h43v-86h-29c-8 0-14-1-18-5-4-3-5-7-5-12 0-6 1-10 5-13s10-5 18-5h64zm232 56l-115-64c-5-3-9-6-11-8-2-3-3-6-3-10 0-5 2-9 5-13 4-3 8-5 13-5 3 0 7 2 14 5l170 95-170 95c-7 3-11 5-14 5-5 0-9-2-13-5-3-4-5-8-5-13 0-4 1-8 3-10 2-3 6-5 11-9l115-63zm160-73v138h76v-33c0-9 1-15 5-18 3-4 7-6 13-6 5 0 9 2 12 6 4 3 5 9 5 18v69h-167c-9 0-15-2-18-5-4-4-6-8-6-13s2-10 6-13c3-3 9-5 18-5h20v-138h-20c-9 0-15-2-18-5-4-3-6-7-6-13 0-5 2-9 6-13 3-3 9-5 18-5l76 1c9 0 15 1 19 4 3 4 5 8 5 13 0 6-2 10-5 13-4 3-10 5-19 5h-20zm239-50v37h-42v-37h42zm5 67v121h7l-52 36h-33c-8 0-14-2-18-5-4-4-5-8-5-13s1-10 5-13 10-5 18-5h43v-86h-29c-8 0-14-1-18-5-4-3-5-7-5-12 0-6 1-10 5-13s10-5 18-5h64zm159 0v12c6-6 13-10 21-12 3-1 5-2 8-3l-65 45v-7c-7 0-13-1-16-5-4-3-6-7-6-12 0-6 2-10 6-13 3-3 10-5 18-5h34zm-1274 454l115 63c6 4 9 6 11 9 2 2 3 6 3 10 0 5-2 9-5 12-4 4-8 6-13 6-3 0-7-2-14-5l-170-95 170-95c7-3 11-5 14-5 5 0 9 2 13 5 3 4 5 8 5 13 0 4-1 7-3 10-2 2-5 5-11 8l-115 64zm266-123v188h42c9 0 15 2 19 5 3 3 5 8 5 13s-2 9-5 13c-4 3-10 5-19 5h-120c-8 0-14-2-18-5-3-4-5-8-5-13s2-10 5-13c4-3 10-5 18-5h43v-153h-29c-8 0-14-1-18-5-3-3-5-7-5-12 0-6 1-10 5-13s10-5 18-5h64zm207 0v37h-42v-37h42zm5 67v121h42c7 0 12 1 16 3l-48 33h-88c-8 0-14-2-18-5-4-4-5-8-5-13s1-10 5-13 10-5 18-5h43v-86h-29c-8 0-14-1-18-5-4-3-5-7-5-12 0-6 1-10 5-13s10-5 18-5h64zm117-8c-5-3-9-6-11-8-2-3-3-6-3-10 0-5 2-9 5-13 4-3 8-5 13-5 3 0 7 2 14 5l89 50-33 22-74-41zm-807 462l115 63c6 4 9 6 11 9 2 2 3 6 3 10 0 5-2 9-5 12-4 4-8 6-13 6-3 0-7-2-14-5l-170-95 170-95c7-3 11-5 14-5 5 0 9 2 13 5 3 4 5 8 5 13 0 4-1 7-3 10-2 2-5 5-11 8l-115 64zm321-118l-54 117-57 39 79-171c3-6 6-10 8-12 3-2 7-4 11-4 5 0 9 2 12 5 4 4 5 8 5 12 0 3-1 8-4 14zM13284 3512l-58 124c-3 6-5 10-7 12-3 3-7 4-11 4-5 0-9-2-13-5-3-4-5-8-5-12 0-3 1-8 4-14l33-70 57-39zm483-330c1 0 1 0 2 1 3 3 5 7 5 13 0 5-2 9-5 12-4 4-10 5-18 5h-30l46-31zm166-114l81 45-171 94c-6 4-11 6-14 6-5 0-9-2-12-6-4-3-6-8-6-13 0-4 1-7 3-9 2-3 6-6 12-9l114-63-40-22 33-23zm422-288h33c8 0 14 2 18 5 3 3 5 7 5 13 0 5-2 9-5 12-4 4-10 5-18 5h-85l52-35zm182-125c4-1 9-1 14-1 20 0 37 7 49 20 10 10 15 23 15 40v66c7 0 13 2 16 5 4 3 6 7 6 13 0 5-2 9-6 12-3 4-10 5-18 5h-32c-8 0-14-1-18-5-4-3-6-7-6-13 0-5 2-9 6-12 3-3 9-5 16-5v-67c0-8-2-13-6-17-5-4-13-7-24-7-8 0-15 2-22 5-6 3-14 10-23 20v66c9 0 15 1 18 2 5 4 8 9 8 16 0 5-2 9-5 12-4 4-10 5-19 5h-40c-8 0-14-1-18-5-4-3-5-7-5-13s2-11 8-15c3-1 9-2 18-2v-78l68-47zm290 4v121c7 0 13 2 16 5 4 3 6 7 6 13 0 5-2 9-6 12-3 4-9 5-18 5h-33v-8c-11 5-20 8-29 10-10 3-18 4-27 4-11 0-21-3-30-7-8-5-15-12-20-21-4-6-5-14-5-23v-76h-6c-9 0-15-2-19-5-3-3-5-7-5-13 0-5 2-9 5-12 4-4 10-5 19-5h41v105c0 7 2 13 5 16 4 4 10 6 17 6s15-2 23-5c8-2 18-8 31-15v-72h-13c-9 0-15-2-18-5-4-3-6-7-6-13 0-5 2-9 6-12 3-4 9-5 18-5h48zm163 75l54 46c6 0 11 2 14 5 4 4 5 8 5 13s-2 9-5 12c-4 4-10 5-18 5h-41c-8 0-14-1-18-5-3-3-5-7-5-13 0-4 1-7 4-11 2-3 6-5 10-6l-26-23-27 23c5 1 9 3 12 6 2 3 3 7 3 11 0 6-2 10-5 13-4 4-10 5-18 5h-40c-9 0-15-1-18-5-4-3-6-7-6-13 0-4 2-8 5-12 3-3 8-5 15-5l52-46-46-40c-6 0-11-2-14-6-3-3-5-7-5-12s2-9 5-12c4-4 10-5 19-5h33c8 0 14 1 18 5 4 3 5 7 5 12 0 7-3 12-9 17l21 17 21-18c-6-4-9-9-9-15s1-10 5-13c4-4 10-5 18-5h33c8 0 15 1 18 5 4 3 6 7 6 12s-2 9-5 12c-3 4-8 6-14 6l-47 40zm149-19l114 63c6 3 10 6 12 9 2 2 3 5 3 9 0 5-2 9-6 13-3 4-7 6-12 6-3 0-8-2-14-6l-171-94 171-95c6-4 11-5 14-5 4 0 9 2 12 5 4 4 6 8 6 13 0 4-1 7-3 10-2 2-6 5-12 8l-114 64zm322-119l-114 244c-3 6-5 10-7 12-3 3-7 4-11 4-5 0-9-2-13-5-3-4-5-8-5-12 0-3 1-8 4-14l114-243c3-7 5-11 7-12 3-3 7-4 11-4 5 0 9 2 13 5 3 3 5 7 5 12 0 3-2 7-4 13zm156-4v188h43c8 0 14 2 18 5s5 7 5 13c0 5-1 9-5 12-4 4-10 5-18 5h-120c-9 0-15-1-18-5-4-3-6-7-6-13 0-5 2-9 6-12 3-3 9-5 18-5h42v-153h-28c-9 0-15-2-18-5-4-3-6-7-6-13 0-5 2-9 5-12 4-4 10-5 19-5h63zm207 0v37h-42v-37h42zm5 67v121h43c8 0 14 2 18 5 3 3 5 7 5 13 0 5-2 9-5 12-4 4-10 5-18 5h-120c-9 0-15-1-19-5-3-3-5-7-5-13 0-5 2-9 5-12 4-3 10-5 19-5h42v-86h-28c-9 0-15-2-19-5-3-3-5-7-5-13 0-5 2-9 5-12 4-4 10-5 19-5h63zm232 56l-114-64c-6-3-10-6-12-8-2-3-3-6-3-10 0-5 2-9 6-13 3-3 7-5 12-5 3 0 8 1 14 5l171 95-171 94c-6 4-11 6-14 6-5 0-9-2-12-6-4-3-6-8-6-13 0-4 1-7 3-9 2-3 6-6 12-9l114-63zm-1970 411v52h36c8 0 14 2 18 5s5 7 5 13c0 5-1 9-5 12-4 4-10 5-18 5h-77c-9 0-15-1-18-5-4-3-6-7-6-13 0-5 2-9 6-12 3-3 9-5 18-5h5v-138h-5c-9 0-15-2-18-5-4-4-6-8-6-13s2-10 6-13c3-3 9-5 18-5h166v54c0 9-2 15-5 18-3 4-7 6-13 6-5 0-9-2-12-6-4-3-5-9-5-18v-18h-90v51h31c0-9 0-15 2-18 4-6 9-8 15-8s10 1 13 5 5 10 5 18v41c0 8-2 15-5 18-3 4-8 6-13 6-6 0-11-3-15-9-2-3-2-8-2-18h-31zm228-69v22c15-11 27-18 36-22 8-3 16-5 24-5 11 0 22 4 33 13 7 6 11 11 11 17 0 5-2 10-5 13-4 4-8 6-13 6-4 0-9-3-14-7-4-4-9-7-13-7-5 0-12 4-22 10s-22 15-37 28v53h51c8 0 14 2 18 5s5 7 5 13c0 5-1 9-5 12-4 4-10 5-18 5h-107c-8 0-14-1-18-5-4-3-6-7-6-13 0-5 2-9 6-12s10-5 18-5h21v-86h-13c-8 0-14-2-18-5-3-3-5-7-5-13 0-5 2-9 5-12 4-4 10-5 18-5h48zm308 96h-144c3 9 10 17 19 22 9 6 22 9 38 9 13 0 31-3 52-9 9-2 15-3 19-3 5 0 9 1 12 5 3 3 5 7 5 12s-2 9-6 12c-4 4-15 8-33 12s-35 6-52 6c-28 0-50-8-67-24s-26-36-26-59c0-25 9-45 28-61 18-15 39-23 63-23 14 0 28 3 40 8s21 10 26 16c9 9 16 19 21 32 4 8 5 18 5 30v15zm-39-35c-5-11-12-18-21-23s-19-8-31-8-22 3-31 8-16 12-21 23h104zm251 35h-144c3 9 10 17 19 22 9 6 22 9 38 9 13 0 31-3 52-9 9-2 15-3 19-3 5 0 9 1 12 5 3 3 5 7 5 12s-2 9-6 12c-4 4-15 8-33 12s-35 6-52 6c-28 0-50-8-67-24s-26-36-26-59c0-25 9-45 28-61 18-15 39-23 63-23 14 0 28 3 40 8s21 10 26 16c9 9 16 19 21 32 4 8 5 18 5 30v15zm-39-35c-5-11-12-18-21-23s-19-8-31-8-22 3-31 8-16 12-21 23h104zm91 60v-138h-6c-8 0-14-2-18-5-4-4-5-8-5-13s1-10 5-13 10-5 18-5h89c21 0 38 6 51 18s19 26 19 42c0 7-1 15-4 22-3 6-8 13-14 18 11 7 19 15 25 24s8 19 8 30c0 9-2 17-6 25-3 6-6 10-11 14-6 5-13 9-21 12-9 3-19 4-32 4h-104c-8 0-14-1-18-5-4-3-5-7-5-13 0-5 1-9 5-12s10-5 18-5h6zm35-87h39c14 0 25-3 34-10 7-5 10-11 10-18 0-6-3-12-9-16-6-5-15-7-28-7h-46v51zm0 87h61c14 0 24-2 30-6 5-4 7-8 7-14 0-7-4-14-13-21s-22-11-38-11h-47v52zm197 26c-3 4-5 6-7 7s-5 2-7 2c-6 0-10-2-13-6-4-3-5-9-5-18v-23c0-9 1-15 5-19 3-3 7-5 13-5 4 0 7 1 10 3 3 3 5 6 7 11 1 5 3 9 4 11 4 3 9 7 18 11 8 3 18 5 28 5 16 0 29-4 39-11 6-4 9-10 9-17 0-4-1-8-4-12s-8-7-15-9c-5-2-15-4-31-7-20-4-34-8-44-13s-18-13-24-22c-5-9-8-19-8-30 0-16 7-31 21-44s33-19 55-19c9 0 18 1 25 3 8 2 15 5 22 9 4-4 9-6 13-6 6 0 10 1 13 5s5 10 5 18v26c0 9-2 15-5 19-3 3-7 5-13 5-4 0-8-1-11-4-3-2-4-6-6-12-1-5-3-10-5-12-3-5-8-8-15-11-6-3-14-5-23-5-12 0-22 3-30 9-7 6-11 12-11 19 0 4 2 8 5 12s7 8 13 10c4 2 15 4 33 8 18 3 32 7 42 11 9 5 17 11 24 20 6 10 10 20 10 33 0 17-7 31-19 42-16 14-37 20-62 20-10 0-20-1-29-3s-18-6-27-11zm185-26v-138c-8 0-13-2-17-5-3-4-5-8-5-13s2-10 5-13c4-3 10-5 18-5h74c12 0 23 2 34 7 11 4 20 9 27 16 5 5 10 12 15 20 6 9 10 17 13 26 2 8 4 19 4 31v17c0 15-3 28-8 40-5 11-11 21-20 28-8 7-16 13-23 16-11 6-26 8-45 8h-71c-8 0-14-1-18-5-3-3-5-7-5-13 0-5 2-9 5-12 4-4 9-5 17-5zm35 0h38c14 0 24-2 31-6 10-5 17-12 21-20 5-8 7-19 7-32v-17c0-11-2-21-6-29-7-13-14-22-22-27-9-5-19-7-32-7h-37v138zm219-65l114 63c6 3 10 6 12 9 2 2 3 5 3 9 0 5-2 9-6 13-3 4-7 6-12 6-3 0-8-2-14-6l-171-94 171-95c6-4 11-5 14-5 4 0 9 2 12 5 4 4 6 8 6 13 0 4-1 7-3 10-2 2-6 5-12 8l-114 64zm322-119l-114 244c-3 6-5 10-7 12-3 3-7 4-11 4-5 0-9-2-13-5-3-4-5-8-5-12 0-3 1-8 4-14l114-243c3-7 5-11 7-12 3-3 7-4 11-4 5 0 9 2 13 5 3 3 5 7 5 12 0 3-2 7-4 13zm156-4v188h43c8 0 14 2 18 5s5 7 5 13c0 5-1 9-5 12-4 4-10 5-18 5h-120c-9 0-15-1-18-5-4-3-6-7-6-13 0-5 2-9 6-12 3-3 9-5 18-5h42v-153h-28c-9 0-15-2-18-5-4-3-6-7-6-13 0-5 2-9 5-12 4-4 10-5 19-5h63zm207 0v37h-42v-37h42zm5 67v121h43c8 0 14 2 18 5 3 3 5 7 5 13 0 5-2 9-5 12-4 4-10 5-18 5h-120c-9 0-15-1-19-5-3-3-5-7-5-13 0-5 2-9 5-12 4-3 10-5 19-5h42v-86h-28c-9 0-15-2-19-5-3-3-5-7-5-13 0-5 2-9 5-12 4-4 10-5 19-5h63zm232 56l-114-64c-6-3-10-6-12-8-2-3-3-6-3-10 0-5 2-9 6-13 3-3 7-5 12-5 3 0 8 1 14 5l171 95-171 94c-6 4-11 6-14 6-5 0-9-2-12-6-4-3-6-8-6-13 0-4 1-7 3-9 2-3 6-6 12-9l114-63zm-2930 342v121c7 0 13 2 16 5 4 3 6 7 6 13 0 5-2 9-6 12-3 4-9 5-18 5h-33v-8c-11 5-20 8-29 10-10 3-18 4-27 4-11 0-21-3-30-7-8-5-15-12-20-21-4-6-5-14-5-23v-76h-6c-9 0-15-2-19-5-3-3-5-7-5-13 0-5 2-9 5-12 4-4 10-5 19-5h41v105c0 7 2 13 5 16 4 4 10 6 17 6s15-2 23-5c8-2 18-8 31-15v-72h-13c-9 0-15-2-18-5-4-3-6-7-6-13 0-5 2-9 6-12 3-4 9-5 18-5h48zm154-67v188h43c8 0 14 2 18 5s5 7 5 13c0 5-1 9-5 12-4 4-10 5-18 5h-120c-9 0-15-1-18-5-4-3-6-7-6-13 0-5 2-9 6-12 3-3 9-5 18-5h42v-153h-28c-9 0-15-2-18-5-4-3-6-7-6-13 0-5 2-9 5-12 4-4 10-5 19-5h63zm232 123l-114-64c-6-3-10-6-12-8-2-3-3-6-3-10 0-5 2-9 6-13 3-3 7-5 12-5 3 0 8 1 14 5l171 95-171 94c-6 4-11 6-14 6-5 0-9-2-12-6-4-3-6-8-6-13 0-4 1-7 3-9 2-3 6-6 12-9l114-63z" />
39
+ <text font-family="Arial, sans-serif" font-size="388px" font-weight="400" x="2915" y="8372">.adoc</text>
40
+ <text font-family="Arial, sans-serif" font-size="388px" font-weight="400" x="15616" y="8373">.html</text>
41
+ <text font-family="Arial, sans-serif" font-size="388px" font-weight="400" x="15650" y="2172">diff</text>
42
+ <text font-family="Arial, sans-serif" font-size="494px" font-weight="400" x="710" y="9416">input examples</text>
43
+ <text font-family="Arial, sans-serif" font-size="494px" font-weight="400" x="13111" y="9416">output examples</text>
44
+ <text font-family="Arial, sans-serif" font-size="494px" font-weight="400" x="7250" y="670">Asciidoctor</text>
45
+ <path fill="#fff" d="M8186 8242H6586l514-2242h3200l-514 2242H8186z" />
46
+ <path fill="none" stroke="#000" stroke-width="50" stroke-linejoin="round" d="M8186 8242H6586l514-2242h3200l-514 2242H8186z" />
47
+ <path fill="none" stroke="#000" stroke-width="100" stroke-linejoin="round" d="M9000 5575v-728" />
48
+ <path d="M9223 4841l-199-447-10-14-13-5-15 5-9 12-200 449-2 6v4l2 9 6 9 7 6 9 2h402l9-2 9-6 4-9 2-9v-4l-2-6z" />
49
+ <text font-family="Arial, sans-serif" font-size="388px" font-weight="400" x="9394" y="4693">HTML</text>
50
+ <text font-family="Arial, sans-serif" font-size="494px" font-weight="400">
51
+ <tspan x="7453" y="6970">backend</tspan>
52
+ <tspan x="7150" y="7517">(templates)</tspan>
53
+ </text>
54
+ <path fill="#fff" d="M8677 2218c-69-28-146-44-227-44s-158 16-227 44-131 70-183 121c-51 52-93 114-121 183s-44 146-44 227 16 158 44 227 70 131 121 183c52 51 114 93 183 121s146 44 227 44 158-16 227-44 131-70 183-121c51-52 93-114 121-183s44-146 44-227-16-158-44-227-70-131-121-183c-52-51-114-93-183-121zm1027 680l-213 33c-11 63-27 123-49 182l169 134-16 20 22 12-125 216-22-13-9 23-200-78c-41 48-85 93-134 133l79 201-23 9 12 22-215 124-13-22-19 16-134-168c-59 21-120 38-183 49l-32 212-25-3v25h-248v-25l-25 3-32-212c-63-11-124-28-183-49l-134 168-19-16-13 22-215-124 13-22-24-9 79-201c-48-40-93-85-134-133l-200 78-9-23-22 13-124-216 21-12-15-20 168-134c-21-58-38-119-49-182l-213-33 4-24h-25v-249h25l-4-25 214-32c11-63 27-123 48-182l-168-135 15-19-21-13 124-215 22 13 9-24 201 80c40-49 85-93 133-134l-79-201 24-9-13-22 215-124 13 21 19-15 135 169c59-21 119-38 182-49l32-214 25 4v-25h248v25l25-4 32 214c63 11 124 28 182 49l135-169 19 15 13-21 216 124-13 22 23 9-79 201c48 41 93 85 133 134l202-80 9 24 22-13 124 215-22 13 16 19-169 135c21 59 38 119 49 182l213 32-4 25h25v249h-25l4 24z" />
55
+ <path fill="none" stroke="#000" stroke-width="50" stroke-linejoin="round" stroke-linecap="round" d="M8677 2218c-69-28-146-44-227-44s-158 16-227 44-131 70-183 121c-51 52-93 114-121 183s-44 146-44 227 16 158 44 227 70 131 121 183c52 51 114 93 183 121s146 44 227 44 158-16 227-44 131-70 183-121c51-52 93-114 121-183s44-146 44-227-16-158-44-227-70-131-121-183c-52-51-114-93-183-121zM9704 2898l-213 33c-11 63-27 123-49 182l169 134-16 20 22 12-125 216-22-13-9 23-200-78c-41 48-85 93-134 133l79 201-23 9 12 22-215 124-13-22-19 16-134-168c-59 21-120 38-183 49l-32 212-25-3v25h-248v-25l-25 3-32-212c-63-11-124-28-183-49l-134 168-19-16-13 22-215-124 13-22-24-9 79-201c-48-40-93-85-134-133l-200 78-9-23-22 13-124-216 21-12-15-20 168-134c-21-58-38-119-49-182l-213-33 4-24h-25v-249h25l-4-25 214-32c11-63 27-123 48-182l-168-135 15-19-21-13 124-215 22 13 9-24 201 80c40-49 85-93 133-134l-79-201 24-9-13-22 215-124 13 21 19-15 135 169c59-21 119-38 182-49l32-214 25 4v-25h248v25l25-4 32 214c63 11 124 28 182 49l135-169 19 15 13-21 216 124-13 22 23 9-79 201c48 41 93 85 133 134l202-80 9 24 22-13 124 215-22 13 16 19-169 135c21 59 38 119 49 182l213 32-4 25h25v249h-25l4 24z" />
56
+ </svg>
Binary file
@@ -0,0 +1 @@
1
+ require 'asciidoctor/doctest'
@@ -0,0 +1,30 @@
1
+ require 'pathname'
2
+
3
+ module Asciidoctor
4
+ module DocTest
5
+
6
+ BUILTIN_EXAMPLES_PATH = Pathname.new(
7
+ '../../data/examples/asciidoc').expand_path(__dir__).to_s.freeze
8
+
9
+ @examples_path = [ BUILTIN_EXAMPLES_PATH ]
10
+
11
+ class << self
12
+ # @return [Array<String>] paths of the directories where to look for the
13
+ # examples suites. Use +unshift+ to add your paths before the built-in
14
+ # reference input examples (default: +["{asciidoctor-doctest}/data/examples/asciidoc"]+).
15
+ attr_accessor :examples_path
16
+ end
17
+ end
18
+ end
19
+
20
+ # Allow to use shorten module name.
21
+ DocTest = Asciidoctor::DocTest unless defined? DocTest
22
+
23
+ require 'asciidoctor/doctest/version'
24
+ require 'asciidoctor/doctest/base_example'
25
+ require 'asciidoctor/doctest/base_examples_suite'
26
+ require 'asciidoctor/doctest/generator'
27
+ require 'asciidoctor/doctest/generator_task'
28
+ require 'asciidoctor/doctest/test'
29
+ require 'asciidoctor/doctest/asciidoc/examples_suite'
30
+ require 'asciidoctor/doctest/html/examples_suite'
@@ -0,0 +1,44 @@
1
+ require 'asciidoctor/doctest/base_examples_suite'
2
+ require 'asciidoctor/doctest/core_ext'
3
+
4
+ module Asciidoctor::DocTest
5
+ module Asciidoc
6
+ ##
7
+ # Subclass of {BaseExamplesSuite} for reference input examples.
8
+ #
9
+ # @example Format of the example's header
10
+ # // .example-name
11
+ # // Any text that is not the example's name is considered
12
+ # // as a description.
13
+ # The example's content in *AsciiDoc*.
14
+ #
15
+ # NOTE: The trailing new line (below this) will be removed.
16
+ #
17
+ class ExamplesSuite < BaseExamplesSuite
18
+
19
+ def initialize(file_ext: '.adoc', **kwargs)
20
+ super
21
+ end
22
+
23
+ def parse(input, group_name)
24
+ examples = []
25
+ current = create_example(nil)
26
+
27
+ input.each_line do |line|
28
+ line.chomp!
29
+ if line =~ %r{^//\s*\.([^ \n]+)}
30
+ local_name = $1
31
+ current.content.chomp!
32
+ examples << (current = create_example([group_name, local_name]))
33
+ elsif line =~ %r{^//\s*(.*)\s*$}
34
+ (current.desc ||= '').concat($1, "\n")
35
+ else
36
+ current.content.concat(line, "\n")
37
+ end
38
+ end
39
+
40
+ examples
41
+ end
42
+ end
43
+ end
44
+ end