about summary refs log tree commit homepage
path: root/examples/cgit-commit-filter.lua
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-04-24 22:51:42 +0000
committerEric Wong <e@80x24.org>2019-04-25 03:12:14 +0000
commit1b62a491cccb3c71d60962c798cf02c1b9344ce1 (patch)
tree5bd84bd8db02c0fa7bdb460e814683d6e86f73c4 /examples/cgit-commit-filter.lua
parente460a9fdf3b557203f0225989b0676c98264067d (diff)
downloadpublic-inbox-1b62a491cccb3c71d60962c798cf02c1b9344ce1.tar.gz
It's been a while since I wrote this, and it needs to be kept
up-to-date with some advances in our Perl code.
Diffstat (limited to 'examples/cgit-commit-filter.lua')
-rw-r--r--examples/cgit-commit-filter.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/cgit-commit-filter.lua b/examples/cgit-commit-filter.lua
index a8f9e1d1..16772534 100644
--- a/examples/cgit-commit-filter.lua
+++ b/examples/cgit-commit-filter.lua
@@ -13,6 +13,9 @@
 local urls = {}
 urls['public-inbox.git'] = 'https://public-inbox.org/meta/'
 -- additional URLs here...
+-- TODO we should be able to auto-generate this based on "coderepo"
+-- directives in the public-inbox config file; but keep in mind
+-- the mapping is M:N between inboxes and coderepos
 
 function filter_open(...)
         lineno = 0
@@ -20,6 +23,9 @@ function filter_open(...)
 end
 
 function filter_close()
+        -- cgit opens and closes this filter for the commit subject
+        -- and body separately, and we only generate the link based
+        -- on the commit subject:
         if lineno == 1 and string.find(buffer, "\n") == nil then
                 u = urls[os.getenv('CGIT_REPO_URL')]
                 if u == nil then
@@ -32,6 +38,9 @@ function filter_close()
                         html('</tt></a>')
                 end
         else
+                -- pass the body-through as-is
+                -- TODO: optionally use WwwHighlight for linkification like
+                -- cgit-wwwhighlight-filter.lua
                 html(buffer)
         end
         return 0