/usr/share/perl5/Text/Trac/Blockquote.pm is in libtext-trac-perl 0.18-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 | package Text::Trac::Blockquote;
use strict;
use warnings;
use base qw( Text::Trac::BlockNode );
our $VERSION = '0.18';
sub init {
my $self = shift;
$self->pattern(qr/^(?:>|\s+(?![*\s]|[\daiAI]\.\ +).+$)/);
$self->block_nodes( [qw( heading p ul ol )] );
}
sub parse {
my ( $self, $l ) = @_;
my $c = $self->{context};
my $pattern = $self->pattern;
return if $l =~ /::$/;
if ( $l =~ /^(>+).+/ ) {
my $depth = length $1;
my $blockquote_depth = 0;
for ( @{ $c->in_block_of } ) {
$blockquote_depth++ if $_ eq 'blockquote';
}
my $class = $c->{class} ? q{class="citation"} : '';
if ( $depth > $blockquote_depth ) {
for ( 1 .. $depth ) {
$c->htmllines(qq{<blockquote $class>});
push @{ $c->in_block_of }, 'blockquote';
}
}
}
else {
$c->htmllines('<blockquote>');
push @{ $c->in_block_of }, 'blockquote';
}
$c->unshiftline;
while ( $c->hasnext ) {
last if ( $c->nextline =~ /^\s*$/ );
my $l = $c->shiftline;
if ( $l =~ /^(>+).+/ ) {
my $depth = length $1;
my $blockquote_depth = 0;
for ( @{ $c->in_block_of } ) {
$blockquote_depth++ if $_ eq 'blockquote';
}
if ( $depth < $blockquote_depth ) {
$c->unshiftline;
last;
}
}
# parse other block nodes
my $block_parsers = $self->_get_matched_parsers( 'block', $l );
for my $parser ( @{$block_parsers} ) {
$l = $parser->parse($l);
}
# parse inline nodes
my $inline_parsers = $l ? $self->_get_matched_parsers( 'inline', $l ) : undef;
for my $parser ( @{$inline_parsers} ) {
$l = $parser->parse($l);
}
$c->htmllines($l);
}
if ( @{ $c->in_block_of } and $c->in_block_of->[-1] eq 'blockquote' ) {
pop @{ $c->in_block_of };
$c->htmllines('</blockquote>');
}
return $l;
}
1;
|