We can pass arbitrary local variables via WWW $ctx, so
just pass that into the one-off _do_linkify sub which
already exists.
# Follow git commit message conventions,
# first line is the Subject/title
my ($title) = ($txt =~ /\A([^\n]*)/s);
# Follow git commit message conventions,
# first line is the Subject/title
my ($title) = ($txt =~ /\A([^\n]*)/s);
$ctx->{-title_html} = ascii_html($title);
$ctx->{-title_html} = ascii_html($title);
my $nslash = ($key =~ tr!/!/!);
$ctx->{-upfx} = '../../../' . ('../' x $nslash);
my $nslash = ($key =~ tr!/!/!);
$ctx->{-upfx} = '../../../' . ('../' x $nslash);
-
- PublicInbox::WwwStream->response($ctx, $code, sub {
- my ($nr, undef) = @_;
- $nr == 1 ? '<pre>'.$txt.'</pre>' : undef
- });
+ PublicInbox::WwwStream->response($ctx, $code, \&_do_linkify);
+ my ($nr, $ctx) = @_;
+ return unless $nr == 1;
my $l = PublicInbox::Linkify->new;
my $l = PublicInbox::Linkify->new;
+ my $txt = delete $ctx->{txt};
+ $l->linkify_1($$txt);
- $hl->do_hl_text(\($_[0]));
- $_[0] = ascii_html($_[0]);
+ $$txt = ascii_html($$txt);
- $_[0] = $l->linkify_2($_[0]);
+ '<pre>' . $l->linkify_2($$txt) . '</pre>';
}
sub _srch_prefix ($$) {
}
sub _srch_prefix ($$) {