/usr/share/perl5/Text/Trac/P.pm is in libtext-trac-perl 0.16-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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | package Text::Trac::P;
use strict;
use base qw(Text::Trac::BlockNode);
use Text::Trac::Text;
our $VERSION = '0.16';
sub parse {
my ( $self, $l ) = @_;
my $c = $self->{context};
if( !@{$c->in_block_of} or $c->in_block_of->[-1] ne 'p' ){
$c->htmllines('<p>');
push @{$c->in_block_of}, 'p';
}
# define block parsers called.
$self->block_nodes( [ qw( blockquote hr ) ]);
$self->block_parsers( $self->_get_parsers('block') );
my $cite_depth = 0;
$c->unshiftline;
while( $c->hasnext ){
last if $c->nextline =~ /^$/;
$l = $c->shiftline;
last if $l =~ /^\s+$/;
my $blockquote_depth = 0;
for ( @{$c->in_block_of} ) {
$blockquote_depth++ if $_ eq 'blockquote';
}
if ( $l =~ /^(>+)/ ) {
$cite_depth = length $1;
if ( $blockquote_depth != $cite_depth ) {
$c->unshiftline;
last;
}
else {
$l =~ s/^>+//;
}
}
elsif ( $l !~ /^(?:>|\s+)/ and $blockquote_depth ) {
$c->htmllines('</p>');
pop @{$c->in_block_of};
for ( 1.. $blockquote_depth ) {
$c->htmllines('</blockquote>');
pop @{$c->in_block_of};
}
$c->unshiftline;
last;
}
# parse other block nodes
my $parsers = $self->_get_matched_parsers('block', $l);
if( grep { ref($_) ne 'Text::Trac::P' } @{$parsers} ){
$c->htmllines('</p>');
pop @{$c->in_block_of};
$c->unshiftline;
last;
}
# parse inline nodes
$l = $self->replace($l);
$c->htmllines($l);
}
if( @{$c->in_block_of} and $c->in_block_of->[-1] eq 'p' ){
$c->htmllines('</p>');
pop @{$c->in_block_of};
my $blockquote_depth = 0;
for ( @{$c->in_block_of} ) {
$blockquote_depth++ if $_ eq 'blockquote';
}
if ( $cite_depth ) {
for ( $blockquote_depth .. length $1 ) {
$c->htmllines('</blockquote>');
pop @{$c->in_block_of};
}
}
}
return;
}
1;
|