reverse_adoc 0.3.6 → 1.0.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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +4 -3
  3. data/Gemfile +1 -1
  4. data/Rakefile +7 -7
  5. data/exe/reverse_adoc +11 -11
  6. data/exe/w2a +15 -16
  7. data/lib/reverse_adoc/cleaner.rb +17 -18
  8. data/lib/reverse_adoc/config.rb +7 -7
  9. data/lib/reverse_adoc/converters/a.rb +24 -24
  10. data/lib/reverse_adoc/converters/aside.rb +6 -4
  11. data/lib/reverse_adoc/converters/audio.rb +16 -21
  12. data/lib/reverse_adoc/converters/base.rb +79 -5
  13. data/lib/reverse_adoc/converters/blockquote.rb +16 -7
  14. data/lib/reverse_adoc/converters/br.rb +5 -1
  15. data/lib/reverse_adoc/converters/bypass.rb +38 -34
  16. data/lib/reverse_adoc/converters/code.rb +42 -1
  17. data/lib/reverse_adoc/converters/div.rb +7 -3
  18. data/lib/reverse_adoc/converters/drop.rb +6 -2
  19. data/lib/reverse_adoc/converters/em.rb +44 -7
  20. data/lib/reverse_adoc/converters/figure.rb +10 -6
  21. data/lib/reverse_adoc/converters/h.rb +19 -11
  22. data/lib/reverse_adoc/converters/head.rb +7 -2
  23. data/lib/reverse_adoc/converters/hr.rb +5 -1
  24. data/lib/reverse_adoc/converters/ignore.rb +6 -2
  25. data/lib/reverse_adoc/converters/img.rb +29 -19
  26. data/lib/reverse_adoc/converters/li.rb +6 -13
  27. data/lib/reverse_adoc/converters/mark.rb +11 -2
  28. data/lib/reverse_adoc/converters/math.rb +13 -2
  29. data/lib/reverse_adoc/converters/ol.rb +44 -26
  30. data/lib/reverse_adoc/converters/p.rb +13 -7
  31. data/lib/reverse_adoc/converters/pass_through.rb +5 -1
  32. data/lib/reverse_adoc/converters/pre.rb +23 -10
  33. data/lib/reverse_adoc/converters/q.rb +6 -2
  34. data/lib/reverse_adoc/converters/strong.rb +41 -6
  35. data/lib/reverse_adoc/converters/sub.rb +6 -2
  36. data/lib/reverse_adoc/converters/sup.rb +6 -2
  37. data/lib/reverse_adoc/converters/table.rb +28 -23
  38. data/lib/reverse_adoc/converters/td.rb +32 -16
  39. data/lib/reverse_adoc/converters/text.rb +19 -19
  40. data/lib/reverse_adoc/converters/th.rb +4 -6
  41. data/lib/reverse_adoc/converters/tr.rb +7 -7
  42. data/lib/reverse_adoc/converters/video.rb +16 -23
  43. data/lib/reverse_adoc/converters.rb +2 -3
  44. data/lib/reverse_adoc/html_converter.rb +48 -43
  45. data/lib/reverse_adoc/version.rb +1 -1
  46. data/lib/reverse_adoc.rb +9 -9
  47. data/reverse_adoc.gemspec +6 -3
  48. data/spec/assets/basic.html +3 -0
  49. data/spec/bin/reverse_adoc_spec.rb +9 -8
  50. data/spec/bin/w2a_spec.rb +12 -12
  51. data/spec/components/anchors_spec.rb +18 -12
  52. data/spec/components/basic_spec.rb +28 -14
  53. data/spec/components/code_spec.rb +2 -4
  54. data/spec/components/escapables_spec.rb +4 -6
  55. data/spec/components/from_the_wild_spec.rb +2 -4
  56. data/spec/components/html_fragment_spec.rb +2 -3
  57. data/spec/components/lists_spec.rb +12 -8
  58. data/spec/components/paragraphs_spec.rb +2 -3
  59. data/spec/components/quotation_spec.rb +5 -5
  60. data/spec/components/tables_spec.rb +22 -11
  61. data/spec/components/unknown_tags_spec.rb +13 -10
  62. data/spec/lib/reverse_adoc/cleaner_spec.rb +70 -71
  63. data/spec/lib/reverse_adoc/config_spec.rb +5 -6
  64. data/spec/lib/reverse_adoc/converters/aside_spec.rb +2 -3
  65. data/spec/lib/reverse_adoc/converters/audio_spec.rb +3 -5
  66. data/spec/lib/reverse_adoc/converters/blockquote_spec.rb +5 -6
  67. data/spec/lib/reverse_adoc/converters/br_spec.rb +2 -2
  68. data/spec/lib/reverse_adoc/converters/code_spec.rb +3 -5
  69. data/spec/lib/reverse_adoc/converters/div_spec.rb +3 -5
  70. data/spec/lib/reverse_adoc/converters/figure_spec.rb +2 -4
  71. data/spec/lib/reverse_adoc/converters/img_spec.rb +5 -7
  72. data/spec/lib/reverse_adoc/converters/li_spec.rb +2 -4
  73. data/spec/lib/reverse_adoc/converters/mark_spec.rb +4 -4
  74. data/spec/lib/reverse_adoc/converters/p_spec.rb +2 -3
  75. data/spec/lib/reverse_adoc/converters/pre_spec.rb +8 -9
  76. data/spec/lib/reverse_adoc/converters/q_spec.rb +3 -3
  77. data/spec/lib/reverse_adoc/converters/strong_spec.rb +9 -8
  78. data/spec/lib/reverse_adoc/converters/text_spec.rb +21 -16
  79. data/spec/lib/reverse_adoc/converters/video_spec.rb +7 -9
  80. data/spec/lib/reverse_adoc/converters_spec.rb +9 -6
  81. data/spec/lib/reverse_adoc.rb +25 -25
  82. data/spec/spec_helper.rb +11 -11
  83. data/spec/support/shell_helpers.rb +1 -1
  84. metadata +20 -6
