/usr/share/perl5/Text/Trac/Ul.pm is in libtext-trac-perl 0.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | package Text::Trac::Ul;
use strict;
use base qw(Text::Trac::BlockNode);
sub init {
my $self = shift;
$self->pattern(qr/(\s+) \* \s+ (.*)$/xms);
}
sub parse {
my ( $self, $l ) = @_;
my $c = $self->{context};
my $pattern = $self->pattern;
$l =~ $pattern or return $l;
my $space = length($1);
my $level = $c->ul->{level} || 0;
$c->ul->{space} ||= 0;
if ( $space > $c->ul->{space} ) {
for ( 1 .. ( $space + 1 ) / 2 - $level ) {
$l = '<ul>' . $l;
$level++;
}
}
elsif ( $space < $c->ul->{space} ) {
for ( 1 .. ( $c->ul->{space} - $space ) / 2 ) {
$l = '</li></ul>' . $l;
$level--;
}
$l =~ s!(?<=</(?:ul|li)>)(?= )!</li>!;
}
else {
$l = "</li>$l";
}
$c->ul({ level => $level, space => $space });
# parse inline nodes
$l =~ s{ $pattern }{"<li>" . $self->replace($2)}xmsge;
if ( $c->hasnext and $c->nextline =~ /$pattern/ ){
$self->parse($l);
}
else {
for ( 1 .. $c->ul->{level} ){
$l .= '</li></ul>';
}
$c->ul->{level} = 0;
$c->ul->{space} = 0;
}
# parse inline nodes
$c->htmllines($l);
return;
}
1;
|