Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
jobs:
test:
working_directory: ~/html2confluence
docker:
- image: circleci/ruby:2.5
steps:
- checkout
- run:
name: Bundle
command: bundle install --jobs=4 --retry=3
- run:
name: RSpec
command: bundle exec rspec

workflows:
version: 2
test:
jobs:
- test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Gemfile.lock
3 changes: 2 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--color
--color
--require spec_helper
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gemspec
File renamed without changes.
2 changes: 2 additions & 0 deletions html2confluence.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ Gem::Specification.new do |s|
s.files = Dir.glob("{lib,spec}/**/*") + %w(example.rb README.mdown)

s.add_dependency "nokogiri"

s.add_development_dependency "rspec"
end
17 changes: 6 additions & 11 deletions spec/checkbox_examples_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# encoding: utf-8
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
require 'html2confluence'

describe HTMLToConfluenceParser, "when running checkbox examples" do
let(:parser) { HTMLToConfluenceParser.new }

it "should match checkboxes" do
html = <<-END
Expand All @@ -17,16 +14,14 @@
END

markup = <<-END
* (/) Example 1
* (/) Example 2
* (x) Example 3
* (/) Example 4
* (x) Example 5
* (/) Example 1
* (/) Example 2
* (x) Example 3
* (/) Example 4
* (x) Example 5
END

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to include(markup.strip)
end

end
35 changes: 11 additions & 24 deletions spec/combination_examples_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# encoding: utf-8
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
require 'html2confluence'

describe HTMLToConfluenceParser, "when running combination examples" do

let(:parser) { HTMLToConfluenceParser.new }

it "should match complex examples" do
html = <<-END
<ol>
Expand All @@ -18,9 +15,7 @@
# numbered *item* that is +underlined+.
# list
END


parser = HTMLToConfluenceParser.new

parser.feed(html)
expect(parser.to_wiki_markup.strip).to include(markup.strip)
end
Expand Down Expand Up @@ -95,7 +90,6 @@
h1. With +nice+ formatting.
END

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to include(markup.strip)
end
Expand All @@ -106,10 +100,15 @@
END

markup = <<-END
{quote}\nbq. content here\n{quote}
{quote}

{quote}
content here
{quote}

{quote}
END

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to include(markup.strip)
end
Expand All @@ -122,7 +121,6 @@

markup = "Previous\n\n*Scenario 4a: Existing deletes their ID*\n*Given* I am an existing user"

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to eq(markup)
end
Expand All @@ -136,7 +134,6 @@

markup = "Previous line\n\n*Scenario 4a: Existing deletes their ID*\n*Given* I am an existing user"

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to eq(markup)
end
Expand All @@ -146,7 +143,6 @@

markup = "*And* first line\n\n*second line*"

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to eq(markup)
end
Expand All @@ -156,7 +152,6 @@

markup = "!a source!"

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to eq(markup)
end
Expand All @@ -165,7 +160,6 @@
html = "<div>familiar with the XML<wbr>Http<wbr>Request Object</div>\n\n"

markup = "familiar with the XMLHttpRequest Object"
parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to eq(markup)

Expand All @@ -179,7 +173,6 @@

markup = "Previous line\n\n----"

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to eq(markup)
end
Expand All @@ -191,7 +184,6 @@

markup = "A"

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to eq(markup)
end
Expand All @@ -204,12 +196,7 @@

markup = "A"

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to eq(markup)
end

end
end



23 changes: 6 additions & 17 deletions spec/complex_tables_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# encoding: utf-8
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
require 'html2confluence'

describe HTMLToConfluenceParser, "when running complex tables examples" do

it "should handle table with newlines" do
let(:parser) { HTMLToConfluenceParser.new }

it "should handle table with newlines" do
html = <<-END
<table class="mce-item-table"><tbody><tr><td>As a...</td><td>I would like...</td><td>Because...</td></tr><tr><td><p>Student<br>or</p><p>Teacher</p></td><td>There to be more candy</td><td><p>Candy is:</p><ul><li>Delicious</li><li>Shiny</li><li>Good for my teeth</li></ul></td></tr></tbody></table>
END
Expand All @@ -21,12 +18,11 @@
* Good for my teeth|
END

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to include(markup.strip)
end

it "should handle table empty cells" do
it "should handle table empty cells" do
html = <<-END
<table class="mce-item-table"><tbody><tr><td><p><br data-mce-bogus="1"></p></td><td>Empty</td><td><p><br data-mce-bogus="1"></p></td></tr></tbody></table>
END
Expand All @@ -35,12 +31,11 @@
| |Empty| |
END

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to include(markup.strip)
end

it "should handle pre in table empty cells" do
it "should handle pre in table empty cells" do
html = <<-END
<table><tbody><tr><td><pre>a</pre></td><td>d</td></tr><tr><td><pre>b</pre></td><td>c</td></tr></tbody></table>
END
Expand All @@ -52,12 +47,11 @@
b{noformat} |c |
END

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to include(markup.strip)
end

it "should handle pre in table" do
it "should handle pre in table" do
html = <<-END
<table><tbody>
<tr>
Expand All @@ -79,12 +73,7 @@
2{noformat} |3 |
END

parser = HTMLToConfluenceParser.new
parser.feed(html)
expect(parser.to_wiki_markup.strip).to include(markup.strip)
end

end



Loading