@@ -1,9 +1,9 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Cleaner do
4
4
  let(:cleaner) { ReverseAdoc::Cleaner.new }
5
5
 
6
- describe '#scrub_whitespace' do
6
+ describe "#scrub_whitespace" do
7
7
  it "makes consistent nonbreaking spaces" do
8
8
  result = cleaner.scrub_whitespace("     ")
9
9
  expect(result).to eq "     "
@@ -15,7 +15,7 @@ describe ReverseAdoc::Cleaner do
15
15
  end
16
16
  end
17
17
 
18
- describe '#clean_headings' do
18
+ describe "#clean_headings" do
19
19
  it "removes empty headings" do
20
20
  result = cleaner.clean_headings("<h2></h2>")
21
21
  expect(result).to eq " "
@@ -27,84 +27,84 @@ describe ReverseAdoc::Cleaner do
27
27
  end
28
28
  end
29
29
 
30
- describe '#remove_newlines' do
31
- it 'removes more than 2 subsequent newlines' do
30
+ describe "#remove_newlines" do
31
+ it "removes more than 2 subsequent newlines" do
32
32
  result = cleaner.remove_newlines("foo\n\n\nbar")
33
33
  expect(result).to eq "foo\n\nbar"
34
34
  end
35
35
 
36
- it 'skips single and double newlines' do
36
+ it "skips single and double newlines" do
37
37
  result = cleaner.remove_newlines("foo\nbar\n\nbaz")
38
38
  expect(result).to eq "foo\nbar\n\nbaz"
39
39
  end
40
40
  end
41
41
 
42
- describe '#remove_inner_whitespaces' do
43
- it 'removes duplicate whitespaces from the string' do
44
- result = cleaner.remove_inner_whitespaces('foo bar')
42
+ describe "#remove_inner_whitespaces" do
43
+ it "removes duplicate whitespaces from the string" do
44
+ result = cleaner.remove_inner_whitespaces("foo bar")
45
45
  expect(result).to eq "foo bar"
46
46
  end
47
47
 
48
- it 'performs changes for multiple lines' do
48
+ it "performs changes for multiple lines" do
49
49
  result = cleaner.remove_inner_whitespaces("foo bar\nbar foo")
50
50
  expect(result).to eq "foo bar\nbar foo"
51
51
  end
52
52
 
53
- it 'keeps leading whitespaces' do
53
+ it "keeps leading whitespaces" do
54
54
  result = cleaner.remove_inner_whitespaces(" foo bar\n bar foo")
55
55
  expect(result).to eq " foo bar\n bar foo"
56
56
  end
57
57
 
