From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] wwwstream: link to cgit URLs for coderepo
Date: Tue, 15 Sep 2020 20:15:24 +0000 [thread overview]
Message-ID: <20200915201524.15535-1-e@80x24.org> (raw)
Hopefully this reduces the ambiguity between code for the
project(s) using public-inbox and the code for public-inbox
itself.
---
lib/PublicInbox/WwwStream.pm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index f7e09c24..638f4e27 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -76,6 +76,26 @@ sub html_top ($) {
'</head><body>'. $top . (delete($ctx->{-html_tip}) // '');
}
+sub coderepos ($) {
+ my ($ctx) = @_;
+ my $ibx = $ctx->{-inbox};
+ my @ret;
+ if (defined(my $cr = $ibx->{coderepo})) {
+ my $cfg = $ctx->{www}->{pi_config};
+ my $env = $ctx->{env};
+ for my $cr_name (@$cr) {
+ my $urls = $cfg->{"coderepo.$cr_name.cgiturl"};
+ if ($urls) {
+ $ret[0] //= <<EOF;
+code repositories for the project(s) associated with this inbox:
+EOF
+ $ret[0] .= "\n\t".prurl($env, $_) for @$urls;
+ }
+ }
+ }
+ @ret; # may be empty
+}
+
sub code_footer ($) {
my ($env) = @_;
my $u = prurl($env, $CODE_URL);
@@ -153,6 +173,7 @@ EOF
'<hr><pre>'.join("\n\n",
$desc,
$urls,
+ coderepos($ctx),
code_footer($ctx->{env})
).'</pre></body></html>';
}
reply other threads:[~2020-09-15 20:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200915201524.15535-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).