| 1 | package Text::Xatena::Node::Pre; | ||||||||||
| 2 | |||||||||||
| 3 | 19 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 19 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 19 | ▶ | use base qw(Text::Xatena::Node::StopP); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 19 | ▶ | use constant { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 19 | BEGINNING => qr/^>\|$/, | |||||||||
| 8 | ENDOFNODE => qr/^(.*?)\|<$/, | ||||||||||
| 9 | 19 | }; | |||||||||
| 10 | |||||||||||
| 11 | 363 | ▶ | sub parse { | ||||||||
|
Subroutine
parse: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 12 | 363 | my ($class, $s, $parent, $stack) = @_; | |||||||||
| 13 | 363 | ▶ | if ($s->scan(BEGINNING)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 7 | my $node = $class->new; | |||||||||
| 15 | 7 | push @$parent, $node; | |||||||||
| 16 | 7 | push @$stack, $node; | |||||||||
| 17 | 7 | return 1; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 356 | ▶ | if ($s->scan(ENDOFNODE)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 7 | push @$parent, $s->matched->[1]; | |||||||||
| 22 | 7 | my $node = pop @$stack; | |||||||||
| 23 | 7 | ▶ | ref($node) eq $class or warn sprintf("syntax error: unmatched syntax got:%s expected:%s", ref($node), $class); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 7 | return 1; | |||||||||
| 25 | } | ||||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 5 | ▶ | sub as_html { | ||||||||
|
Subroutine
as_html: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 29 | 5 | my ($self, $context, %opts) = @_; | |||||||||
| 30 | 5 | $context->_tmpl(__PACKAGE__, q[ | |||||||||
| 31 | <pre>{{= $content }}</pre> | ||||||||||
| 32 | ], { | ||||||||||
| 33 | content => $self->SUPER::as_html($context, %opts, stopp => 1), | ||||||||||
| 34 | }); | ||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 19 | 1; | |||||||||
| 38 | __END__ | ||||||||||