58
- it 'keeps trailing whitespaces' do
58
+ it "keeps trailing whitespaces" do
59
59
  result = cleaner.remove_inner_whitespaces("foo \n")
60
60
  expect(result).to eq "foo \n"
61
61
  end
62
62
 
63
- it 'keeps trailing newlines' do
63
+ it "keeps trailing newlines" do
64
64
  result = cleaner.remove_inner_whitespaces("foo\n")
65
65
  expect(result).to eq "foo\n"
66
66
  end
67
67
 
68
- it 'removes tabs as well' do
68
+ it "removes tabs as well" do
69
69
  result = cleaner.remove_inner_whitespaces("foo\t \tbar")
70
70
  expect(result).to eq "foo bar"
71
71
  end
72
72
 
73
- it 'keeps lines that only contain whitespace' do
73
+ it "keeps lines that only contain whitespace" do
74
74
  result = cleaner.remove_inner_whitespaces("foo \nbar \n \n \nfoo")
75
75
  expect(result).to eq "foo \nbar \n \n \nfoo"
76
76
  end
77
77
  end
78
78
 
79
- describe '#clean_punctuation_characters' do
80
- it 'removes whitespace between tag end and punctuation characters' do
79
+ describe "#clean_punctuation_characters" do
80
+ it "removes whitespace between tag end and punctuation characters" do
81
81
  input = "**fat** . ~~strike~~ ? __italic__ ! "
82
82
  result = cleaner.clean_punctuation_characters(input)
83
83
  expect(result).to eq "**fat**. ~~strike~~? __italic__! "
84
84
  end
85
85
  end
86
86
 
87
- describe '#clean_tag_borders' do
88
- context 'with default_border is set to space' do
89
- before { ReverseAdoc.config.tag_border = ' ' }
87
+ describe "#clean_tag_borders" do
88
+ context "with default_border is set to space" do
89
+ before { ReverseAdoc.config.tag_border = " " }
90
90
 
91
- it 'removes not needed whitespaces from strong tags' do
92
- input = "foo ** foobar ** bar"
93
- result = cleaner.clean_tag_borders(input)
94
- expect(result).to eq "foo **foobar** bar"
95
- end
91
+ # it 'removes not needed whitespaces from strong tags' do
92
+ # input = "foo ** foobar ** bar"
93
+ # result = cleaner.clean_tag_borders(input)
94
+ # expect(result).to eq "foo **foobar** bar"
95
+ # end
96
96
 
97
- it 'remotes leading or trailing whitespaces independently' do
98
- input = "1 **fat ** 2 ** fat** 3"
99
- result = cleaner.clean_tag_borders(input)
100
- expect(result).to eq "1 **fat** 2 **fat** 3"
101
- end
97
+ # it 'remotes leading or trailing whitespaces independently' do
98
+ # input = "1 **fat ** 2 ** fat** 3"
99
+ # result = cleaner.clean_tag_borders(input)
100
+ # expect(result).to eq "1 **fat** 2 **fat** 3"
101
+ # end
102
102
 
103
- it 'adds whitespaces if there are none' do
104
- input = "1**fat**2"
105
- result = cleaner.clean_tag_borders(input)
106
- expect(result).to eq "1 **fat** 2"
107
- end
103
+ # it 'adds whitespaces if there are none' do
104
+ # input = "1**fat**2"
105
+ # result = cleaner.clean_tag_borders(input)
106
+ # expect(result).to eq "1 **fat** 2"
107
+ # end
108
108
 
109
109
  it "doesn't add whitespaces to underscore'ed elements if they are part of links" do
110
110
  input = "![im__age](sou__rce)"
@@ -112,41 +112,41 @@ describe ReverseAdoc::Cleaner do
112
112
  expect(result).to eq "![im__age](sou__rce)"
113
113
  end
114
114
 
115
- it "still cleans up whitespaces that aren't inside a link" do
116
- input = "now __italic __with following [under__scored](link)"
117
- result = cleaner.clean_tag_borders(input)
118
- expect(result).to eq "now __italic__ with following [under__scored](link)"
119
- end
115
+ # it "still cleans up whitespaces that aren't inside a link" do
116
+ # input = "now __italic __with following [under__scored](link)"
117
+ # result = cleaner.clean_tag_borders(input)
118
+ # expect(result).to eq "now __italic__ with following [under__scored](link)"
119
+ # end
120
120
 
