diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-01-30 04:18:18 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-30 04:18:18 +0000 |
commit | f5e170c751a668da6738aad216cc6f83bfa6b2db (patch) | |
tree | c099809ffcc522d030c1a947f23f2c4cc606f462 | |
parent | bb99b47f74e1d191f88713911adab6b93af787ba (diff) | |
download | wrongdoc-f5e170c751a668da6738aad216cc6f83bfa6b2db.tar.gz |
fallback to cgit link in case we can't find source location
Otherwise the link is broke
-rw-r--r-- | lib/wrongdoc/final.rb | 16 |
1 files 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 |