From f5e170c751a668da6738aad216cc6f83bfa6b2db Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 30 Jan 2011 04:18:18 +0000 Subject: fallback to cgit link in case we can't find source location Otherwise the link is broke --- lib/wrongdoc/final.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/wrongdoc/final.rb b/lib/wrongdoc/final.rb index 2b315cd..0a7bd8a 100644 --- a/lib/wrongdoc/final.rb +++ b/lib/wrongdoc/final.rb @@ -59,15 +59,13 @@ class Wrongdoc::Final } src.unlink if path && lineno } - if path && lineno - mdetail.search('span.method-click-advice').each { |x| - x.content = '' - a = Nokogiri::XML::Node.new('a', doc) - a['href'] = path_uri(path, lineno).to_s - a.content = 'view method source' - x.add_child(a) - } - end + mdetail.search('span.method-click-advice').each { |x| + x.content = '' + a = Nokogiri::XML::Node.new('a', doc) + a['href'] = (path && lineno ? path_uri(path, lineno) : @cgit_uri).to_s + a.content = 'view method source' + x.add_child(a) + } } end -- cgit v1.2.3-24-ge0c7