line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Xatena::Node::Pre; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
88
|
use strict; |
|
17
|
|
|
|
|
27
|
|
|
17
|
|
|
|
|
569
|
|
4
|
17
|
|
|
17
|
|
84
|
use warnings; |
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
412
|
|
5
|
17
|
|
|
17
|
|
81
|
use base qw(Text::Xatena::Node::StopP); |
|
17
|
|
|
|
|
43
|
|
|
17
|
|
|
|
|
495
|
|
6
|
|
|
|
|
|
|
use constant { |
7
|
17
|
|
|
|
|
4540
|
BEGINNING => qr/^>\|$/, |
8
|
|
|
|
|
|
|
ENDOFNODE => qr/^(.*?)\|<$/, |
9
|
17
|
|
|
17
|
|
92
|
}; |
|
17
|
|
|
|
|
32
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub parse { |
12
|
338
|
|
|
338
|
0
|
540
|
my ($class, $s, $parent, $stack) = @_; |
13
|
338
|
100
|
|
|
|
833
|
if ($s->scan(BEGINNING)) { |
14
|
7
|
|
|
|
|
45
|
my $node = $class->new; |
15
|
7
|
|
|
|
|
338
|
push @$parent, $node; |
16
|
7
|
|
|
|
|
15
|
push @$stack, $node; |
17
|
7
|
|
|
|
|
51
|
return 1; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
331
|
100
|
|
|
|
891
|
if ($s->scan(ENDOFNODE)) { |
21
|
7
|
|
|
|
|
20
|
push @$parent, $s->matched->[1]; |
22
|
7
|
|
|
|
|
17
|
my $node = pop @$stack; |
23
|
7
|
50
|
|
|
|
25
|
ref($node) eq $class or warn sprintf("syntax error: unmatched syntax got:%s expected:%s", ref($node), $class); |
24
|
7
|
|
|
|
|
49
|
return 1; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub as_html { |
29
|
5
|
|
|
5
|
0
|
12
|
my ($self, $context, %opts) = @_; |
30
|
5
|
|
|
|
|
35
|
$context->_tmpl(__PACKAGE__, q[ |
31
|
|
|
|
|
|
|
{{= $content }} |
32
|
|
|
|
|
|
|
], { |
33
|
|
|
|
|
|
|
content => $self->SUPER::as_html($context, %opts, stopp => 1), |
34
|
|
|
|
|
|
|
}); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
__END__ |