More concise code for recipe source URL

This commit is contained in:
Steve Purcell 2012-12-25 09:20:59 +00:00
parent 39de7629d7
commit e5c5783701

View file

@ -28,10 +28,10 @@
descr, source = $1, $3 descr, source = $1, $3
end end
source_url =
case source case source
when 'github' then source_url = "https://github.com/#{recipe['repo']}" when 'github' then "https://github.com/#{recipe['repo']}"
when 'wiki' then source_url = recipe.key?('files') ? nil : "http://www.emacswiki.org/emacs/#{pkgname}.el" when 'wiki' then recipe.key?('files') ? nil : "http://www.emacswiki.org/emacs/#{pkgname}.el"
else source_url = nil
end end
["<a name=\"#{pkgname}\"></a>[#{pkgname}](#{pkgurl})", version, descr, "[recipe](#{recipe_url})", source_url ? "[#{source}](#{source_url})" : ""] ["<a name=\"#{pkgname}\"></a>[#{pkgname}](#{pkgurl})", version, descr, "[recipe](#{recipe_url})", source_url ? "[#{source}](#{source_url})" : ""]