about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-09-15 20:15:24 +0000
committerEric Wong <e@80x24.org>2020-09-16 04:06:10 +0000
commiteed1a9ccb1b0bb9699aba70286e8189de5841ec4 (patch)
tree9dde983be200814f0f233ff40271a0a1849ab77f
parent82d793d96cc37d5b3cf562c7081bfacb05d1e4cd (diff)
downloadpublic-inbox-eed1a9ccb1b0bb9699aba70286e8189de5841ec4.tar.gz
Hopefully this reduces the ambiguity between code for the
project(s) using public-inbox and the code for public-inbox
itself.
-rw-r--r--lib/PublicInbox/WwwStream.pm21
1 files changed, 21 insertions, 0 deletions
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>';
 }