121
- it 'cleans italic stuff as well' do
122
- input = "1 __italic __ 2 __ italic__ 3__italic __4"
123
- result = cleaner.clean_tag_borders(input)
124
- expect(result).to eq "1 __italic__ 2 __italic__ 3 __italic__ 4"
125
- end
121
+ # it 'cleans italic stuff as well' do
122
+ # input = "1 __italic __ 2 __ italic__ 3__italic __4"
123
+ # result = cleaner.clean_tag_borders(input)
124
+ # expect(result).to eq "1 __italic__ 2 __italic__ 3 __italic__ 4"
125
+ # end
126
126
 
127
- it 'cleans strikethrough stuff as well' do
127
+ it "cleans strikethrough stuff as well" do
128
128
  input = "1 ~~italic ~~ 2 ~~ italic~~ 3~~italic ~~4"
129
129
  result = cleaner.clean_tag_borders(input)
130
130
  expect(result).to eq "1 ~~italic~~ 2 ~~italic~~ 3 ~~italic~~ 4"
131
131
  end
132
132
  end
133
133
 
134
- context 'with default_border set to no space' do
135
- before { ReverseAdoc.config.tag_border = '' }
134
+ context "with default_border set to no space" do
135
+ before { ReverseAdoc.config.tag_border = "" }
136
136
 
137
- it 'removes not needed whitespaces from strong tags' do
138
- input = "foo ** foobar ** bar"
139
- result = cleaner.clean_tag_borders(input)
140
- expect(result).to eq "foo **foobar** bar"
141
- end
137
+ # it 'removes not needed whitespaces from strong tags' do
138
+ # input = "foo ** foobar ** bar"
139
+ # result = cleaner.clean_tag_borders(input)
140
+ # expect(result).to eq "foo **foobar** bar"
141
+ # end
142
142
 
143
- it 'remotes leading or trailing whitespaces independently' do
144
- input = "1 **fat ** 2 ** fat** 3"
145
- result = cleaner.clean_tag_borders(input)
146
- expect(result).to eq "1 **fat** 2 **fat** 3"
147
- end
143
+ # it 'remotes leading or trailing whitespaces independently' do
144
+ # input = "1 **fat ** 2 ** fat** 3"
145
+ # result = cleaner.clean_tag_borders(input)
146
+ # expect(result).to eq "1 **fat** 2 **fat** 3"
147
+ # end
148
148
 
149
- it 'adds whitespaces if there are none' do
149
+ it "adds whitespaces if there are none" do
150
150
  input = "1**fat**2"
151
151
  result = cleaner.clean_tag_borders(input)
152
152
  expect(result).to eq "1**fat**2"
@@ -158,24 +158,23 @@ describe ReverseAdoc::Cleaner do
158
158
  expect(result).to eq "![im__age](sou__rce)"
159
159
  end
160
160
 
161
- it "still cleans up whitespaces that aren't inside a link" do
162
- input = "now __italic __with following [under__scored](link)"
163
- result = cleaner.clean_tag_borders(input)
164
- expect(result).to eq "now __italic__with following [under__scored](link)"
165
- end
161
+ # it "still cleans up whitespaces that aren't inside a link" do
162
+ # input = "now __italic __with following [under__scored](link)"
163
+ # result = cleaner.clean_tag_borders(input)
164
+ # expect(result).to eq "now __italic__with following [under__scored](link)"
165
+ # end
166
166
 
167
- it 'cleans italic stuff as well' do
168
- input = "1 __italic __ 2 __ italic__ 3__italic __4"
169
- result = cleaner.clean_tag_borders(input)
170
- expect(result).to eq "1 __italic__ 2 __italic__ 3__italic__4"
171
- end
167
+ # it 'cleans italic stuff as well' do
168
+ # input = "1 __italic __ 2 __ italic__ 3__italic __4"
169
+ # result = cleaner.clean_tag_borders(input)
170
+ # expect(result).to eq "1 __italic__ 2 __italic__ 3__italic__4"
171
+ # end
172
172
 
173
- it 'cleans strikethrough stuff as well' do
173
+ it "cleans strikethrough stuff as well" do
174
174
  input = "1 ~~italic ~~ 2 ~~ italic~~ 3~~italic ~~4"
175
175
  result = cleaner.clean_tag_borders(input)
176
176
  expect(result).to eq "1 ~~italic~~ 2 ~~italic~~ 3~~italic~~4"
