user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] wwwstream: link to cgit URLs for coderepo
@ 2020-09-15 20:15 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-09-15 20:15 UTC (permalink / raw)
  To: meta

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>';
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-15 20:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 20:15 [PATCH] wwwstream: link to cgit URLs for coderepo Eric Wong

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).