examples/cgit-commit-filter.lua | 9 +++++++++ diff --git a/examples/cgit-commit-filter.lua b/examples/cgit-commit-filter.lua index a8f9e1d1a9c129b69f42d295adb3fe3c19f3fb8a..167725348be4a94fc508a44c38b29a2ff7a171a4 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 @@ buffer = "" 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 @@ html_txt(buffer) html('') end else + -- pass the body-through as-is + -- TODO: optionally use WwwHighlight for linkification like + -- cgit-wwwhighlight-filter.lua html(buffer) end return 0