177
177
  end
178
178
  end
179
179
  end
180
-
181
180
  end
@@ -1,26 +1,25 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Config do
4
- describe '#with' do
4
+ describe "#with" do
5
5
  let(:config) { ReverseAdoc.config }
6
6
 
7
- it 'takes additional options into account' do
7
+ it "takes additional options into account" do
8
8
  config.with(tag_border: :foobar) do
9
9
  expect(ReverseAdoc.config.tag_border).to eq :foobar
10
10
  end
11
11
  end
12
12
 
13
- it 'returns the result of a given block' do
13
+ it "returns the result of a given block" do
14
14
  expect(config.with { :something }).to eq :something
15
15
  end
16
16
 
17
- it 'resets to original settings afterwards' do
17
+ it "resets to original settings afterwards" do
18
18
  config.tag_border = :foo
19
19
  config.with(tag_border: :bar) do
20
20
  expect(ReverseAdoc.config.tag_border).to eq :bar
21
21
  end
22
22
  expect(ReverseAdoc.config.tag_border).to eq :foo
23
23
  end
24
-
25
24
  end
26
25
  end
@@ -1,10 +1,9 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Aside do
4
-
5
4
  let(:converter) { ReverseAdoc::Converters::Aside.new }
6
5
 
7
- it 'converts aside' do
6
+ it "converts aside" do
8
7
  input = node_for("<aside><ul><li>foo</li></ul></aside>")
9
8
  result = converter.convert(input)
10
9
  expect(result).to eq "\n\n\*\*\*\*\n\n* foo\n\n\*\*\*\*\n\n"
@@ -1,17 +1,15 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Audio do
4
-
5
4
  let(:converter) { ReverseAdoc::Converters::Audio.new }
6
5
 
7
- it 'converts audio with no attributes' do
6
+ it "converts audio with no attributes" do
8
7
  node = node_for("<audio src='example.mp3'/>")
9
8
  expect(converter.convert(node)).to include "audio::example.mp3[]"
10
9
  end
11
10
 
12
- it 'converts audio with full set of attributes' do
11
+ it "converts audio with full set of attributes" do
13
12
  node = node_for("<audio id='A' src='example.mp3' loop='loop'/>")
14
13
  expect(converter.convert(node)).to include "[[A]]\naudio::example.mp3[options=\"loop\"]"
15
14
  end
16
-
17
15
  end
@@ -1,24 +1,23 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Blockquote do
4
-
5
4
  let(:converter) { ReverseAdoc::Converters::Blockquote.new }
6
5
 
7
- it 'converts nested elements as well' do
6
+ it "converts nested elements as well" do
8
7
  input = node_for("<blockquote><ul><li>foo</li></ul></blockquote>")
9
8
  result = converter.convert(input)
10
9
  expect(result).to eq "\n\n____\n* foo\n____\n\n"
11
10
  end
12
11
 
13
- it 'can deal with paragraphs inside' do
12
+ it "can deal with paragraphs inside" do
14
13
  input = node_for("<blockquote><p>Some text.</p><p>Some more text.</p></blockquote>")
15
14
  result = converter.convert(input)
16
15
  expect(result).to eq "\n\n____\nSome text.\n\nSome more text.\n____\n\n"
17
16
  end
18
17
 
19
- it 'can deal with cite attribute' do
18
+ it "can deal with cite attribute" do
20
19
  input = node_for("<blockquote cite='http://www.example.com'><p>Some text.</p><p>Some more text.</p></blockquote>")
21
20
  result = converter.convert(input)
22
- expect(result).to eq "\n\n[quote, http://www.example.com]\n____\nSome text.\n\nSome more text.\n____\n\n"
21
+ expect(result).to eq "\n\n[quote,http://www.example.com]\n____\nSome text.\n\nSome more text.\n____\n\n"
23
22
  end
24
23
  end
@@ -1,9 +1,9 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Br do
4
4
  let(:converter) { ReverseAdoc::Converters::Br.new }
5
5
 
6
- it 'just converts into two spaces and a newline' do
6
+ it "just converts into two spaces and a newline" do
7
7
  expect(converter.convert(:anything)).to eq " \+\n"
8
8
  end
9
9
  end
@@ -1,17 +1,15 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Code do
4
-
5
4
  let(:converter) { ReverseAdoc::Converters::Code.new }
