* [PATCH] wwwstream: linkify coderepo URLs
@ 2020-12-18 20:53 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2020-12-18 20:53 UTC (permalink / raw)
To: meta
It seems like a good idea to get more cgit visibility.
---
lib/PublicInbox/WwwStream.pm | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 66e34a12..49940262 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -78,22 +78,20 @@ sub html_top ($) {
sub coderepos ($) {
my ($ctx) = @_;
- my $ibx = $ctx->{ibx};
+ my $cr = $ctx->{ibx}->{coderepo} // return ();
+ my $cfg = $ctx->{www}->{pi_cfg};
my @ret;
- if (defined(my $cr = $ibx->{coderepo})) {
- my $cfg = $ctx->{www}->{pi_cfg};
- my $env = $ctx->{env};
- for my $cr_name (@$cr) {
- my $urls = $cfg->{"coderepo.$cr_name.cgiturl"};
- if ($urls) {
- $ret[0] //= <<EOF;
+ for my $cr_name (@$cr) {
+ my $urls = $cfg->{"coderepo.$cr_name.cgiturl"} // next;
+ $ret[0] //= <<EOF;
code repositories for the project(s) associated with this inbox:
EOF
- $ret[0] .= "\n\t".prurl($env, $_) for @$urls;
- }
+ for my $u (@$urls) {
+ $u = ascii_html(prurl($ctx->{env}, $u));
+ $ret[0] .= qq(\n\t<a\nhref="$u">$u</a>);
}
}
- @ret; # may be empty
+ @ret; # may be empty, this sub is called as an arg for join()
}
sub code_footer ($) {
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-12-18 20:53 7% [PATCH] wwwstream: linkify coderepo URLs 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).