summaryrefslogtreecommitdiffstats
path: root/pkgs/simple/cgit-about-filter
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-12 18:06:27 +0000
committertv <tv@krebsco.de>2026-11-12 19:18:48 +0100
commit56d0fbca73150eebf5c7b34facfbb8e93e592ee2 (patch)
treed37b81bd4457b3dd465ae8d9a1f45ed487487b62 /pkgs/simple/cgit-about-filter
parente0b7c0f52ceaf0fac514cecbe1b14a20c8eb9e8a (diff)
cgit-about-filter: style tables
Diffstat (limited to 'pkgs/simple/cgit-about-filter')
-rw-r--r--pkgs/simple/cgit-about-filter/cgit-about-filter.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
index 86468f5..d4f441a 100644
--- a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
+++ b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
@@ -66,6 +66,36 @@ local function md2html(markdown)
return output
end
+local table_style = [[
+<style>
+div#cgit div#summary table {
+ width: 100%;
+ table-layout: fixed;
+ margin: 1em 0;
+ border-collapse: collapse;
+}
+div#cgit div#summary th,
+div#cgit div#summary td {
+ padding: 0.35em 0.6em;
+ text-align: left;
+ vertical-align: top;
+}
+div#cgit div#summary thead th {
+ border-bottom: 2px solid #888;
+}
+div#cgit div#summary tbody td {
+ border-bottom: 1px solid #ddd;
+}
+div#cgit div#summary tbody tr:nth-child(even) {
+ background: #f7f7f7;
+}
+div#cgit div#summary th + th,
+div#cgit div#summary td + td {
+ border-left: 1px solid #eee;
+}
+</style>
+]]
+
local buffer = ""
local should_render = true
local current_dir = "" -- Stores the directory prefix of the file being processed
@@ -137,6 +167,9 @@ function filter_close()
local output = md2html(processed)
if output then
+ if output:find("<table>", 1, true) then
+ emit(table_style)
+ end
emit(output)
else
emit("<p>Error: Could not execute md2html.</p>")