diff options
| -rw-r--r-- | pkgs/simple/cgit-about-filter/cgit-about-filter.lua | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua index 28a493e..c7fb09c 100644 --- a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua +++ b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua @@ -51,21 +51,25 @@ end -- the filter outside of cgit. local emit = html or io.write --- Run md2html and return its output. -local function md2html(markdown) - local input = os.tmpname() - local file = assert(io.open(input, "w")) - file:write(markdown) +-- Run a shell command with input on stdin and return its output. +local function run(command, input) + local name = os.tmpname() + local file = assert(io.open(name, "w")) + file:write(input) file:close() - local handle = io.popen("@md2html@ --github < " .. input, "r") + local handle = io.popen(command .. " < " .. name, "r") local output = handle and handle:read("*a") if handle then handle:close() end - os.remove(input) + os.remove(name) return output end +local function md2html(markdown) + return run("@md2html@ --github", markdown) +end + local table_style = [[ <style> div#cgit div#summary table { |
