Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #47

Merged
merged 4 commits into from
May 21, 2018
Merged
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: ruby
rvm:
- "2.0"
- "2.1"
- "2.2"
- "2.3"
- "2.4"
env:
- INCLUDE_LINGUIST=true
- INCLUDE_LINGUIST=false
Expand Down
15 changes: 8 additions & 7 deletions github-markdown-preview.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ Gem::Specification.new do |s|
s.description = %q{Local previews for Github markdown}
s.license = 'MIT'

s.add_dependency 'listen', '3.0.3'
s.add_dependency 'html-pipeline', '2.0'
s.add_dependency 'sanitize', '4.0.0'
s.add_dependency 'github-markdown', '0.6.8'
s.add_dependency 'gemoji', '2.1.0'
s.add_dependency 'listen', '3.1.5'
s.add_dependency 'html-pipeline', '2.7.1'
s.add_dependency 'commonmarker', '0.17.9'
s.add_dependency 'sanitize', '4.6.4'
s.add_dependency 'github-markdown', '0.6.9'
s.add_dependency 'gemoji', '3.0.0'

s.add_development_dependency 'minitest', '~> 5.4'
s.add_development_dependency 'rake', '~> 10.3'
s.add_development_dependency 'minitest', '~> 5.11.3'
s.add_development_dependency 'rake', '~> 12.3.1'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Expand Down
4 changes: 2 additions & 2 deletions lib/github-markdown-preview/filter/task_list_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def call
(first_child.ancestors('ul').first || { })['class'] = 'task-list'
first_child.replace(html)
end
doc.search('ul/li').each &process_task
doc.search('ul/li/p').each &process_task
doc.search('ul/li').each(&process_task)
doc.search('ul/li/p').each(&process_task)
doc
end

Expand Down
2 changes: 1 addition & 1 deletion lib/github-markdown-preview/html_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def pipeline_filters(options)
##
# Update the preview file
def update
unless File.exists?(@source_file)
unless File.exist?(@source_file)
raise FileNotFoundError.new("Source file deleted")
end

Expand Down
6 changes: 3 additions & 3 deletions test/github-markdown-preview_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ def setup

def test_no_params
IO.popen("bundle exec #{@ghp_scipt}") do |io|
assert_match /Usage.*/, io.read, 'No parameter call should output usage'
assert_match(/Usage.*/, io.read, 'No parameter call should output usage')
end
end

def test_version_ouput
IO.popen("bundle exec #{@ghp_scipt} -v") do |io|
assert_match GithubMarkdownPreview::VERSION, io.read, '-v call should output version'
assert_match(GithubMarkdownPreview::VERSION, io.read, '-v call should output version')
end
end

def test_file_not_found
IO.popen("bundle exec #{@ghp_scipt} this_file_does_not_exist 2>&1") do |io|
assert_match /.*No such file/, io.read, 'Bad file name should get a helpful error'
assert_match(/.*No such file/, io.read, 'Bad file name should get a helpful error')
end
end
end
23 changes: 20 additions & 3 deletions test/html_preview_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,21 @@ def test_comment_mode_word_immediately_after_hash
def test_default_mode_anchors
write(@source_file_path, "# foo\n## bar")
markdown_preview = @ghp.new( @source_file_path )
assert_equal markdown_preview.wrap_preview("<h1>\n<a id=\"foo\" class=\"anchor\" href=\"#foo\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"></span></a>foo</h1>\n\n<h2>\n<a id=\"bar\" class=\"anchor\" href=\"#bar\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"></span></a>bar</h2>"),
html = <<HTML
<h1>
<a id=\"foo\" class=\"anchor\" href=\"#foo\" aria-hidden=\"true\"><span aria-hidden=\"true\" class=\"octicon octicon-link\"></span></a>foo</h1>
<h2>
<a id=\"bar\" class=\"anchor\" href=\"#bar\" aria-hidden=\"true\"><span aria-hidden=\"true\" class=\"octicon octicon-link\"></span></a>bar</h2>
HTML
assert_equal markdown_preview.wrap_preview(html.chomp),
read(markdown_preview.preview_file),
'Should contain anchor link markup in default mode'
end

def test_comment_mode_anchors
write(@source_file_path, "# foo\n## bar")
markdown_preview = @ghp.new( @source_file_path, { :comment_mode => true } )
assert_equal markdown_preview.wrap_preview("<h1>foo</h1>\n\n<h2>bar</h2>"),
assert_equal markdown_preview.wrap_preview("<h1>foo</h1>\n<h2>bar</h2>"),
read(markdown_preview.preview_file),
'Should NOT contain anchor link markup in comment mode'
end
Expand All @@ -106,7 +112,18 @@ def test_comment_mode_task_lists
def test_double_spaced_task_lists
write(@source_file_path, "- [ ] one\n\n- [ ] two")
markdown_preview = @ghp.new( @source_file_path, { :comment_mode => true } )
assert_equal markdown_preview.wrap_preview("<ul class=\"task-list\">\n<li class=\"task-list-item\"><p><input class=\"task-list-item-checkbox\" type=\"checkbox\"> one</p></li>\n<li class=\"task-list-item\"><p><input class=\"task-list-item-checkbox\" type=\"checkbox\"> two</p></li>\n</ul>"),
html = <<HTML
<ul class=\"task-list\">
<li class=\"task-list-item\">
<p><input class=\"task-list-item-checkbox\" type=\"checkbox\"> one</p>
</li>
<li class=\"task-list-item\">
<p><input class=\"task-list-item-checkbox\" type=\"checkbox\"> two</p>
</li>
</ul>
HTML

assert_equal markdown_preview.wrap_preview(html.chomp),
read(markdown_preview.preview_file),
'Should render tasks even if list has extra spaces (which render as <p> elements)'
end
Expand Down