reverse_adoc 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/README.adoc +4 -294
- data/Rakefile +2 -13
- data/reverse_adoc.gemspec +2 -20
- metadata +5 -246
- data/.editorconfig +0 -15
- data/.github/workflows/rake.yml +0 -15
- data/.gitignore +0 -10
- data/.hound.yml +0 -5
- data/.rubocop.yml +0 -10
- data/LICENSE.txt +0 -25
- data/exe/reverse_adoc +0 -70
- data/exe/w2a +0 -72
- data/lib/reverse_adoc/cleaner.rb +0 -113
- data/lib/reverse_adoc/config.rb +0 -54
- data/lib/reverse_adoc/converters/a.rb +0 -42
- data/lib/reverse_adoc/converters/aside.rb +0 -16
- data/lib/reverse_adoc/converters/audio.rb +0 -29
- data/lib/reverse_adoc/converters/base.rb +0 -100
- data/lib/reverse_adoc/converters/blockquote.rb +0 -27
- data/lib/reverse_adoc/converters/br.rb +0 -15
- data/lib/reverse_adoc/converters/bypass.rb +0 -81
- data/lib/reverse_adoc/converters/code.rb +0 -56
- data/lib/reverse_adoc/converters/div.rb +0 -18
- data/lib/reverse_adoc/converters/drop.rb +0 -22
- data/lib/reverse_adoc/converters/em.rb +0 -55
- data/lib/reverse_adoc/converters/figure.rb +0 -25
- data/lib/reverse_adoc/converters/h.rb +0 -42
- data/lib/reverse_adoc/converters/head.rb +0 -23
- data/lib/reverse_adoc/converters/hr.rb +0 -15
- data/lib/reverse_adoc/converters/ignore.rb +0 -16
- data/lib/reverse_adoc/converters/img.rb +0 -93
- data/lib/reverse_adoc/converters/li.rb +0 -17
- data/lib/reverse_adoc/converters/mark.rb +0 -21
- data/lib/reverse_adoc/converters/math.rb +0 -31
- data/lib/reverse_adoc/converters/ol.rb +0 -64
- data/lib/reverse_adoc/converters/p.rb +0 -23
- data/lib/reverse_adoc/converters/pass_through.rb +0 -13
- data/lib/reverse_adoc/converters/pre.rb +0 -55
- data/lib/reverse_adoc/converters/q.rb +0 -16
- data/lib/reverse_adoc/converters/strong.rb +0 -52
- data/lib/reverse_adoc/converters/sub.rb +0 -16
- data/lib/reverse_adoc/converters/sup.rb +0 -16
- data/lib/reverse_adoc/converters/table.rb +0 -69
- data/lib/reverse_adoc/converters/td.rb +0 -83
- data/lib/reverse_adoc/converters/text.rb +0 -65
- data/lib/reverse_adoc/converters/th.rb +0 -14
- data/lib/reverse_adoc/converters/tr.rb +0 -22
- data/lib/reverse_adoc/converters/video.rb +0 -29
- data/lib/reverse_adoc/converters.rb +0 -32
- data/lib/reverse_adoc/errors.rb +0 -10
- data/lib/reverse_adoc/html_converter.rb +0 -61
- data/lib/reverse_adoc/version.rb +0 -3
- data/lib/reverse_adoc.rb +0 -27
- data/spec/assets/anchors.html +0 -30
- data/spec/assets/basic.html +0 -61
- data/spec/assets/code.html +0 -22
- data/spec/assets/escapables.html +0 -17
- data/spec/assets/external_images.docx +0 -0
- data/spec/assets/external_images.html +0 -35
- data/spec/assets/from_the_wild.html +0 -23
- data/spec/assets/full_example.html +0 -49
- data/spec/assets/html_fragment.html +0 -3
- data/spec/assets/lists.html +0 -137
- data/spec/assets/minimum.html +0 -4
- data/spec/assets/paragraphs.html +0 -24
- data/spec/assets/quotation.html +0 -12
- data/spec/assets/tables.html +0 -99
- data/spec/assets/unknown_tags.html +0 -9
- data/spec/bin/reverse_adoc_spec.rb +0 -33
- data/spec/bin/w2a_spec.rb +0 -35
- data/spec/components/anchors_spec.rb +0 -32
- data/spec/components/basic_spec.rb +0 -63
- data/spec/components/code_spec.rb +0 -25
- data/spec/components/escapables_spec.rb +0 -30
- data/spec/components/from_the_wild_spec.rb +0 -15
- data/spec/components/html_fragment_spec.rb +0 -9
- data/spec/components/lists_spec.rb +0 -90
- data/spec/components/paragraphs_spec.rb +0 -14
- data/spec/components/quotation_spec.rb +0 -12
- data/spec/components/tables_spec.rb +0 -42
- data/spec/components/unknown_tags_spec.rb +0 -41
- data/spec/lib/reverse_adoc/cleaner_spec.rb +0 -180
- data/spec/lib/reverse_adoc/config_spec.rb +0 -25
- data/spec/lib/reverse_adoc/converters/aside_spec.rb +0 -11
- data/spec/lib/reverse_adoc/converters/audio_spec.rb +0 -15
- data/spec/lib/reverse_adoc/converters/blockquote_spec.rb +0 -23
- data/spec/lib/reverse_adoc/converters/br_spec.rb +0 -9
- data/spec/lib/reverse_adoc/converters/code_spec.rb +0 -15
- data/spec/lib/reverse_adoc/converters/div_spec.rb +0 -15
- data/spec/lib/reverse_adoc/converters/figure_spec.rb +0 -10
- data/spec/lib/reverse_adoc/converters/img_spec.rb +0 -25
- data/spec/lib/reverse_adoc/converters/li_spec.rb +0 -11
- data/spec/lib/reverse_adoc/converters/mark_spec.rb +0 -10
- data/spec/lib/reverse_adoc/converters/p_spec.rb +0 -10
- data/spec/lib/reverse_adoc/converters/pre_spec.rb +0 -43
- data/spec/lib/reverse_adoc/converters/q_spec.rb +0 -10
- data/spec/lib/reverse_adoc/converters/strong_spec.rb +0 -21
- data/spec/lib/reverse_adoc/converters/text_spec.rb +0 -67
- data/spec/lib/reverse_adoc/converters/video_spec.rb +0 -15
- data/spec/lib/reverse_adoc/converters_spec.rb +0 -22
- data/spec/lib/reverse_adoc.rb +0 -90
- data/spec/spec_helper.rb +0 -25
- data/spec/support/shell_helpers.rb +0 -15
@@ -1,49 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<body>
|
3
|
-
<ul>
|
4
|
-
<li>li 1</li>
|
5
|
-
<li>li 2</li>
|
6
|
-
<li>li 3</li>
|
7
|
-
</ul>
|
8
|
-
<ul>
|
9
|
-
<li>li 1</li>
|
10
|
-
<li>li 2</li>
|
11
|
-
<li>li 3</li>
|
12
|
-
</ul>
|
13
|
-
<ol>
|
14
|
-
<li>li 1</li>
|
15
|
-
<li>
|
16
|
-
<ul>
|
17
|
-
<li>eins</li>
|
18
|
-
<li>eins</li>
|
19
|
-
<li>eins</li>
|
20
|
-
</ul>
|
21
|
-
</li>
|
22
|
-
</ol>
|
23
|
-
<ol>
|
24
|
-
<li>li 1</li>
|
25
|
-
<li>li 2</li>
|
26
|
-
</ol>
|
27
|
-
<h1>h1</h1>
|
28
|
-
<h2>h2</h2>
|
29
|
-
<h3>h3</h3>
|
30
|
-
<h4>h4</h4>
|
31
|
-
<p>
|
32
|
-
Hallo <em>em</em> Text
|
33
|
-
</p>
|
34
|
-
<p>
|
35
|
-
<strong>strong</strong>
|
36
|
-
</p>
|
37
|
-
<pre>
|
38
|
-
<code>Block of code</code>
|
39
|
-
</pre>
|
40
|
-
|
41
|
-
<blockquote>
|
42
|
-
<p>First quoted paragraph</p>
|
43
|
-
<p>Second quoted paragraph</p>
|
44
|
-
</blockquote>
|
45
|
-
<a href="http://www.bla.com">link</a>
|
46
|
-
<img src="http://raw.com">
|
47
|
-
<hr>
|
48
|
-
</body>
|
49
|
-
</html>
|
data/spec/assets/lists.html
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<body>
|
3
|
-
<p>some text...</p>
|
4
|
-
|
5
|
-
<ul>
|
6
|
-
<li>unordered list entry</li>
|
7
|
-
<li>unordered list entry 2</li>
|
8
|
-
</ul>
|
9
|
-
|
10
|
-
<ol>
|
11
|
-
<li>ordered list entry</li>
|
12
|
-
<li>ordered list entry 2</li>
|
13
|
-
</ol>
|
14
|
-
|
15
|
-
<ol start="3">
|
16
|
-
<li>another ordered list entry</li>
|
17
|
-
</ol>
|
18
|
-
|
19
|
-
<ol reversed>
|
20
|
-
<li>a reversed ordered list entry</li>
|
21
|
-
</ol>
|
22
|
-
|
23
|
-
<ol>
|
24
|
-
<li>list entry 1st hierarchy</li>
|
25
|
-
<li>
|
26
|
-
<ul>
|
27
|
-
<li>nested unsorted list entry</li>
|
28
|
-
<li>
|
29
|
-
<ol>
|
30
|
-
<li>deep nested list entry</li>
|
31
|
-
</ol>
|
32
|
-
</li>
|
33
|
-
</ul>
|
34
|
-
</li>
|
35
|
-
</ol>
|
36
|
-
|
37
|
-
<ol id="1">
|
38
|
-
<li>arabic1</li>
|
39
|
-
</ol>
|
40
|
-
|
41
|
-
<ul id="A">
|
42
|
-
<li>upperalpha1</li>
|
43
|
-
</ul>
|
44
|
-
|
45
|
-
<ol style="1">
|
46
|
-
<li>arabic</li>
|
47
|
-
</ol>
|
48
|
-
|
49
|
-
<ol style="A">
|
50
|
-
<li>upperalpha</li>
|
51
|
-
</ol>
|
52
|
-
|
53
|
-
<ol style="a">
|
54
|
-
<li>loweralpha</li>
|
55
|
-
</ol>
|
56
|
-
|
57
|
-
<ol style="I">
|
58
|
-
<li>upperroman</li>
|
59
|
-
</ol>
|
60
|
-
|
61
|
-
<ol style="i">
|
62
|
-
<li>lowerroman</li>
|
63
|
-
</ol>
|
64
|
-
|
65
|
-
<ul type="disc">
|
66
|
-
<li>disc</li>
|
67
|
-
</ul>
|
68
|
-
|
69
|
-
<p>a nested list with no whitespace:</p>
|
70
|
-
<ul><li>item a</li><li>item b<ul><li>item bb</li><li>item bc</li></ul></li></ul>
|
71
|
-
|
72
|
-
<p>a nested list with lots of whitespace:</p>
|
73
|
-
<ul> <li> item wa </li> <li> item wb <ul> <li> item wbb </li> <li> item wbc </li> </ul> </li> </ul>
|
74
|
-
|
75
|
-
<ul>
|
76
|
-
<li class="toclevel-1 tocsection-1"><a href="Basic_concepts"><span class="tocnumber">1</span> <span class="toctext">Basic concepts</span></a></li>
|
77
|
-
<li class="toclevel-1 tocsection-2"><a href="History_of_the_idea"><span class="tocnumber">2</span> <span class="toctext">History of the idea</span></a></li>
|
78
|
-
<li class="toclevel-1 tocsection-3"><a href="Intelligence_explosion"><span class="tocnumber">3</span> <span class="toctext">Intelligence explosion</span></a>
|
79
|
-
</ul>
|
80
|
-
|
81
|
-
<ul>
|
82
|
-
<li>
|
83
|
-
<p dir="ltr">I want to have a party at my house!</p>
|
84
|
-
</li>
|
85
|
-
</ul>
|
86
|
-
|
87
|
-
<ul>
|
88
|
-
<li>
|
89
|
-
<p>li 1, p 1</p>
|
90
|
-
<p>li 1, p 2</p>
|
91
|
-
</li>
|
92
|
-
<li><p>li 2, p 1</p></li>
|
93
|
-
</ul>
|
94
|
-
|
95
|
-
<ol>
|
96
|
-
<li>
|
97
|
-
one
|
98
|
-
<ol>
|
99
|
-
<li>one one</li>
|
100
|
-
<li>one two</li>
|
101
|
-
</ol>
|
102
|
-
</li>
|
103
|
-
<li>
|
104
|
-
two
|
105
|
-
<ol>
|
106
|
-
<li>
|
107
|
-
two one
|
108
|
-
<ol>
|
109
|
-
<li>two one one</li>
|
110
|
-
<li>two one two</li>
|
111
|
-
</ol>
|
112
|
-
</li>
|
113
|
-
<li>two two</li>
|
114
|
-
</ol>
|
115
|
-
</li>
|
116
|
-
<li>three</li>
|
117
|
-
</ol>
|
118
|
-
|
119
|
-
<p>a nested list between adjacent list items</p>
|
120
|
-
<ul>
|
121
|
-
<li>alpha</li>
|
122
|
-
<li>bravo
|
123
|
-
<ul>
|
124
|
-
<li>bravo alpha</li>
|
125
|
-
<li>bravo bravo
|
126
|
-
<ul>
|
127
|
-
<li>bravo bravo alpha</i>
|
128
|
-
</ul>
|
129
|
-
</li>
|
130
|
-
</ul>
|
131
|
-
</li>
|
132
|
-
<li>charlie</li>
|
133
|
-
<li>delta</li>
|
134
|
-
</ul>
|
135
|
-
|
136
|
-
</body>
|
137
|
-
</html>
|
data/spec/assets/minimum.html
DELETED
data/spec/assets/paragraphs.html
DELETED
@@ -1,24 +0,0 @@
|
|
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: </strong>
|
19
|
-
</p>
|
20
|
-
<p>
|
21
|
-
<strong><em>Combination: </em></strong>
|
22
|
-
</p>
|
23
|
-
</body>
|
24
|
-
</html>
|
data/spec/assets/quotation.html
DELETED
data/spec/assets/tables.html
DELETED
@@ -1,99 +0,0 @@
|
|
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>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe "exe/reverse_adoc" do
|
6
|
-
subject(:convert) do
|
7
|
-
ShellUtils.execute!("./exe/reverse_adoc -e -o test1 #{input_file_path}")
|
8
|
-
end
|
9
|
-
|
10
|
-
unless Gem.win_platform?
|
11
|
-
context "when external images present" do
|
12
|
-
let(:input_file_path) { "spec/assets/external_images.html" }
|
13
|
-
let(:images_folder) { "images" }
|
14
|
-
|
15
|
-
after do
|
16
|
-
FileUtils.rm_rf(images_folder) if File.directory?(images_folder)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "Does not raise error" do
|
20
|
-
expect { convert }.to_not raise_error
|
21
|
-
end
|
22
|
-
|
23
|
-
it "exatracts images from source html" do
|
24
|
-
expect { convert }
|
25
|
-
.to(change do
|
26
|
-
Dir["#{images_folder}/*gif"]
|
27
|
-
.map { |entry| File.basename(entry) }
|
28
|
-
.sort
|
29
|
-
end.from([]).to(["001.gif"]))
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/spec/bin/w2a_spec.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe "exe/w2a" do
|
6
|
-
subject(:convert) do
|
7
|
-
ShellUtils.execute!("./exe/w2a -e -o test1 #{input_file_path}")
|
8
|
-
end
|
9
|
-
|
10
|
-
# TODO: fix github actions integration with libreoffice, currently it hangs
|
11
|
-
# when trying to use soffice binary
|
12
|
-
unless Gem.win_platform? ||
|
13
|
-
(Gem::Platform.local.os == "darwin" && !ENV["GITHUB_ACTION"].nil?)
|
14
|
-
context "when external images present" do
|
15
|
-
let(:input_file_path) { "spec/assets/external_images.docx" }
|
16
|
-
let(:images_folder) { "images" }
|
17
|
-
|
18
|
-
after do
|
19
|
-
FileUtils.rm_rf(images_folder) if File.directory?(images_folder)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "Does not raise error" do
|
23
|
-
expect { convert }.to_not raise_error
|
24
|
-
end
|
25
|
-
|
26
|
-
it "extracts images from source html" do
|
27
|
-
expect { convert }
|
28
|
-
.to(change do
|
29
|
-
!Dir["#{images_folder}/*gif"]
|
30
|
-
.map { |entry| File.basename(entry) }.empty?
|
31
|
-
end.from(false).to(true))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe ReverseAdoc do
|
4
|
-
let(:input) { File.read("spec/assets/anchors.html") }
|
5
|
-
let(:document) { Nokogiri::HTML(input) }
|
6
|
-
subject { ReverseAdoc.convert(input) }
|
7
|
-
|
8
|
-
it { is_expected.to include "http://foobar.com[Foobar]" }
|
9
|
-
it { is_expected.to include "http://foobar.com[Fubar]" }
|
10
|
-
it { is_expected.to include 'http://foobar.com[f\*\*\*\*\* up beyond all redemption]' }
|
11
|
-
it { is_expected.to include "http://strong.foobar.com[*Strong foobar*]" }
|
12
|
-
|
13
|
-
it {
|
14
|
-
is_expected.to include "There should be space before but not after the anchor ( http://foobar.com[stripped])."
|
15
|
-
}
|
16
|
-
|
17
|
-
it {
|
18
|
-
is_expected.to include " do not ignore link:foo.html[] anchor tags with no link text "
|
19
|
-
}
|
20
|
-
it {
|
21
|
-
is_expected.to include " link <<content,internal jumplinks>> with anchors "
|
22
|
-
}
|
23
|
-
it {
|
24
|
-
is_expected.to include " link <<content2>>internal jumplinks without anchors "
|
25
|
-
}
|
26
|
-
it { is_expected.to include " treat [[content]] as bookmarks " }
|
27
|
-
|
28
|
-
it { is_expected.to include "<<a_bspaced,Double \\_\\_ anchor with space>>" }
|
29
|
-
it { is_expected.to include "[[a_bspaced]]" }
|
30
|
-
it { is_expected.to include "[[a_Foreword]]\n== Text" }
|
31
|
-
it { is_expected.not_to include "[[_Toc12345]]" }
|
32
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe ReverseAdoc do
|
4
|
-
let(:input) { File.read("spec/assets/basic.html") }
|
5
|
-
# let(:document) { Nokogiri::HTML(input) }
|
6
|
-
subject { ReverseAdoc.convert(input) }
|
7
|
-
|
8
|
-
it { is_expected.to match /plain text ?\n/ }
|
9
|
-
it { is_expected.to match /\n== h1\n/ }
|
10
|
-
it { is_expected.to match /\n\[\[A\]\]\n== h1 with anchor\n/ }
|
11
|
-
it { is_expected.to match /\n=== h2\n/ }
|
12
|
-
it { is_expected.to match /\n==== h3\n/ }
|
13
|
-
it { is_expected.to match /\n===== h4\n/ }
|
14
|
-
it { is_expected.to match /\n====== h5\n/ }
|
15
|
-
it { is_expected.to match /\n======= h6\n/ }
|
16
|
-
|
17
|
-
it { is_expected.to match /_em tag content_/ }
|
18
|
-
it { is_expected.to match /before and after empty em tags/ }
|
19
|
-
it { is_expected.to match /before and after em tags containing whitespace/ }
|
20
|
-
it { is_expected.to match /_double em tags_/ }
|
21
|
-
it { is_expected.to match /_double em tags in p tag_/ }
|
22
|
-
it { is_expected.to match /a _em with leading and trailing_ whitespace/ }
|
23
|
-
it {
|
24
|
-
is_expected.to match /a _em with extra leading and trailing_ whitespace/
|
25
|
-
}
|
26
|
-
|
27
|
-
it { is_expected.to match /\*strong tag content\*/ }
|
28
|
-
it { is_expected.to match /before and after empty strong tags/ }
|
29
|
-
it {
|
30
|
-
is_expected.to match /before and after strong tags containing whitespace/
|
31
|
-
}
|
32
|
-
it { is_expected.to match /\*double strong tags\*/ }
|
33
|
-
it { is_expected.to match /\*double strong tags in p tag\*/ }
|
34
|
-
it {
|
35
|
-
is_expected.to match /before \*double strong tags containing whitespace\* after/
|
36
|
-
}
|
37
|
-
it {
|
38
|
-
is_expected.to match /a \*strong with leading and trailing\* whitespace/
|
39
|
-
}
|
40
|
-
it {
|
41
|
-
is_expected.to match /a \*strong with extra leading and trailing\* whitespace/
|
42
|
-
}
|
43
|
-
|
44
|
-
it { is_expected.to match /constrai\*\*ned\*\* strong/ }
|
45
|
-
it { is_expected.to match /constrai__ned__ italic/ }
|
46
|
-
|
47
|
-
it { is_expected.to match /_i tag content_/ }
|
48
|
-
it { is_expected.to match /\*b tag content\*/ }
|
49
|
-
|
50
|
-
it { is_expected.to match /H~2~O/ }
|
51
|
-
it { is_expected.to match /A\^2\^B/ }
|
52
|
-
|
53
|
-
it {
|
54
|
-
is_expected.to match /br tags become double space followed by newline \+\n/
|
55
|
-
}
|
56
|
-
# it { should match /br tags XXX \n/ }
|
57
|
-
|
58
|
-
it { is_expected.to match /before hr \n\* \* \*\n after hr/ }
|
59
|
-
|
60
|
-
it { is_expected.to match /section 1\n ?\nsection 2/ }
|
61
|
-
|
62
|
-
it { is_expected.to match /ignore abbr/ }
|
63
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe ReverseAdoc do
|
4
|
-
let(:input) { File.read("spec/assets/code.html") }
|
5
|
-
let(:document) { Nokogiri::HTML(input) }
|
6
|
-
subject { ReverseAdoc.convert(input) }
|
7
|
-
|
8
|
-
it { is_expected.to match /inline `code` block/ }
|
9
|
-
it { is_expected.to match /\nvar this;\nthis\.is/ }
|
10
|
-
it { is_expected.to match /block"\)\nconsole/ }
|
11
|
-
|
12
|
-
context "with github style code blocks" do
|
13
|
-
subject { ReverseAdoc.convert(input) }
|
14
|
-
it { is_expected.to match /inline `code` block/ }
|
15
|
-
it { is_expected.to match /\n\.\.\.\.\nvar this;\nthis/ }
|
16
|
-
it { is_expected.to match /it is"\) ?\n \n\.\.\.\./ }
|
17
|
-
end
|
18
|
-
|
19
|
-
context "code with indentation" do
|
20
|
-
subject { ReverseAdoc.convert(input) }
|
21
|
-
it { is_expected.to match(/^tell application "Foo"\n/) }
|
22
|
-
it { is_expected.to match(/^ beep\n/) }
|
23
|
-
it { is_expected.to match(/^end tell\n/) }
|
24
|
-
end
|
25
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe ReverseAdoc do
|
4
|
-
let(:input) { File.read("spec/assets/escapables.html") }
|
5
|
-
let(:document) { Nokogiri::HTML(input) }
|
6
|
-
subject { ReverseAdoc.convert(input) }
|
7
|
-
|
8
|
-
context "multiple asterisks" do
|
9
|
-
it { is_expected.to include ' \*\*two asterisks\*\* ' }
|
10
|
-
it { is_expected.to include ' \*\*\*three asterisks\*\*\* ' }
|
11
|
-
it { is_expected.to include ' \*and*the\* ' }
|
12
|
-
it { is_expected.to include " asterisc*word " }
|
13
|
-
it { is_expected.to include ' asterisc**multword asterisks\*\*\* ' }
|
14
|
-
end
|
15
|
-
|
16
|
-
context "multiple underscores" do
|
17
|
-
it { is_expected.to include ' \_\_two underscores\_\_ ' }
|
18
|
-
it { is_expected.to include ' \_\_\_three underscores\_\_\_ ' }
|
19
|
-
end
|
20
|
-
|
21
|
-
context "multiple underscores with undersocre inside words and new lines" do
|
22
|
-
it { is_expected.to include "another_undersocre" }
|
23
|
-
it { is_expected.to include ' \_\_\_three__underscores\_\_\_ ' }
|
24
|
-
end
|
25
|
-
|
26
|
-
context "underscores within words in code blocks" do
|
27
|
-
let(:expected_output) { "....\nvar theoretical_max_infin = 1.0;\n....\n" }
|
28
|
-
it { is_expected.to include expected_output }
|
29
|
-
end
|
30
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe ReverseAdoc do
|
4
|
-
let(:input) { File.read("spec/assets/from_the_wild.html") }
|
5
|
-
let(:document) { Nokogiri::HTML(input) }
|
6
|
-
subject { ReverseAdoc.convert(input) }
|
7
|
-
|
8
|
-
it "should make sense of strong-crazy markup (as seen in the wild)" do
|
9
|
-
expect(subject).to include "*. +\n \\*\\*\\* intentcast* : logo design *+*\n"
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should not over escape * or _" do
|
13
|
-
expect(subject).to include 'link:example.com/foo_bar[image::example.com/foo_bar.png[] I\_AM\_HELPFUL]'
|
14
|
-
end
|
15
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe ReverseAdoc do
|
4
|
-
let(:input) { File.read("spec/assets/html_fragment.html") }
|
5
|
-
let(:document) { Nokogiri::HTML(input) }
|
6
|
-
subject { ReverseAdoc.convert(input) }
|
7
|
-
|
8
|
-
it { is_expected.to eq("naked text 1\n\nparagraph text\n\nnaked text 2") }
|
9
|
-
end
|