| 1 | package Markdent::Parser; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 35 | ▶ | use namespace::autoclean 0.09; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 35 | our $VERSION = '0.41'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 35 | ▶ | use Markdent::Parser::BlockParser; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 35 | ▶ | use Markdent::Parser::SpanParser; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 35 | ▶ | use Markdent::Types; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 35 | ▶ | use Module::Runtime qw( require_module ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 35 | ▶ | use Moose::Meta::Class; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 35 | ▶ | use Params::ValidationCompiler 0.14 qw( validation_for ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 35 | ▶ | use Specio::Declare; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 35 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 35 | ▶ | use Moose 0.92; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 35 | ▶ | use MooseX::SemiAffordanceAccessor 0.05; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 35 | ▶ | use MooseX::StrictConstructor 0.08; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 35 | with 'Markdent::Role::AnyParser'; | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 35 | has _block_parser_class => ( | |||||||||||||||||||||||||||||||||||||||||
| 25 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 26 | isa => t('BlockParserClass'), | ||||||||||||||||||||||||||||||||||||||||||
| 27 | init_arg => 'block_parser_class', | ||||||||||||||||||||||||||||||||||||||||||
| 28 | default => 'Markdent::Parser::BlockParser', | ||||||||||||||||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 35 | has _block_parser => ( | |||||||||||||||||||||||||||||||||||||||||
| 32 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 33 | does => object_does_type('Markdent::Role::BlockParser'), | ||||||||||||||||||||||||||||||||||||||||||
| 34 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | builder => '_build_block_parser', | ||||||||||||||||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 35 | has _block_parser_args => ( | |||||||||||||||||||||||||||||||||||||||||
| 40 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 41 | isa => t('HashRef'), | ||||||||||||||||||||||||||||||||||||||||||
| 42 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 43 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 35 | has _span_parser_class => ( | |||||||||||||||||||||||||||||||||||||||||
| 46 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 47 | isa => t('SpanParserClass'), | ||||||||||||||||||||||||||||||||||||||||||
| 48 | init_arg => 'span_parser_class', | ||||||||||||||||||||||||||||||||||||||||||
| 49 | default => 'Markdent::Parser::SpanParser', | ||||||||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 35 | has _span_parser => ( | |||||||||||||||||||||||||||||||||||||||||
| 53 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 54 | does => object_does_type('Markdent::Role::SpanParser'), | ||||||||||||||||||||||||||||||||||||||||||
| 55 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 56 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 57 | builder => '_build_span_parser', | ||||||||||||||||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 35 | has _span_parser_args => ( | |||||||||||||||||||||||||||||||||||||||||
| 61 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 62 | isa => t('HashRef'), | ||||||||||||||||||||||||||||||||||||||||||
| 63 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 64 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 186 | ▶ | override BUILDARGS => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 186 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 186 | my $args = super(); | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 186 | ▶ | if ( exists $args->{dialect} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | # XXX - deprecation warning | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | $args->{dialects} = [ delete $args->{dialect} ]; | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | elsif ( exists $args->{dialects} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 77 | $args->{dialects} = [ $args->{dialects} ] | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 50 | ▶ | unless ref $args->{dialects}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 186 | return $args; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 35 | }; | |||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 186 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 186 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 186 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 186 | $self->_set_classes_for_dialects($args); | |||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 186 | my %sp_args; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 186 | for my $key ( | |||||||||||||||||||||||||||||||||||||||||
| 92 | 1674 | grep {defined} | |||||||||||||||||||||||||||||||||||||||||
| 93 | 1674 | map { $_->init_arg } | |||||||||||||||||||||||||||||||||||||||||
| 94 | $self->_span_parser_class->meta->get_all_attributes | ||||||||||||||||||||||||||||||||||||||||||
| 95 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | $sp_args{$key} = $args->{$key} | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 558 | ▶ | if exists $args->{$key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 186 | $sp_args{handler} = $self->handler; | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 186 | $self->_set_span_parser_args( \%sp_args ); | |||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 186 | my %bp_args; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 186 | for my $key ( | |||||||||||||||||||||||||||||||||||||||||
| 107 | 1142 | grep {defined} | |||||||||||||||||||||||||||||||||||||||||
| 108 | 1142 | map { $_->init_arg } | |||||||||||||||||||||||||||||||||||||||||
| 109 | $self->_block_parser_class->meta->get_all_attributes | ||||||||||||||||||||||||||||||||||||||||||
| 110 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | $bp_args{$key} = $args->{$key} | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 558 | ▶ | if exists $args->{$key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 186 | $bp_args{handler} = $self->handler; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 186 | $bp_args{span_parser} = $self->_span_parser; | |||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 186 | $self->_set_block_parser_args( \%bp_args ); | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 186 | ▶ | sub _set_classes_for_dialects { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_classes_for_dialects: called CC=11 SCAR=24.1
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 186 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 124 | 186 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 186 | my $dialects = delete $args->{dialects}; | |||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 186 | ▶ | return unless @{ $dialects || [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$dialects || []
MC/DC100%1/1
$dialects || []
$dialects
Truth table100%2/2
A
A= $dialects
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 48 | for my $thing (qw( block_parser span_parser )) { | |||||||||||||||||||||||||||||||||||||||||
| 131 | 96 | my @roles; | |||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 96 | for my $dialect ( @{$dialects} ) { | |||||||||||||||||||||||||||||||||||||||||
| 134 | 98 | ▶ | next if $dialect eq 'Standard'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 98 | my $role = $self->_role_name_for_dialect( $dialect, $thing ); | |||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 98 | ▶ | my $found = try { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 98 | require_module($role); | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | ▶ | catch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | ▶ | die $_ unless $_ =~ /Can't locate/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | 0; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 98 | }; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 98 | ▶ | next unless $found; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 97 | my $specified_class = $args->{ $thing . '_class' }; | |||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | next | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 97 | ▶ | if $specified_class | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$specified_class and $specified_class->can("meta") and $specified_class->meta->does_role($role)
$specified_class and $specified_class->can("meta")
MC/DC0%0/3
$specified_class and $specified_class->can("meta") and $specified_class->meta->does_role($role)
$specified_class
$specified_class->can("meta")
$specified_class->meta->does_role($role)
Truth table50%2/4
A and B and C
A= $specified_classB= $specified_class->can("meta")C= $specified_class->meta->does_role($role)
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | && $specified_class->can('meta') | ||||||||||||||||||||||||||||||||||||||||||
| 152 | && $specified_class->meta->does_role($role); | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 97 | push @roles, $role; | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 96 | ▶ | next unless @roles; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 95 | my $class_meth = q{_} . $thing . '_class'; | |||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 95 | my $class = Moose::Meta::Class->create_anon_class( | |||||||||||||||||||||||||||||||||||||||||
| 162 | superclasses => [ $self->$class_meth() ], | ||||||||||||||||||||||||||||||||||||||||||
| 163 | roles => \@roles, | ||||||||||||||||||||||||||||||||||||||||||
| 164 | cache => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 165 | )->name; | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 95 | my $set_meth = '_set' . $class_meth; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 95 | $self->$set_meth($class); | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 98 | ▶ | sub _role_name_for_dialect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_role_name_for_dialect: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 98 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 98 | my $dialect = shift; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 98 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 98 | my $suffix = join q{}, map {ucfirst} split /_/, $type; | |||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 98 | ▶ | if ( $dialect =~ /::/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 4 | return join '::', $dialect, $suffix; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 94 | return join '::', 'Markdent::Dialect', $dialect, $suffix; | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 184 | ▶ | sub _build_block_parser { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_block_parser: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 184 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 184 | return $self->_block_parser_class->new( $self->_block_parser_args ); | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 186 | ▶ | sub _build_span_parser { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_span_parser: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 186 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 186 | return $self->_span_parser_class->new( $self->_span_parser_args ); | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | { | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 35 | my $validator = validation_for( | |||||||||||||||||||||||||||||||||||||||||
| 201 | params => [ markdown => { type => t('Str') } ], | ||||||||||||||||||||||||||||||||||||||||||
| 202 | named_to_list => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 203 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 180 | ▶ | sub parse { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 180 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 180 | my ($text) = $validator->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 180 | $self->_clean_text( \$text ); | |||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 180 | $self->_send_event('StartDocument'); | |||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 180 | $self->_block_parser->parse_document( \$text ); | |||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | 178 | $self->_send_event('EndDocument'); | |||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 178 | return; | |||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 35 | ▶ | sub _clean_text { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clean_text: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 180 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 180 | my $text = shift; | |||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 180 | ${$text} =~ s/\r\n?/\n/g; | |||||||||||||||||||||||||||||||||||||||||
| 226 | 4 | ${$text} .= "\n" | |||||||||||||||||||||||||||||||||||||||||
| 227 | 180 | ▶ | unless substr( ${$text}, -1, 1 ) eq "\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 180 | return; | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 35 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 35 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | # ABSTRACT: A markdown parser | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | __END__ | ||||||||||||||||||||||||||||||||||||||||||