reverse_asciidoctor 0.1.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 (94) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +32 -0
  4. data/README.adoc +186 -0
  5. data/Rakefile +14 -0
  6. data/bin/reverse_asciidoctor +14 -0
  7. data/bin/w2m +31 -0
  8. data/lib/reverse_asciidoctor.rb +70 -0
  9. data/lib/reverse_asciidoctor/cleaner.rb +85 -0
  10. data/lib/reverse_asciidoctor/config.rb +28 -0
  11. data/lib/reverse_asciidoctor/converters.rb +33 -0
  12. data/lib/reverse_asciidoctor/converters/a.rb +38 -0
  13. data/lib/reverse_asciidoctor/converters/aside.rb +14 -0
  14. data/lib/reverse_asciidoctor/converters/audio.rb +34 -0
  15. data/lib/reverse_asciidoctor/converters/base.rb +24 -0
  16. data/lib/reverse_asciidoctor/converters/blockquote.rb +18 -0
  17. data/lib/reverse_asciidoctor/converters/br.rb +11 -0
  18. data/lib/reverse_asciidoctor/converters/bypass.rb +77 -0
  19. data/lib/reverse_asciidoctor/converters/code.rb +15 -0
  20. data/lib/reverse_asciidoctor/converters/div.rb +14 -0
  21. data/lib/reverse_asciidoctor/converters/drop.rb +18 -0
  22. data/lib/reverse_asciidoctor/converters/em.rb +18 -0
  23. data/lib/reverse_asciidoctor/converters/figure.rb +21 -0
  24. data/lib/reverse_asciidoctor/converters/h.rb +19 -0
  25. data/lib/reverse_asciidoctor/converters/head.rb +18 -0
  26. data/lib/reverse_asciidoctor/converters/hr.rb +11 -0
  27. data/lib/reverse_asciidoctor/converters/ignore.rb +12 -0
  28. data/lib/reverse_asciidoctor/converters/img.rb +23 -0
  29. data/lib/reverse_asciidoctor/converters/li.rb +24 -0
  30. data/lib/reverse_asciidoctor/converters/mark.rb +12 -0
  31. data/lib/reverse_asciidoctor/converters/math.rb +14 -0
  32. data/lib/reverse_asciidoctor/converters/ol.rb +46 -0
  33. data/lib/reverse_asciidoctor/converters/p.rb +17 -0
  34. data/lib/reverse_asciidoctor/converters/pass_through.rb +9 -0
  35. data/lib/reverse_asciidoctor/converters/pre.rb +38 -0
  36. data/lib/reverse_asciidoctor/converters/q.rb +12 -0
  37. data/lib/reverse_asciidoctor/converters/strong.rb +17 -0
  38. data/lib/reverse_asciidoctor/converters/sub.rb +12 -0
  39. data/lib/reverse_asciidoctor/converters/sup.rb +12 -0
  40. data/lib/reverse_asciidoctor/converters/table.rb +64 -0
  41. data/lib/reverse_asciidoctor/converters/td.rb +67 -0
  42. data/lib/reverse_asciidoctor/converters/text.rb +65 -0
  43. data/lib/reverse_asciidoctor/converters/th.rb +16 -0
  44. data/lib/reverse_asciidoctor/converters/tr.rb +22 -0
  45. data/lib/reverse_asciidoctor/converters/video.rb +36 -0
  46. data/lib/reverse_asciidoctor/errors.rb +10 -0
  47. data/lib/reverse_asciidoctor/version.rb +3 -0
  48. data/reverse_asciidoctor.gemspec +30 -0
  49. data/spec/assets/anchors.html +22 -0
  50. data/spec/assets/basic.html +58 -0
  51. data/spec/assets/code.html +22 -0
  52. data/spec/assets/escapables.html +15 -0
  53. data/spec/assets/from_the_wild.html +23 -0
  54. data/spec/assets/full_example.html +49 -0
  55. data/spec/assets/html_fragment.html +3 -0
  56. data/spec/assets/lists.html +137 -0
  57. data/spec/assets/minimum.html +4 -0
  58. data/spec/assets/paragraphs.html +24 -0
  59. data/spec/assets/quotation.html +12 -0
  60. data/spec/assets/tables.html +99 -0
  61. data/spec/assets/unknown_tags.html +9 -0
  62. data/spec/components/anchors_spec.rb +21 -0
  63. data/spec/components/basic_spec.rb +49 -0
  64. data/spec/components/code_spec.rb +28 -0
  65. data/spec/components/escapables_spec.rb +23 -0
  66. data/spec/components/from_the_wild_spec.rb +17 -0
  67. data/spec/components/html_fragment_spec.rb +11 -0
  68. data/spec/components/lists_spec.rb +86 -0
  69. data/spec/components/paragraphs_spec.rb +15 -0
  70. data/spec/components/quotation_spec.rb +12 -0
  71. data/spec/components/tables_spec.rb +31 -0
  72. data/spec/components/unknown_tags_spec.rb +39 -0
  73. data/spec/lib/reverse_asciidoctor/cleaner_spec.rb +157 -0
  74. data/spec/lib/reverse_asciidoctor/config_spec.rb +26 -0
  75. data/spec/lib/reverse_asciidoctor/converters/aside_spec.rb +12 -0
  76. data/spec/lib/reverse_asciidoctor/converters/audio_spec.rb +18 -0
  77. data/spec/lib/reverse_asciidoctor/converters/blockquote_spec.rb +24 -0
  78. data/spec/lib/reverse_asciidoctor/converters/br_spec.rb +9 -0
  79. data/spec/lib/reverse_asciidoctor/converters/code_spec.rb +18 -0
  80. data/spec/lib/reverse_asciidoctor/converters/div_spec.rb +18 -0
  81. data/spec/lib/reverse_asciidoctor/converters/figure_spec.rb +13 -0
  82. data/spec/lib/reverse_asciidoctor/converters/img_spec.rb +28 -0
  83. data/spec/lib/reverse_asciidoctor/converters/li_spec.rb +13 -0
  84. data/spec/lib/reverse_asciidoctor/converters/mark_spec.rb +10 -0
  85. data/spec/lib/reverse_asciidoctor/converters/p_spec.rb +12 -0
  86. data/spec/lib/reverse_asciidoctor/converters/pre_spec.rb +45 -0
  87. data/spec/lib/reverse_asciidoctor/converters/q_spec.rb +10 -0
  88. data/spec/lib/reverse_asciidoctor/converters/strong_spec.rb +20 -0
  89. data/spec/lib/reverse_asciidoctor/converters/text_spec.rb +62 -0
  90. data/spec/lib/reverse_asciidoctor/converters/video_spec.rb +18 -0
  91. data/spec/lib/reverse_asciidoctor/converters_spec.rb +19 -0
  92. data/spec/lib/reverse_asciidoctor_spec.rb +37 -0
  93. data/spec/spec_helper.rb +21 -0
  94. metadata +281 -0
