reverse_adoc 0.2.4 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +16 -5
  3. data/.github/workflows/ubuntu.yml +18 -5
  4. data/.github/workflows/windows.yml +20 -6
  5. data/Gemfile +2 -2
  6. data/Gemfile.lock +84 -0
  7. data/README.adoc +40 -7
  8. data/Rakefile +1 -1
  9. data/bin/reverse_adoc +24 -17
  10. data/bin/w2a +19 -31
  11. data/lib/reverse_adoc.rb +30 -0
  12. data/lib/{reverse_asciidoctor → reverse_adoc}/cleaner.rb +27 -4
  13. data/lib/{reverse_asciidoctor → reverse_adoc}/config.rb +3 -2
  14. data/lib/{reverse_asciidoctor → reverse_adoc}/converters.rb +6 -6
  15. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/a.rb +7 -3
  16. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/aside.rb +1 -1
  17. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/audio.rb +1 -1
  18. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/base.rb +2 -2
  19. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/blockquote.rb +2 -2
  20. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/br.rb +1 -1
  21. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/bypass.rb +1 -1
  22. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/code.rb +1 -1
  23. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/div.rb +1 -1
  24. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/drop.rb +1 -1
  25. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/em.rb +1 -1
  26. data/lib/reverse_adoc/converters/example.rb +17 -0
  27. data/lib/reverse_adoc/converters/express_ref.rb +12 -0
  28. data/lib/reverse_adoc/converters/ext_description.rb +16 -0
  29. data/lib/reverse_adoc/converters/ext_descriptions.rb +12 -0
  30. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/figure.rb +1 -1
  31. data/lib/reverse_adoc/converters/h.rb +34 -0
  32. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/head.rb +1 -1
  33. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/hr.rb +1 -1
  34. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/ignore.rb +1 -1
  35. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/img.rb +27 -25
  36. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/li.rb +1 -1
  37. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/mark.rb +1 -1
  38. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/math.rb +3 -3
  39. data/lib/reverse_adoc/converters/note.rb +17 -0
  40. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/ol.rb +1 -1
  41. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/p.rb +1 -1
  42. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/pass_through.rb +1 -1
  43. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/pre.rb +1 -1
  44. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/q.rb +1 -1
  45. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/strong.rb +1 -1
  46. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/sub.rb +1 -1
  47. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/sup.rb +1 -1
  48. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/table.rb +1 -1
  49. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/td.rb +1 -1
  50. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/text.rb +1 -1
  51. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/th.rb +1 -1
  52. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/tr.rb +1 -1
  53. data/lib/{reverse_asciidoctor → reverse_adoc}/converters/video.rb +1 -1
  54. data/lib/{reverse_asciidoctor → reverse_adoc}/errors.rb +1 -1
  55. data/lib/reverse_adoc/html_converter.rb +56 -0
  56. data/lib/reverse_adoc/smrl_description_converter.rb +45 -0
  57. data/lib/reverse_adoc/version.rb +3 -0
  58. data/reverse_adoc.gemspec +3 -2
  59. data/spec/assets/anchors.html +8 -0
  60. data/spec/assets/external_images.docx +0 -0
  61. data/spec/assets/external_images.html +35 -0
  62. data/spec/bin/reverse_adoc_spec.rb +32 -0
  63. data/spec/bin/w2a_spec.rb +35 -0
  64. data/spec/components/anchors_spec.rb +7 -2
  65. data/spec/components/basic_spec.rb +2 -2
  66. data/spec/components/code_spec.rb +4 -4
  67. data/spec/components/escapables_spec.rb +2 -2
  68. data/spec/components/from_the_wild_spec.rb +2 -2
  69. data/spec/components/html_fragment_spec.rb +2 -2
  70. data/spec/components/lists_spec.rb +2 -2
  71. data/spec/components/paragraphs_spec.rb +2 -2
  72. data/spec/components/quotation_spec.rb +2 -2
  73. data/spec/components/tables_spec.rb +2 -2
  74. data/spec/components/unknown_tags_spec.rb +9 -9
  75. data/spec/lib/reverse_adoc.rb +90 -0
  76. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/cleaner_spec.rb +28 -4
  77. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/config_spec.rb +5 -5
  78. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/aside_spec.rb +2 -2
  79. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/audio_spec.rb +2 -2
  80. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/blockquote_spec.rb +2 -2
  81. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/br_spec.rb +2 -2
  82. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/code_spec.rb +2 -2
  83. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/div_spec.rb +2 -2
  84. data/spec/lib/reverse_adoc/converters/example_spec.rb +22 -0
  85. data/spec/lib/reverse_adoc/converters/express_ref_spec.rb +14 -0
  86. data/spec/lib/reverse_adoc/converters/ext_description_spec.rb +20 -0
  87. data/spec/lib/reverse_adoc/converters/ext_descriptions_spec.rb +13 -0
  88. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/figure_spec.rb +2 -2
  89. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/img_spec.rb +2 -2
  90. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/li_spec.rb +2 -2
  91. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/mark_spec.rb +2 -2
  92. data/spec/lib/reverse_adoc/converters/note_spec.rb +22 -0
  93. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/p_spec.rb +2 -2
  94. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/pre_spec.rb +2 -2
  95. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/q_spec.rb +2 -2
  96. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/strong_spec.rb +2 -2
  97. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/text_spec.rb +2 -2
  98. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters/video_spec.rb +2 -2
  99. data/spec/lib/{reverse_asciidoctor → reverse_adoc}/converters_spec.rb +5 -5
  100. data/spec/spec_helper.rb +7 -2
  101. data/spec/support/shell_helpers.rb +15 -0
  102. metadata +125 -84
  103. data/lib/reverse_asciidoctor.rb +0 -70
  104. data/lib/reverse_asciidoctor/converters/h.rb +0 -19
  105. data/lib/reverse_asciidoctor/version.rb +0 -3
  106. data/spec/lib/reverse_asciidoctor_spec.rb +0 -37
