Skip to content

Commit

Permalink
Merge pull request #256 from paulRbr/fix-md-039
Browse files Browse the repository at this point in the history
fix(md039): fix a crash in the rule when the link text is empty
  • Loading branch information
jaymzh committed Oct 20, 2019
2 parents a9e80fc + cd31a5d commit 4ed893c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ notifications:

matrix:
include:
- rvm: 2.3.4
- rvm: 2.4.1
- rvm: 2.5.1
- rvm: 2.4.6
- rvm: 2.5.5
- rvm: 2.6.2
# - rvm: jruby-9.1.9.0
# env: JRUBY_OPTS="--dev"
# - rvm: jruby-9.2.0.0
8 changes: 4 additions & 4 deletions lib/mdl/rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -621,10 +621,10 @@ def check_blockquote(errors, elements)
aliases 'no-space-in-links'
check do |doc|
doc.element_linenumbers(
doc.find_type_elements(:a).select{|e|
e.children.first.type == :text && e.children.last.type == :text and (
e.children.first.value.start_with?(" ") or
e.children.last.value.end_with?(" "))}
doc.find_type_elements(:a).reject{|e|e.children.empty?}.select{|e|
e.children.first.type == :text && e.children.last.type == :text and (
e.children.first.value.start_with?(" ") or
e.children.last.value.end_with?(" "))}
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion mdl.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'mixlib-config', '~> 2.2', '>= 2.2.1'
spec.add_dependency 'mixlib-cli', '~> 1.7', '>= 1.7.0'

spec.add_development_dependency 'bundler', '~> 1.12'
spec.add_development_dependency 'bundler', ['>= 1.12', '< 3']
spec.add_development_dependency 'rake', '~> 11.2'
spec.add_development_dependency 'minitest', '~> 5.9'
spec.add_development_dependency 'pry', '~> 0.10'
Expand Down
2 changes: 2 additions & 0 deletions test/rule_tests/spaces_inside_link_text.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[](http://bar/)

[foo](http://bar/)

["foo"](http:/bar/)
Expand Down

0 comments on commit 4ed893c

Please sign in to comment.