@@ -0,0 +1,4 @@
1
+ <html>
2
+ <body>
3
+ </body>
4
+ </html>
@@ -0,0 +1,24 @@
1
+ <html>
2
+ <body>
3
+ <p>First content</p>
4
+ <p>
5
+ Second
6
+ content
7
+ </p>
8
+ <p>
9
+ <em>Complex</em>
10
+ <pre>
11
+ <code>Content</code>
12
+ </pre>
13
+ </p>
14
+ <p>
15
+ <strong>Trailing whitespace: </strong>
16
+ </p>
17
+ <p>
18
+ <strong>Trailing non-breaking space:&nbsp;</strong>
19
+ </p>
20
+ <p>
21
+ <strong><em>Combination:&nbsp;</em></strong>
22
+ </p>
23
+ </body>
24
+ </html>
@@ -0,0 +1,12 @@
1
+ <html>
2
+ <body>
3
+ <pre>
4
+ <code>Block of code</code>
5
+ </pre>
6
+
7
+ <blockquote>
8
+ <p>First quoted paragraph</p>
9
+ <p>Second quoted paragraph</p>
10
+ </blockquote>
11
+ </body>
12
+ </html>
@@ -0,0 +1,99 @@
1
+ <html>
2
+ <body>
3
+ some text...
4
+
5
+ <table id="A">
6
+ <thead>
7
+ <colgroup>
8
+ <col span="2" style="background-color:red">
9
+ <col style="background-color:yellow">
10
+ </colgroup>
11
+ </thead>
12
+ <tbody>
13
+ <tr id="B">
14
+ <th id="C">header 1</th>
15
+ <th>header 2</th>
16
+ <th>header 3</th>
17
+ </tr>
18
+ <tr>
19
+ <th id="D">data 1-1</td>
20
+ <td>data 2-1</td>
21
+ <td>data 3-1</td>
22
+ </tr>
23
+ <tr>
24
+ <th>data 1-2</td>
25
+ <td>data 2-2</td>
26
+ <td>data 3-2</td>
27
+ </tr>
28
+ </tbody>
29
+ </table>
30
+
31
+ <table>
32
+ <tr>
33
+ <th><i>header oblique</i></th>
34
+ <th><strong>header bold</strong></th>
35
+ <th><code>header code</code></th>
36
+ </tr>
37
+ <tr>
38
+ <td><i>data oblique</i></td>
39
+ <td><strong>data bold</strong></td>
40
+ <td><code>data code</code></td>
41
+ </tr>
42
+ </table>
43
+
44
+ <table>
45
+ <tr>
46
+ <td colspan=2>colspan 2</td>
47
+ </tr>
48
+ <tr>
49
+ <td rowspan=2>rowspan 2</td>
50
+ </tr>
51
+ <tr>
52
+ <td rowspan=2 colspan=2>colrowspan 2</td>
53
+ </tr>
54
+ </table>
55
+
56
+ <table>
57
+ <tr>
58
+ <td align="left">horizontal left</td>
59
+ <td align="center">horizontal center</td>
60
+ <td align="right">horizontal right</td>
61
+ </tr>
62
+ <tr>
63
+ <td valign="top">vertical top</td>
64
+ <td valign="middle">vertical middle</td>
65
+ <td valign="bottom">vertical bottom</td>
66
+ </tr>
67
+ <tr>
68
+ <td align="center" valign="middle">center middle</td>
69
+ </tr>
70
+ </table>
71
+
72
+ <table>
73
+ <caption>Table <i>caption</i></caption>
74
+ <tr>
75
+ <td>
76
+ <p>Hello</p>
77
+ <p>This cell has multiple paragraphs</p>
78
+ </td>
79
+ <td>
80
+ <p>This cell has a single paragraph</p>
81
+ </td>
82
+ </tr>
83
+ </table>
84
+
85
+ <table width="75%">
86
+ <tr>
87
+ <td>75% width table</td>
88
+ </tr>
89
+ </table>
90
+
91
+ <table frame="hsides" rules="cols">
92
+ <tr>
93
+ <td>topbot</td>
94
+ </tr>
95
+ </table>
96
+
97
+ some text...
98
+ </body>
99
+ </html>
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <body>
3
+ <p>
4
+ <foo>
5
+ <bar>Foo with bar</bar>
6
+ </foo>
7
+ </p>
8
+ </body>
9
+ </html>
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAsciidoctor do
4
+
5
+ let(:input) { File.read('spec/assets/anchors.html') }
6
+ let(:document) { Nokogiri::HTML(input) }
7
+ subject { ReverseAsciidoctor.convert(input) }
8
+
9
+ it { is_expected.to include 'http://foobar.com[Foobar]' }
10
+ it { is_expected.to include 'http://foobar.com[Fubar]' }
11
+ it { is_expected.to include 'http://foobar.com[f\*\*\*\*\* up beyond all redemption]' }
12
+ it { is_expected.to include 'http://strong.foobar.com[*Strong foobar*]' }
13
+
14
+ it { is_expected.to include 'There should be space before but not after the anchor ( http://foobar.com[stripped]).' }
15
+
16
+ it { is_expected.to include ' do not ignore link:foo.html[] anchor tags with no link text ' }
17
+ it { is_expected.to include ' link <<content,internal jumplinks>> with anchors ' }
18
+ it { is_expected.to include ' link <<content2>>internal jumplinks without anchors ' }
19
+ it { is_expected.to include ' treat [[content]] as bookmarks ' }
20
+
21
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAsciidoctor do
4
+
5
+ let(:input) { File.read('spec/assets/basic.html') }
6
+ let(:document) { Nokogiri::HTML(input) }
7
+ subject { ReverseAsciidoctor.convert(input) }
8
+
9
+ it { is_expected.to match /plain text ?\n/ }
10
+ it { is_expected.to match /\n== h1\n/ }
11
+ it { is_expected.to match /\n\[\[A]\]\n== h1 with anchor\n/ }
12
+ it { is_expected.to match /\n=== h2\n/ }
13
+ it { is_expected.to match /\n==== h3\n/ }
14
+ it { is_expected.to match /\n===== h4\n/ }
15
+ it { is_expected.to match /\n====== h5\n/ }
16
+ it { is_expected.to match /\n======= h6\n/ }
17
+
18
+ it { is_expected.to match /_em tag content_/ }
19
+ it { is_expected.to match /before and after empty em tags/ }
20
+ it { is_expected.to match /before and after em tags containing whitespace/ }
21
+ it { is_expected.to match /_double em tags_/ }
22
+ it { is_expected.to match /_double em tags in p tag_/ }
23
+ it { is_expected.to match /a _em with leading and trailing_ whitespace/ }
24
+ it { is_expected.to match /a _em with extra leading and trailing_ whitespace/ }
25
+
26
+ it { is_expected.to match /\*strong tag content\*/ }
27
+ it { is_expected.to match /before and after empty strong tags/ }
28
+ it { is_expected.to match /before and after strong tags containing whitespace/ }
29
+ it { is_expected.to match /\*double strong tags\*/ }
30
+ it { is_expected.to match /\*double strong tags in p tag\*/ }
31
+ it { is_expected.to match /before \*double strong tags containing whitespace\* after/ }
32
+ it { is_expected.to match /a \*strong with leading and trailing\* whitespace/ }
33
+ it { is_expected.to match /a \*strong with extra leading and trailing\* whitespace/ }
34
+
35
+ it { is_expected.to match /H~2~O/ }
36
+ it { is_expected.to match /A\^2\^B/ }
37
+
38
+ it { is_expected.to match /_i tag content_/ }
39
+ it { is_expected.to match /\*b tag content\*/ }
40
+
41
+ it { is_expected.to match /br tags become double space followed by newline \+\n/ }
42
+ #it { should match /br tags XXX \n/ }
43
+
44
+ it { is_expected.to match /before hr \n\* \* \*\n after hr/ }
45
+
46
+ it { is_expected.to match /section 1\n ?\nsection 2/ }
47
+
48
+ it { is_expected.to match /ignore abbr/ }
49
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAsciidoctor do
4
+
5
+ let(:input) { File.read('spec/assets/code.html') }
6
+ let(:document) { Nokogiri::HTML(input) }
7
+ subject { ReverseAsciidoctor.convert(input) }
8
+
9
+ it { is_expected.to match /inline `code` block/ }
10
+ it { is_expected.to match /\n<code>var this\;\nthis\.is/ }
11
+ it { is_expected.to match /block"\)\nconsole/ }
12
+
13
+ context "with github style code blocks" do
14
+ subject { ReverseAsciidoctor.convert(input) }
15
+ it { is_expected.to match /inline `code` block/ }
16
+ it { is_expected.to match /\n\.\.\.\.\n<code>var this\;\nthis/ }
17
+ it { is_expected.to match /it is"\) ?\n <\/code>\n\.\.\.\./ }
18
+ end
19
+
20
+ context "code with indentation" do
21
+ subject { ReverseAsciidoctor.convert(input) }
22
+ it { is_expected.to match(/^<code>tell application "Foo"\n/) }
23
+ it { is_expected.to match(/^ beep\n/) }
24
+ it { is_expected.to match(/^end tell\n/) }
25
+ end
26
+
27
+ end
28
+
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAsciidoctor do
4
+
5
+ let(:input) { File.read('spec/assets/escapables.html') }
6
+ let(:document) { Nokogiri::HTML(input) }
7
+ subject { ReverseAsciidoctor.convert(input) }
8
+
9
+ context "multiple asterisks" do
10
+ it { is_expected.to include ' \*\*two asterisks\*\* ' }
11
+ it { is_expected.to include ' \*\*\*three asterisks\*\*\* ' }
12
+ end
13
+
14
+ context "multiple underscores" do
15
+ it { is_expected.to include ' \_\_two underscores\_\_ ' }
16
+ it { is_expected.to include ' \_\_\_three underscores\_\_\_ ' }
17
+ end
18
+
19
+ context "underscores within words in code blocks" do
20
+ it { is_expected.to include "....\n<code>var theoretical_max_infin = 1.0;</code>\n....\n" }
21
+ end
22
+
23
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAsciidoctor do
4
+
5
+ let(:input) { File.read('spec/assets/from_the_wild.html') }
6
+ let(:document) { Nokogiri::HTML(input) }
7
+ subject { ReverseAsciidoctor.convert(input) }
8
+
9
+ it "should make sense of strong-crazy markup (as seen in the wild)" do
10
+ expect(subject).to include "*. +\n \\*\\*\\* intentcast* : logo design *+*\n"
11
+ end
12
+
13
+ it "should not over escape * or _" do
14
+ expect(subject).to include 'link:example.com/foo_bar[image::example.com/foo_bar.png[] I\_AM\_HELPFUL]'
15
+ end
16
+
17
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAsciidoctor do
4
+
5
+ let(:input) { File.read('spec/assets/html_fragment.html') }
6
+ let(:document) { Nokogiri::HTML(input) }
7
+ subject { ReverseAsciidoctor.convert(input) }
8
+
9
+ it { is_expected.to eq("naked text 1\n\nparagraph text\n\nnaked text 2") }
10
+ end
11
+
@@ -0,0 +1,86 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAsciidoctor do
4
+
5
+ let(:input) { File.read('spec/assets/lists.html') }
6
+ let(:document) { Nokogiri::HTML(input) }
7
+ subject { ReverseAsciidoctor.convert(input) }
8
+
9
+ it { is_expected.to match /\n\* unordered list entry\n/ }
10
+ it { is_expected.to match /\n\* unordered list entry 2\n/ }
11
+ it { is_expected.to match /\n. ordered list entry\n/ }
12
+ it { is_expected.to match /\n. ordered list entry 2\n/ }
13
+ it { is_expected.to match /\n. list entry 1st hierarchy\n/ }
14
+ it { is_expected.to match /\n\*\* nested unsorted list entry\n/ }
15
+ it { is_expected.to match /\n\.\.\. deep nested list entry\n/ }
16
+
17
+ context "list anchors" do
18
+ it { is_expected.to match /\n\[\[1\]\]\n\. arabic1\n/ }
19
+ it { is_expected.to match /\n\[\[A\]\]\n\* upperalpha1\n/ }
20
+ end
21
+
22
+ context "list styles" do
23
+ it { is_expected.to match /\n\[arabic\]\n\. arabic\n/ }
24
+ it { is_expected.to match /\n\[loweralpha\]\n\. loweralpha\n/ }
25
+ it { is_expected.to match /\n\[upperalpha\]\n\. upperalpha\n/ }
26
+ it { is_expected.to match /\n\[lowerroman\]\n\. lowerroman\n/ }
27
+ it { is_expected.to match /\n\[upperroman\]\n\. upperroman\n/ }
28
+ it { is_expected.to match /\n\[type=disc\]\n\* disc\n/ }
29
+ end
30
+
31
+ context "list start, reversed" do
32
+ it { is_expected.to match /\n\[start=3\]\n\. another ordered list entry\n/ }
33
+ it { is_expected.to match /\n\[%reversed\]\n\. a reversed ordered list entry\n/ }
34
+ end
35
+
36
+ context "nested list with no whitespace" do
37
+ it { is_expected.to match /\n\* item a\n/ }
38
+ it { is_expected.to match /\n\* item b\n/ }
39
+ it { is_expected.to match /\n\*\* item bb\n/ }
40
+ it { is_expected.to match /\n\*\* item bc\n/ }
41
+ end
42
+
43
+ context "nested list with lots of whitespace" do
44
+ it { is_expected.to match /\n\* item wa \n/ }
45
+ it { is_expected.to match /\n\* item wb \n/ }
46
+ it { is_expected.to match /\n\*\* item wbb \n/ }
47
+ it { is_expected.to match /\n\*\* item wbc \n/ }
48
+ end
49
+
50
+ context "lists containing links" do
51
+ it { is_expected.to match /\n\* link:Basic_concepts\[1 Basic concepts\]\n/ }
52
+ it { is_expected.to match /\n\* link:History_of_the_idea\[2 History of the idea\]\n/ }
53
+ it { is_expected.to match /\n\* link:Intelligence_explosion\[3 Intelligence explosion\]\n/ }
54
+ end
55
+
56
+ context "lists containing embedded <p> tags" do
57
+ xit { is_expected.to match /\n\* I want to have a party at my house!\n/ }
58
+ end
59
+
60
+ context "list item containing multiple <p> tags" do
61
+ xit { is_expected.to match /\n\* li 1, p 1\n\n\* li 1, p 2\n/ }
62
+ end
63
+
64
+ context 'it produces correct numbering' do
65
+ it { is_expected.to include "\. one" }
66
+ it { is_expected.to include "\.\. one one" }
67
+ it { is_expected.to include "\.\. one two" }
68
+ it { is_expected.to include "\. two" }
69
+ it { is_expected.to include "\.\. two one" }
70
+ it { is_expected.to include "\.\.\. two one one" }
71
+ it { is_expected.to include "\.\.\. two one two" }
72
+ it { is_expected.to include "\.\. two two" }
73
+ it { is_expected.to include "\. three" }
74
+ end
75
+
76
+ context "properly embeds a nested list between adjacent list items" do
77
+ it { is_expected.to match /\n\* alpha\n/ }
78
+ it { is_expected.to match /\n\* bravo/ }
79
+ it { is_expected.to match /\n\*\* bravo alpha\n/ }
80
+ it { is_expected.to match /\n\*\* bravo bravo/ }
81
+ it { is_expected.to match /\n\*\*\* bravo bravo alpha/ }
82
+ it { is_expected.to match /\n\* charlie\n/ }
83
+ it { is_expected.to match /\n\* delta\n/ }
84
+ end
85
+
86
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAsciidoctor do
4
+
5
+ let(:input) { File.read('spec/assets/paragraphs.html') }
6
+ let(:document) { Nokogiri::HTML(input) }
7
+ subject { ReverseAsciidoctor.convert(input) }
8
+
9
+ it { is_expected.not_to start_with "\n\n" }
10
+ it { is_expected.to start_with "First content\n\nSecond content\n\n" }
11
+ it { is_expected.to include "\n\n_Complex_\n\n\.\.\.\.\n\n <code>Content</code>\n" }
12
+ it { is_expected.to include "*Trailing whitespace:*" }
13
+ it { is_expected.to include "*Trailing non-breaking space:&nbsp;*" }
14
+ it { is_expected.to include "*_Combination:&nbsp;_*" }
15
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAsciidoctor do
4
+
5
+ let(:input) { File.read('spec/assets/quotation.html') }
6
+ let(:document) { Nokogiri::HTML(input) }
7
+ subject { ReverseAsciidoctor.convert(input) }
8
+
9
+ it { is_expected.to match /\n <code>Block of code<\/code>$/ }
10
+ it { is_expected.to include "\n____\nFirst quoted paragraph\n\nSecond quoted paragraph\n____\n" }
11
+
12
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAsciidoctor do
4
+
5
+ let(:input) { File.read('spec/assets/tables.html') }
6
+ let(:document) { Nokogiri::HTML(input) }
7
+ subject { ReverseAsciidoctor.convert(input) }
8
+
9
+ it { is_expected.to match /\[\[A\]\]\n\|===\n\| \[\[C\]\]header 1 \| header 2 \| header 3\n\n/ }
10
+ it { is_expected.to match /\nh\| \[\[D\]\]data 1-1 \| data 2-1 \| data 3-1\n/ }
11
+ it { is_expected.to match /\nh\| data 1-2 \| data 2-2 \| data 3-2\n/ }
12
+
13
+ it { is_expected.to match /\n\| _header oblique_ \| \*header bold\* \| `header code`\n\n/ }
14
+ it { is_expected.to match /\n\| _data oblique_ \| \*data bold\* \| `data code`\n/ }
15
+
16
+ it { is_expected.to match /\n\.2\+\| rowspan 2\n/ }
17
+ it { is_expected.to match /\n2\+| colspan 2\n/ }
18
+ it { is_expected.to match /\n2\.2\+| colrowspan 2\n/ }
19
+
20
+ it { is_expected.to match /<\| horizontal left / }
21
+ it { is_expected.to match /\^\| horizontal center / }
22
+ it { is_expected.to match />\| horizontal right\n/ }
23
+ it { is_expected.to match /\^\.\^\| center middle\n/ }
24
+
25
+ it { is_expected.to match /\n\.Table _caption_\n\|===\n/ }
26
+ it { is_expected.to match /\n\[width=75%\]\n\|===\n\| 75% width table\n/ }
27
+ it { is_expected.to match /\n\[frame=topbot,rules=cols\]\n\|===\n\| topbot\n/ }
28
+
29
+ it { is_expected.to match /\na|\nHello\n\nThis cell has multiple paragraphs\n\n/ }
30
+ it { is_expected.to match /\n\| This cell has a single paragraph\n/ }
31
+ end