From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 812CD205BD for ; Wed, 24 Apr 2019 23:02:14 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/5] examples/cgit-commit-filter.lua: some doc updates Date: Wed, 24 Apr 2019 23:02:14 +0000 Message-Id: <20190424230214.2378-6-e@80x24.org> In-Reply-To: <20190424230214.2378-1-e@80x24.org> References: <20190424230214.2378-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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. --- examples/cgit-commit-filter.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/cgit-commit-filter.lua b/examples/cgit-commit-filter.lua index a8f9e1d..1677253 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('') end else + -- pass the body-through as-is + -- TODO: optionally use WwwHighlight for linkification like + -- cgit-wwwhighlight-filter.lua html(buffer) end return 0 -- EW