@@ -1,24 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor do
3
+ describe ReverseAdoc do
4
4
 
5
5
  let(:input) { File.read('spec/assets/code.html') }
6
6
  let(:document) { Nokogiri::HTML(input) }
7
- subject { ReverseAsciidoctor.convert(input) }
7
+ subject { ReverseAdoc.convert(input) }
8
8
 
9
9
  it { is_expected.to match /inline `code` block/ }
10
10
  it { is_expected.to match /\n<code>var this\;\nthis\.is/ }
11
11
  it { is_expected.to match /block"\)\nconsole/ }
12
12
 
13
13
  context "with github style code blocks" do
14
- subject { ReverseAsciidoctor.convert(input) }
14
+ subject { ReverseAdoc.convert(input) }
15
15
  it { is_expected.to match /inline `code` block/ }
16
16
  it { is_expected.to match /\n\.\.\.\.\n<code>var this\;\nthis/ }
17
17
  it { is_expected.to match /it is"\) ?\n <\/code>\n\.\.\.\./ }
18
18
  end
19
19
 
20
20
  context "code with indentation" do
21
- subject { ReverseAsciidoctor.convert(input) }
21
+ subject { ReverseAdoc.convert(input) }
22
22
  it { is_expected.to match(/^<code>tell application "Foo"\n/) }
23
23
  it { is_expected.to match(/^ beep\n/) }
24
24
  it { is_expected.to match(/^end tell\n/) }
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor do
3
+ describe ReverseAdoc do
4
4
 
5
5
  let(:input) { File.read('spec/assets/escapables.html') }
6
6
  let(:document) { Nokogiri::HTML(input) }
7
- subject { ReverseAsciidoctor.convert(input) }
7
+ subject { ReverseAdoc.convert(input) }
8
8
 
9
9
  context "multiple asterisks" do
10
10
  it { is_expected.to include ' \*\*two asterisks\*\* ' }
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor do
3
+ describe ReverseAdoc do
4
4
 
5
5
  let(:input) { File.read('spec/assets/from_the_wild.html') }
6
6
  let(:document) { Nokogiri::HTML(input) }
7
- subject { ReverseAsciidoctor.convert(input) }
7
+ subject { ReverseAdoc.convert(input) }
8
8
 
9
9
  it "should make sense of strong-crazy markup (as seen in the wild)" do
10
10
  expect(subject).to include "*. +\n \\*\\*\\* intentcast* : logo design *+*\n"
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor do
3
+ describe ReverseAdoc do
4
4
 
5
5
  let(:input) { File.read('spec/assets/html_fragment.html') }
6
6
  let(:document) { Nokogiri::HTML(input) }
7
- subject { ReverseAsciidoctor.convert(input) }
7
+ subject { ReverseAdoc.convert(input) }
8
8
 
9
9
  it { is_expected.to eq("naked text 1\n\nparagraph text\n\nnaked text 2") }
10
10
  end
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor do
3
+ describe ReverseAdoc do
4
4
 
5
5
  let(:input) { File.read('spec/assets/lists.html') }
6
6
  let(:document) { Nokogiri::HTML(input) }
7
- subject { ReverseAsciidoctor.convert(input) }
7
+ subject { ReverseAdoc.convert(input) }
8
8
 
9
9
  it { is_expected.to match /\n\* unordered list entry\n/ }
10
10
  it { is_expected.to match /\n\* unordered list entry 2\n/ }
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor do
3
+ describe ReverseAdoc do
4
4
 
5
5
  let(:input) { File.read('spec/assets/paragraphs.html') }
6
6
  let(:document) { Nokogiri::HTML(input) }
7
- subject { ReverseAsciidoctor.convert(input) }
7
+ subject { ReverseAdoc.convert(input) }
8
8
 
9
9
  it { is_expected.not_to start_with "\n\n" }
10
10
  it { is_expected.to start_with "First content\n\nSecond content\n\n" }
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor do
3
+ describe ReverseAdoc do
4
4
 
5
5
  let(:input) { File.read('spec/assets/quotation.html') }
6
6
  let(:document) { Nokogiri::HTML(input) }
7
- subject { ReverseAsciidoctor.convert(input) }
7
+ subject { ReverseAdoc.convert(input) }
8
8
 
9
9
  it { is_expected.to match /\n <code>Block of code<\/code>$/ }
10
10
  it { is_expected.to include "\n____\nFirst quoted paragraph\n\nSecond quoted paragraph\n____\n" }
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor do
3
+ describe ReverseAdoc do
4
4
 
5
5
  let(:input) { File.read('spec/assets/tables.html') }
6
6
  let(:document) { Nokogiri::HTML(input) }
7
- subject { ReverseAsciidoctor.convert(input) }
7
+ subject { ReverseAdoc.convert(input) }
8
8
 
9
9
  it { is_expected.to match /\[\[A\]\]\n\|===\n\| \[\[C\]\]header 1 \| header 2 \| header 3\n\n/ }
10
10
  it { is_expected.to match /\nh\| \[\[D\]\]data 1-1 \| data 2-1 \| data 3-1\n/ }
@@ -1,39 +1,39 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor do
3
+ describe ReverseAdoc do
4
4
 
5
5
  let(:input) { File.read('spec/assets/unknown_tags.html') }
6
6
  let(:document) { Nokogiri::HTML(input) }
7
- let(:result) { ReverseAsciidoctor.convert(input) }
7
+ let(:result) { ReverseAdoc.convert(input) }
8
8
 
9
9
  context 'with unknown_tags = :pass_through' do
10
- before { ReverseAsciidoctor.config.unknown_tags = :pass_through }
10
+ before { ReverseAdoc.config.unknown_tags = :pass_through }
11
11
 
12
12
  it { expect(result).to include "<bar>Foo with bar</bar>" }
13
13
  end
14
14
 
15
15
  context 'with unknown_tags = :raise' do
16
- before { ReverseAsciidoctor.config.unknown_tags = :raise }
16
+ before { ReverseAdoc.config.unknown_tags = :raise }
17
17
 
18
- it { expect { result }.to raise_error(ReverseAsciidoctor::UnknownTagError) }
18
+ it { expect { result }.to raise_error(ReverseAdoc::UnknownTagError) }
19
19
  end
20
20
 
21
21
  context 'with unknown_tags = :drop' do
22
- before { ReverseAsciidoctor.config.unknown_tags = :drop }
22
+ before { ReverseAdoc.config.unknown_tags = :drop }
23
23
 
24
24
  it { expect(result).to eq '' }
25
25
  end
26
26
 
27
27
  context 'with unknown_tags = :bypass' do
28
- before { ReverseAsciidoctor.config.unknown_tags = :bypass }
28
+ before { ReverseAdoc.config.unknown_tags = :bypass }
29
29
 
30
30
  it { expect(result).to eq "Foo with bar\n\n" }
31
31
  end
32
32
 
33
33
  context 'with unknown_tags = :something_wrong' do
34
- before { ReverseAsciidoctor.config.unknown_tags = :something_wrong }
34
+ before { ReverseAdoc.config.unknown_tags = :something_wrong }
35
35
 
36
- it { expect { result }.to raise_error(ReverseAsciidoctor::InvalidConfigurationError) }
36
+ it { expect { result }.to raise_error(ReverseAdoc::InvalidConfigurationError) }
37
37
  end
38
38
  end
39
39
 
@@ -0,0 +1,90 @@
1
+ require 'spec_helper'
2
+
3
+ describe ReverseAdoc do
4
+ let(:input) { File.read('spec/assets/minimum.html') }
5
+ let(:document) { Nokogiri::HTML(input) }
6
+
7
+ it 'parses nokogiri documents' do
8
+ expect { ReverseAdoc.convert(document) }.not_to raise_error
9
+ end
10
+
11
+ it 'parses nokogiri elements' do
12
+ expect { ReverseAdoc.convert(document.root) }.not_to raise_error
13
+ end
14
+
15
+ it 'parses string input' do
16
+ expect { ReverseAdoc.convert(input) }.not_to raise_error
17
+ end
18
+
19
+ it 'behaves in a sane way when root element is nil' do
20
+ expect(ReverseAdoc.convert(nil)).to eq ''
21
+ end
22
+
23
+ describe '#config' do
24
+ it 'stores a given configuration option' do
25
+ ReverseAdoc.config.tag_border = true
26
+ expect(ReverseAdoc.config.tag_border).to eq true
27
+ end
28
+
29
+ it 'can be used as a block configurator as well' do
30
+ ReverseAdoc.config do |config|
31
+ expect(config.tag_border).to eq ' '
32
+ config.tag_border = true
33
+ end
34
+ expect(ReverseAdoc.config.tag_border).to eq true
35
+ end
36
+ end
37
+
38
+ shared_examples 'converting source with external images included' do |result|
39
+ let(:temp_dir) do
40
+ Pathname.new(ReverseAdoc.config.destination).dirname
41
+ end
42
+ let(:images_folder) { File.join(temp_dir, 'images') }
43
+
44
+ before do
45
+ ReverseAdoc.config.destination = File.join(Dir.mktmpdir,
46
+ 'output.html')
47
+ ReverseAdoc.config.sourcedir = Dir.mktmpdir
48
+ ReverseAdoc.config.external_images = true
49
+ end
50
+
51
+ after do
52
+ FileUtils.rm_rf(temp_dir)
53
+ end
54
+
55
+ it 'Creates local files from external URI' do
56
+ expect { convert }
57
+ .to(change do
58
+ Dir["#{images_folder}/*gif"]
59
+ .map { |entry| File.basename(entry) }
60
+ .sort
61
+ end.from([]).to(result))
62
+ end
63
+ end
64
+
65
+ # TODO: fix github actions integration with libreoffice, currently it hangs
66
+ # when trying to use soffice binary
67
+ unless Gem::Platform.local.os == 'darwin' && !ENV['GITHUB_ACTION'].nil?
68
+ context 'when docx file input' do
69
+ subject(:convert) do
70
+ ReverseAdoc.convert(
71
+ ReverseAdoc.cleaner.preprocess_word_html(input.document.html),
72
+ WordToMarkdown::REVERSE_MARKDOWN_OPTIONS
73
+ )
74
+ end
75
+ let(:input) do
76
+ WordToMarkdown.new('spec/assets/external_images.docx',
77
+ ReverseAdoc.config.sourcedir)
78
+ end
79
+ it_behaves_like 'converting source with external images included',
80
+ ['001.gif', '002.gif']
81
+ end
82
+ end
83
+
84
+ context 'when html file input' do
85
+ subject(:convert) { ReverseAdoc.convert(input) }
86
+ let(:input) { File.read('spec/assets/external_images.html') }
87
+ it_behaves_like 'converting source with external images included',
88
+ ['001.gif']
89
+ end
90
+ end
@@ -1,7 +1,31 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor::Cleaner do
4
- let(:cleaner) { ReverseAsciidoctor::Cleaner.new }
3
+ describe ReverseAdoc::Cleaner do
4
+ let(:cleaner) { ReverseAdoc::Cleaner.new }
5
+
6
+ describe '#scrub_whitespace' do
7
+ it "makes consistent nonbreaking spaces" do
8
+ result = cleaner.scrub_whitespace("&nbsp; &#xA0;  ")
9
+ expect(result).to eq "&#xA0; &#xA0; &#xA0;"
10
+ end
11
+
12
+ it "makes four linebreaks into two" do
13
+ result = cleaner.scrub_whitespace("A\n\n\n\nB")
14
+ expect(result).to eq "A\n\nB"
15
+ end
16
+ end
17
+
18
+ describe '#clean_headings' do
19
+ it "removes empty headings" do
20
+ result = cleaner.clean_headings("<h2></h2>")
21
+ expect(result).to eq " "
22
+ end
23
+
24
+ it "cleans superscripts rendered as headings" do
25
+ result = cleaner.clean_headings(%{<p class="Standard" style="font-size: 12pt; font-family: Calibri; writing-mode: lr-tb; margin: 0;" align="left ! important"><span class="T1" style="margin: 0;">H</span><h1 class="T2" style="vertical-align: super; font-size: 58%; margin: 0;">2</h1><span class="T1" style="margin: 0;">0</span></p>})
26
+ expect(result).to eq %{<p class="Standard" style="font-size: 12pt; font-family: Calibri; writing-mode: lr-tb; margin: 0;" align="left ! important"><span class="T1" style="margin: 0;">H</span><sup>2</sup><span class="T1" style="margin: 0;">0</span></p>}
27
+ end
28
+ end
5
29
 
6
30
  describe '#remove_newlines' do
7
31
  it 'removes more than 2 subsequent newlines' do
@@ -62,7 +86,7 @@ describe ReverseAsciidoctor::Cleaner do
62
86
 
63
87
  describe '#clean_tag_borders' do
64
88
  context 'with default_border is set to space' do
65
- before { ReverseAsciidoctor.config.tag_border = ' ' }
89
+ before { ReverseAdoc.config.tag_border = ' ' }
66
90
 
67
91
  it 'removes not needed whitespaces from strong tags' do
68
92
  input = "foo ** foobar ** bar"
@@ -108,7 +132,7 @@ describe ReverseAsciidoctor::Cleaner do
108
132
  end
109
133
 
110
134
  context 'with default_border set to no space' do
111
- before { ReverseAsciidoctor.config.tag_border = '' }
135
+ before { ReverseAdoc.config.tag_border = '' }
112
136
 
113
137
  it 'removes not needed whitespaces from strong tags' do
114
138
  input = "foo ** foobar ** bar"
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor::Config do
3
+ describe ReverseAdoc::Config do
4
4
  describe '#with' do
5
- let(:config) { ReverseAsciidoctor.config }
5
+ let(:config) { ReverseAdoc.config }
6
6
 
7
7
  it 'takes additional options into account' do
8
8
  config.with(tag_border: :foobar) do
9
- expect(ReverseAsciidoctor.config.tag_border).to eq :foobar
9
+ expect(ReverseAdoc.config.tag_border).to eq :foobar
10
10
  end
11
11
  end
12
12
 
@@ -17,9 +17,9 @@ describe ReverseAsciidoctor::Config do
17
17
  it 'resets to original settings afterwards' do
18
18
  config.tag_border = :foo
19
19
  config.with(tag_border: :bar) do
20
- expect(ReverseAsciidoctor.config.tag_border).to eq :bar
20
+ expect(ReverseAdoc.config.tag_border).to eq :bar
21
21
  end
22
- expect(ReverseAsciidoctor.config.tag_border).to eq :foo
22
+ expect(ReverseAdoc.config.tag_border).to eq :foo
23
23
  end
24
24
 
25
25
  end
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor::Converters::Aside do
3
+ describe ReverseAdoc::Converters::Aside do
4
4
 
5
- let(:converter) { ReverseAsciidoctor::Converters::Aside.new }
5
+ let(:converter) { ReverseAdoc::Converters::Aside.new }
6
6
 
7
7
  it 'converts aside' do
8
8
  input = node_for("<aside><ul><li>foo</li></ul></aside>")
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor::Converters::Audio do
3
+ describe ReverseAdoc::Converters::Audio do
4
4
 
5
- let(:converter) { ReverseAsciidoctor::Converters::Audio.new }
5
+ let(:converter) { ReverseAdoc::Converters::Audio.new }
6
6
 
7
7
  it 'converts audio with no attributes' do
8
8
  node = node_for("<audio src='example.mp3'/>")
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor::Converters::Blockquote do
3
+ describe ReverseAdoc::Converters::Blockquote do
4
4
 
5
- let(:converter) { ReverseAsciidoctor::Converters::Blockquote.new }
5
+ let(:converter) { ReverseAdoc::Converters::Blockquote.new }
6
6
 
7
7
  it 'converts nested elements as well' do
8
8
  input = node_for("<blockquote><ul><li>foo</li></ul></blockquote>")
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor::Converters::Br do
4
- let(:converter) { ReverseAsciidoctor::Converters::Br.new }
3
+ describe ReverseAdoc::Converters::Br do
4
+ let(:converter) { ReverseAdoc::Converters::Br.new }
5
5
 
6
6
  it 'just converts into two spaces and a newline' do
7
7
  expect(converter.convert(:anything)).to eq " \+\n"
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor::Converters::Code do
3
+ describe ReverseAdoc::Converters::Code do
4
4
 
5
- let(:converter) { ReverseAsciidoctor::Converters::Code.new }
5
+ let(:converter) { ReverseAdoc::Converters::Code.new }
6
6
 
7
7
  it 'converts as backtick' do
8
8
  node = node_for("<code>puts foo</code>")
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ReverseAsciidoctor::Converters::Code do
3
+ describe ReverseAdoc::Converters::Code do
4
4
 
5
- let(:converter) { ReverseAsciidoctor::Converters::Div.new }
5
+ let(:converter) { ReverseAdoc::Converters::Div.new }
6
6
 
7
7
  it 'converts div' do
8
8
  node = node_for("<div>puts foo</div>")
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'reverse_adoc/converters/example'
5
+
6
+ describe ReverseAdoc::Converters::Example do
7
+ let(:converter) { described_class.new }
8
+ let(:output) do
9
+ <<~TEXT
10
+ [example]
11
+ ====
12
+ foo
13
+
14
+ ====
15
+ TEXT
16
+ end
17
+
18
+ it 'converts example` children' do
19
+ input = node_for('<example><li>foo</li></example>')
20
+ expect(converter.convert(input)).to eq(output)
21
+ end
22
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'reverse_adoc/converters/express_ref'
5
+
6
+ describe ReverseAdoc::Converters::ExpressRef do
7
+ let(:converter) { described_class.new }
8
+ let(:schema) { 'schema' }
9
+
10
+ it 'converts supplied tag by format' do
11
+ input = node_for("<express_ref linkend='#{schema}' />")
12
+ expect(converter.convert(input)).to eq("express_ref:[#{schema}]")
13
+ end
14
+ end