Class: Marko::Markup::LostLink

Inherits:
Inspector show all
Defined in:
lib/marko/markup/validator.rb

Instance Method Summary collapse

Methods inherited from Inspector

#call

Instance Method Details

#report(errs) ⇒ Object



94
95
96
97
# File 'lib/marko/markup/validator.rb', line 94

def report(errs)
  # lost links [ref] src/source2.md:22 >> ## header
  errs.map{|orig, lost| "lost link [#{lost.join(', ')}] in #{orig}\n"}
end

#select(tree) ⇒ Object



86
87
88
89
90
91
# File 'lib/marko/markup/validator.rb', line 86

def select(tree)
  lost = proc{|n| n.links.reject{|i| n.find_node(i)}}
  tree
    .select{|n| lost.(n).any? }
    .map{|n| [n[:origin], lost.(n)]} # @todo second time #lost calculation
end