diff options
| author | tv <tv@krebsco.de> | 2026-11-17 13:32:28 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-17 14:36:16 +0100 |
| commit | b3befcb77a60e0641e07a9b73da483f51cf8e982 (patch) | |
| tree | ccaaa6eed6bf7440998567d808565c38d3d185b8 /pkgs/simple/cgit-about-filter | |
| parent | 6cb7bc22e8419a7a16b8a4485627b162c68905cd (diff) | |
cgit-about-filter: factor out run
The next commit runs git the same way as md2html.
Diffstat (limited to 'pkgs/simple/cgit-about-filter')
| -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 { |