6
5
 
7
- it 'converts as backtick' do
6
+ it "converts as backtick" do
8
7
  node = node_for("<code>puts foo</code>")
9
8
  expect(converter.convert(node)).to include "`puts foo`"
10
9
  end
11
10
 
12
- it 'converts as backtick' do
11
+ it "converts as backtick" do
13
12
  node = node_for("<tt>puts foo</tt>")
14
13
  expect(converter.convert(node)).to include "`puts foo`"
15
14
  end
16
-
17
15
  end
@@ -1,17 +1,15 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Code do
4
-
5
4
  let(:converter) { ReverseAdoc::Converters::Div.new }
6
5
 
7
- it 'converts div' do
6
+ it "converts div" do
8
7
  node = node_for("<div>puts foo</div>")
9
8
  expect(converter.convert(node)).to include "\nputs foo"
10
9
  end
11
10
 
12
- it 'converts div with anchor' do
11
+ it "converts div with anchor" do
13
12
  node = node_for("<div id='A'>puts foo</div>")
14
13
  expect(converter.convert(node)).to include "\n[[A]]\nputs foo"
15
14
  end
16
-
17
15
  end
@@ -1,12 +1,10 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Figure do
4
-
5
4
  let(:converter) { ReverseAdoc::Converters::Figure.new }
6
5
 
7
- it 'converts figure' do
6
+ it "converts figure" do
8
7
  node = node_for("<figure id='A'><img src='example.jpg'/><figcaption>Figure <i>caption</i></figcaption></figure>")
9
8
  expect(converter.convert(node)).to include "[[A]]\n.Figure _caption_\n====\nimage::example.jpg[]\n====\n"
10
-
11
9
  end
12
10
  end
@@ -1,27 +1,25 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Img do
4
-
5
4
  let(:converter) { ReverseAdoc::Converters::Img.new }
6
5
 
7
- it 'converts image with no attributes' do
6
+ it "converts image with no attributes" do
8
7
  node = node_for("<img src='example.jpg'/>")
9
8
  expect(converter.convert(node)).to include "image::example.jpg[]"
10
9
  end
11
10
 
12
- it 'converts image with full set of attributes' do
11
+ it "converts image with full set of attributes" do
13
12
  node = node_for("<img id='A' alt='Alt Text' src='example.jpg' width='30' height='40'/>")
14
13
  expect(converter.convert(node)).to include "[[A]]\nimage::example.jpg[Alt Text,30,40]"
15
14
  end
16
15
 
17
- it 'converts image with alt text, no width and height' do
16
+ it "converts image with alt text, no width and height" do
18
17
  node = node_for("<img id='A' alt='Alt Text' src='example.jpg'/>")
19
18
  expect(converter.convert(node)).to include "[[A]]\nimage::example.jpg[Alt Text]"
20
19
  end
21
20
 
22
- it 'converts image with width and height, no alt text' do
21
+ it "converts image with width and height, no alt text" do
23
22
  node = node_for("<img id='A' src='example.jpg' width='30' height='40'/>")
24
23
  expect(converter.convert(node)).to include "[[A]]\nimage::example.jpg[\"\",30,40]"
25
24
  end
26
-
27
25
  end
@@ -1,13 +1,11 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Li do
4
-
5
4
  let(:converter) { ReverseAdoc::Converters::Li.new }
6
5
 
7
- it 'does not fail without a valid parent context' do
6
+ it "does not fail without a valid parent context" do
8
7
  input = node_for("<li>foo</li>")
9
8
  result = converter.convert(input)
10
9
  expect(result).to eq " foo\n"
11
10
  end
12
-
13
11
  end
@@ -1,10 +1,10 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Mark do
4
4
  let(:converter) { ReverseAdoc::Converters::Mark.new }
5
5
 
6
- it 'renders mark' do
7
- input = node_for('<mark>A</mark>')
8
- expect(converter.convert(input)).to eq '#A#'
6
+ it "renders mark" do
7
+ input = node_for("<mark>A</mark>")
8
+ expect(converter.convert(input)).to eq "#A#"
9
9
  end
10
10
  end
@@ -1,10 +1,9 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::P do
4
-
5
4
  let(:converter) { ReverseAdoc::Converters::P.new }
6
5
 
7
- it 'converts p with anchor' do
6
+ it "converts p with anchor" do
8
7
  node = node_for("<p id='A'>puts foo</p>")
