diff --git a/html/index.erb b/html/index.erb index f0533b62..93e0d728 100644 --- a/html/index.erb +++ b/html/index.erb @@ -13,11 +13,13 @@ <% require 'json' archive_json = JSON.parse(File.open("../archive.json").read) + recipe_json = JSON.parse(File.open("../recipes.json").read) - headers = ["Package", "Version", "Description", "Source"] + headers = ["Package", "Version", "Description", "Recipe", "Source"] data = archive_json.keys.sort.map do |pkgname| versions, deps, descr, pkgtype = archive_json[pkgname] + recipe = recipe_json[pkgname] version = versions.join('.') pkgurl = "packages/#{pkgname}-#{version}." + (pkgtype == "single" ? "el" : "tar") recipe_url = "https://github.com/milkypostman/melpa/blob/master/recipes/#{pkgname}" @@ -25,10 +27,17 @@ if descr =~ /(.*?)(\s*-\*-.*?)?\s*\[source:\s*(\w+)\]\s*/ descr, source = $1, $3 end - ["[#{pkgname}](#{pkgurl})", version, descr, "[#{source}](#{recipe_url})"] + + case source + when 'github' then source_url = "https://github.com/#{recipe['repo']}" + when 'wiki' then source_url = recipe.key?('files') ? nil : "http://www.emacswiki.org/emacs/#{pkgname}.el" + else source_url = nil + end + + ["[#{pkgname}](#{pkgurl})", version, descr, "[recipe](#{recipe_url})", source_url ? "[#{source}](#{source_url})" : ""] end - colwidth = [0,0,0, 9] + colwidth = [0,0,0,0, 9] data.map do |row| row.to_enum(:each_with_index).map do |e,i| @@ -138,4 +147,4 @@ most of the packages that I am interested in. \ No newline at end of file +