diff options
author | Eric Wong <e@80x24.org> | 2023-01-04 10:34:05 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-01-05 09:59:00 +0000 |
commit | 0aa46753c3b033aee1b4de5f358c33b912febe07 (patch) | |
tree | f681708eaf77ed8a896fb698766397e6d2019262 /lib/PublicInbox/WwwStream.pm | |
parent | 44fbd4169f7434442dbf57851232edafa6fd0e46 (diff) | |
download | public-inbox-0aa46753c3b033aee1b4de5f358c33b912febe07.tar.gz |
WwwStream and WwwText basically show the same thing, except the latter relies on Linkify to create links.
Diffstat (limited to 'lib/PublicInbox/WwwStream.pm')
-rw-r--r-- | lib/PublicInbox/WwwStream.pm | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index f5b4df9f..59edad5d 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@ -90,24 +90,22 @@ sub coderepos ($) { my ($ctx) = @_; $ctx->{ibx} // return inboxes($ctx); my $cr = $ctx->{ibx}->{coderepo} // return (); - my $cfg = $ctx->{www}->{pi_cfg}; my $upfx = ($ctx->{-upfx} // ''). '../'; my $pfx = $ctx->{base_url} //= $ctx->base_url; my $up = $upfx =~ tr!/!/!; $pfx =~ s!/[^/]+\z!/! for (1..$up); - my @ret = ('<a id=code>' . + $pfx .= '/' if substr($pfx, -1, 1) ne '/'; + my $buf = '<a id=code>' . 'Code repositories for project(s) associated with this '. - $ctx->{ibx}->thing_type . "\n"); - my $objs = $cfg->repo_objs($ctx->{ibx}); - for my $git (@$objs) { - my @urls = $git->pub_urls($ctx->{env}); - for (@urls) { - my $u = m!\A(?:[a-z\+]+:)?//! ? $_ : $pfx.$_; + $ctx->{ibx}->thing_type . "\n"; + for my $git (@{$ctx->{www}->{pi_cfg}->repo_objs($ctx->{ibx})}) { + for ($git->pub_urls($ctx->{env})) { + my $u = m!\A(?:[a-z\+]+:)?//!i ? $_ : $pfx.$_; $u = ascii_html(prurl($ctx->{env}, $u)); - $ret[0] .= qq(\n\t<a\nhref="$u">$u</a>); + $buf .= qq(\n\t<a\nhref="$u">$u</a>); } } - @ret; # may be empty, this sub is called as an arg for join() + ($buf); } sub _html_end { |