9
8
  expect(converter.convert(node)).to include "\n[[A]]\nputs foo"
10
9
  end
@@ -1,42 +1,41 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Pre do
4
-
5
4
  let(:converter) { ReverseAdoc::Converters::Pre.new }
6
5
 
7
- it 'converts as literal' do
6
+ it "converts as literal" do
8
7
  node = node_for("<pre>puts foo</pre>")
9
8
  expect(converter.convert(node)).to include "....\nputs foo\n....\n"
10
9
  end
11
10
 
12
- it 'converts as literal with anchor' do
11
+ it "converts as literal with anchor" do
13
12
  node = node_for("<pre id='A'>puts foo</pre>")
14
13
  expect(converter.convert(node)).to include "[[A]]\n....\nputs foo\n....\n"
15
14
  end
16
15
 
17
- it 'preserves new lines' do
16
+ it "preserves new lines" do
18
17
  node = node_for("<pre>foo\nbar</pre>")
19
18
  expect(converter.convert(node)).to include "....\nfoo\nbar\n....\n"
20
19
  end
21
20
 
22
- it 'preserves xml' do
21
+ it "preserves xml" do
23
22
  node = node_for("<pre><code>x</code><br/><p>hello</p></pre>")
24
23
  expect(converter.convert(node)).to include "....\nx\n\n\nhello\n\n\n....\n"
25
24
  end
26
25
 
27
- context 'syntax highlighting' do
26
+ context "syntax highlighting" do
28
27
  it 'works for "highlight-lang" mechanism' do
29
28
  div = node_for("<div class='highlight highlight-ruby'><pre>puts foo</pre></div>")
30
29
  pre = div.children.first
31
30
  expect(converter.convert(pre)).to include "[source,ruby]\n----\nputs foo\n----\n"
32
31
  end
33
32
 
34
- it 'works for the confluence mechanism' do
33
+ it "works for the confluence mechanism" do
35
34
  pre = node_for("<pre class='theme: Confluence; brush: html/xml; gutter: false'>puts foo</pre>")
36
35
  expect(converter.convert(pre)).to include "[source,html/xml]\n----\nputs foo\n----\n"
37
36
  end
38
37
 
39
- it 'works for the confluence mechanism, with anchor' do
38
+ it "works for the confluence mechanism, with anchor" do
40
39
  pre = node_for("<pre id = 'A' class='theme: Confluence; brush: html/xml; gutter: false'>puts foo</pre>")
41
40
  expect(converter.convert(pre)).to include "[[A]]\n[source,html/xml]\n----\nputs foo\n----\n"
42
41
  end
@@ -1,10 +1,10 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Q do
4
4
  let(:converter) { ReverseAdoc::Converters::Q.new }
5
5
 
6
- it 'renders q' do
7
- input = node_for('<q>A</q>')
6
+ it "renders q" do
7
+ input = node_for("<q>A</q>")
8
8
  expect(converter.convert(input)).to eq '"A"'
9
9
  end
10
10
  end
@@ -1,19 +1,20 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe ReverseAdoc::Converters::Strong do
4
4
  let(:converter) { ReverseAdoc::Converters::Strong.new }
5
5
 
6
- it 'returns an empty string if the node is empty' do
7
- input = node_for('<strong></strong>')
8
- expect(converter.convert(input)).to eq ''
6
+ it "returns an empty string if the node is empty" do
7
+ input = node_for("<strong></strong>")
8
+ expect(converter.convert(input)).to eq ""
9
9
  end
10
10
 
11
- it 'returns just the content if the strong tag is nested in another strong' do
12
- input = node_for('<strong><strong>foo</strong></strong>')
13
- expect(converter.convert(input.children.first, already_strong: true)).to eq 'foo'
11
+ it "returns just the content if the strong tag is nested in another strong" do
12
+ input = node_for("<strong><strong>foo</strong></strong>")
13
+ expect(converter.convert(input.children.first,
14
+ already_strong: true)).to eq "foo"
14
15
  end
15
16
 
16
- it 'moves border whitespaces outside of the delimiters tag' do
17
+ it "moves border whitespaces outside of the delimiters tag" do
17
18
  input = node_for("<strong> \n foo </strong>")
18
19
  expect(converter.convert(input)).to eq " *foo* "
19
20
  end