local utils = require("utils") local git = require("git_commands") ngx.say([[]]) ngx.say("
") local print_table print_table = function(t, l) l = l or 0 local n = 0 for i,v in pairs(t) do n = n + 1 break end if n > 0 then ngx.print("{\n") for i,v in pairs(t) do for i=0,l do ngx.print(" ") end ngx.print("",i,": ") if type(v) ~= "table" then if type(v) == "string" then ngx.print("\"") local s = v:gsub("&", "&"):gsub("<","<"):gsub(">",">") ngx.print(s) ngx.print("\"") else ngx.print(v) end else print_table(v,l+1) end ngx.print("\n") end for i=0,l-1 do ngx.print(" ") end ngx.print("}") else ngx.print("{}") end end local name = "ncurses-minesweeper" --local name = "lognestmonster" --local name = "auto-plow" --local name = "joshstock.in" local repo = "/home/josh/repos/"..name local headname = git.get_head(repo) ngx.say("< DESCRIPTION GOES HERE >
") ngx.print("") ngx.print("Refs | ") ngx.print("Commit Log | ") ngx.print("Files | ") ngx.print("README | ") ngx.print("LICENSE") ngx.print("
Time | ") ngx.print("Hash | ") ngx.print("Subject | ") ngx.print("Author | ") ngx.print("# | ") ngx.print("(+) | ") ngx.print("(-) | ") ngx.print([[GPG? | ]]) ngx.print("|
---|---|---|---|---|---|---|---|---|
",utils.iso8601(commit.timestamp)," | ") ngx.print("",commit.shorthash," | ") ngx.print("",commit.subject," | ") ngx.print("",commit.author," | ") ngx.print("",commit.email," | ") ngx.print("",commit.diff.num," | ") ngx.print("commit.diff.minus and " style=\"color:green;font-weight:bold\"" or "",">",commit.diff.plus~=0 and commit.diff.plus or ""," | ") ngx.print("commit.diff.plus and " style=\"color:red;font-weight:bold\"" or "",">",commit.diff.minus~=0 and commit.diff.minus or ""," | ") ngx.print("",commit.gpggood," | ") ngx.say("
Object | Latest Commit Subject | Time | Hash | ") ngx.say("
---|---|---|---|
",iconfolder," ",v," | ") local lastedit = git.log(repo, "@ -1", v, 1, 0, false)[1] ngx.print("",lastedit.subject," | ") ngx.print("",utils.iso8601(lastedit.timestamp)," | ") ngx.print("",lastedit.shorthash," | ") ngx.say("
",iconfile," ",v," | ") local lastedit = git.log(repo, "@ -1", v, 1, 0, false)[1] ngx.print("",lastedit.subject," | ") ngx.print("",utils.iso8601(lastedit.timestamp)," | ") ngx.print("",lastedit.shorthash," | ") ngx.say("