| 1 | package Markdent::Role::HTMLStream; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 34 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 34 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 34 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 34 | our $VERSION = '0.39'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 34 | ▶ | use HTML::Entities qw( encode_entities ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 34 | ▶ | use Markdent::CheckedOutput; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 34 | ▶ | use Markdent::Types; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 34 | ▶ | use Params::ValidationCompiler qw( validation_for ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 34 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 34 | with 'Markdent::Role::EventsAsMethods'; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 34 | requires qw( start_document end_document ); | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 34 | has _output => ( | |||||||||||||||||||||||||||
| 21 | is => 'ro', | ||||||||||||||||||||||||||||
| 22 | isa => t('OutputStream'), | ||||||||||||||||||||||||||||
| 23 | required => 1, | ||||||||||||||||||||||||||||
| 24 | init_arg => 'output', | ||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 34 | has _encodable_entities => ( | |||||||||||||||||||||||||||
| 28 | is => 'ro', | ||||||||||||||||||||||||||||
| 29 | isa => t('Str'), | ||||||||||||||||||||||||||||
| 30 | default => q{<>&"\x00-\x09\x11\x12\x14-\x1f}, | ||||||||||||||||||||||||||||
| 31 | init_arg => 'encodable_entities', | ||||||||||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | override BUILDARGS => sub { | ||||||||||||||||||||||||||||
| 35 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 5 | my $args = super(); | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 5 | my $output = $args->{output}; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | # This will blow up soon if there's no output. | ||||||||||||||||||||||||||||
| 42 | 5 | ▶ | return $args unless $output; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | # If the user supplied a non IO::Handle object we won't wrap it. | ||||||||||||||||||||||||||||
| 45 | 5 | ▶ | return $args if blessed $output && !$output->isa('IO::Handle'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($output) and not $output->isa("IO::Handle")
MC/DC0%0/2
builtin::blessed($output) and not $output->isa("IO::Handle")
builtin::blessed($output)
not $output->isa("IO::Handle")
Truth table66%2/3
A and not(B)
A= builtin::blessed($output)B= not $output->isa("IO::Handle")
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 5 | $args->{output} = Markdent::CheckedOutput->new($output); | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 5 | return $args; | |||||||||||||||||||||||||||
| 50 | 34 | }; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | { | ||||||||||||||||||||||||||||
| 53 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 54 | params => [ | ||||||||||||||||||||||||||||
| 55 | level => { type => t('HeaderLevel') }, | ||||||||||||||||||||||||||||
| 56 | ], | ||||||||||||||||||||||||||||
| 57 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | sub start_header { | ||||||||||||||||||||||||||||
| 61 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_header: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 62 | 3 | my ($level) = $validator->(@_); | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 3 | $self->_stream_start_tag( 'h' . $level ); | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||
| 69 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 70 | params => [ | ||||||||||||||||||||||||||||
| 71 | level => { type => t('HeaderLevel') }, | ||||||||||||||||||||||||||||
| 72 | ], | ||||||||||||||||||||||||||||
| 73 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 74 | ); | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | sub end_header { | ||||||||||||||||||||||||||||
| 77 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_header: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 3 | my ($level) = $validator->(@_); | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 3 | $self->_stream_end_tag( 'h' . $level ); | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 34 | sub start_blockquote { | |||||||||||||||||||||||||||
| 85 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_blockquote: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | $self->_stream_start_tag('blockquote'); | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | sub end_blockquote { | ||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_blockquote: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | $self->_stream_end_tag('blockquote'); | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | sub start_unordered_list { | ||||||||||||||||||||||||||||
| 97 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_unordered_list: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 3 | $self->_stream_start_tag('ul'); | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | sub end_unordered_list { | ||||||||||||||||||||||||||||
| 103 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_unordered_list: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 3 | $self->_stream_end_tag('ul'); | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | sub start_ordered_list { | ||||||||||||||||||||||||||||
| 109 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_ordered_list: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | $self->_stream_start_tag('ol'); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | sub end_ordered_list { | ||||||||||||||||||||||||||||
| 115 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_ordered_list: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 0 | $self->_stream_end_tag('ol'); | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | sub start_list_item { | ||||||||||||||||||||||||||||
| 121 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_list_item: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 6 | $self->_stream_start_tag('li'); | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | sub end_list_item { | ||||||||||||||||||||||||||||
| 127 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_list_item: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 6 | $self->_stream_end_tag('li'); | |||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | { | ||||||||||||||||||||||||||||
| 133 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 134 | params => [ | ||||||||||||||||||||||||||||
| 135 | code => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 136 | language => { | ||||||||||||||||||||||||||||
| 137 | type => t('Str'), | ||||||||||||||||||||||||||||
| 138 | optional => 1, | ||||||||||||||||||||||||||||
| 139 | }, | ||||||||||||||||||||||||||||
| 140 | ], | ||||||||||||||||||||||||||||
| 141 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 142 | ); | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | sub code_block { | ||||||||||||||||||||||||||||
| 145 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
code_block: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 146 | 0 | my ( $code, $language ) = $validator->(@_); | |||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | $self->_stream_start_tag('pre'); | |||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 0 | ▶ | my %class = $language ? ( class => 'language-' . $language ) : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 151 | 0 | $self->_stream_start_tag( 'code', \%class ); | |||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 0 | $self->_stream_text($code); | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | $self->_stream_end_tag('code'); | |||||||||||||||||||||||||||
| 156 | 0 | $self->_stream_end_tag('pre'); | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | { | ||||||||||||||||||||||||||||
| 161 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 162 | params => [ | ||||||||||||||||||||||||||||
| 163 | text => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 164 | ], | ||||||||||||||||||||||||||||
| 165 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 166 | ); | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | sub preformatted { | ||||||||||||||||||||||||||||
| 169 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
preformatted: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 170 | 0 | my ($text) = $validator->(@_); | |||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | $self->_stream_start_tag('pre'); | |||||||||||||||||||||||||||
| 173 | 0 | $self->_stream_start_tag('code'); | |||||||||||||||||||||||||||
| 174 | 0 | $self->_stream_text($text); | |||||||||||||||||||||||||||
| 175 | 0 | $self->_stream_end_tag('code'); | |||||||||||||||||||||||||||
| 176 | 0 | $self->_stream_end_tag('pre'); | |||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 34 | sub start_paragraph { | |||||||||||||||||||||||||||
| 181 | 9 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_paragraph: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 9 | $self->_stream_start_tag('p'); | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | sub end_paragraph { | ||||||||||||||||||||||||||||
| 187 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_paragraph: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 7 | $self->_stream_end_tag('p'); | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | { | ||||||||||||||||||||||||||||
| 193 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 194 | params => [ | ||||||||||||||||||||||||||||
| 195 | caption => { | ||||||||||||||||||||||||||||
| 196 | type => t('Str'), | ||||||||||||||||||||||||||||
| 197 | optional => 1, | ||||||||||||||||||||||||||||
| 198 | }, | ||||||||||||||||||||||||||||
| 199 | ], | ||||||||||||||||||||||||||||
| 200 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 201 | ); | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | sub start_table { | ||||||||||||||||||||||||||||
| 204 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_table: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 205 | 0 | my ($caption) = $validator->(@_); | |||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 0 | $self->_stream_start_tag('table'); | |||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 0 | ▶ | if ( defined $caption && length $caption ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $caption and length $caption
MC/DC0%0/2
defined $caption and length $caption
defined $caption
length $caption
Truth table0%0/3
A and B
A= defined $captionB= length $caption
| |||||||||||||||||||||||||||||
| 210 | 0 | $self->_stream_start_tag('caption'); | |||||||||||||||||||||||||||
| 211 | 0 | $self->_stream_text($caption); | |||||||||||||||||||||||||||
| 212 | 0 | $self->_stream_end_tag('caption'); | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 34 | sub end_table { | |||||||||||||||||||||||||||
| 218 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_table: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 0 | $self->_stream_end_tag('table'); | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | sub start_table_header { | ||||||||||||||||||||||||||||
| 224 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_table_header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 0 | $self->_stream_start_tag('thead'); | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | sub end_table_header { | ||||||||||||||||||||||||||||
| 230 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_table_header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 0 | $self->_stream_end_tag('thead'); | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | sub start_table_body { | ||||||||||||||||||||||||||||
| 236 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_table_body: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | $self->_stream_start_tag('tbody'); | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | sub end_table_body { | ||||||||||||||||||||||||||||
| 242 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_table_body: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 0 | $self->_stream_end_tag('tbody'); | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | sub start_table_row { | ||||||||||||||||||||||||||||
| 248 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_table_row: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 0 | $self->_stream_start_tag('tr'); | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | sub end_table_row { | ||||||||||||||||||||||||||||
| 254 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_table_row: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 0 | $self->_stream_end_tag('tr'); | |||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | { | ||||||||||||||||||||||||||||
| 260 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 261 | params => [ | ||||||||||||||||||||||||||||
| 262 | alignment => { | ||||||||||||||||||||||||||||
| 263 | type => t('TableCellAlignment'), | ||||||||||||||||||||||||||||
| 264 | optional => 1, | ||||||||||||||||||||||||||||
| 265 | }, | ||||||||||||||||||||||||||||
| 266 | colspan => { type => t('PositiveInt') }, | ||||||||||||||||||||||||||||
| 267 | is_header_cell => { type => t('Bool') }, | ||||||||||||||||||||||||||||
| 268 | ], | ||||||||||||||||||||||||||||
| 269 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 270 | ); | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | sub start_table_cell { | ||||||||||||||||||||||||||||
| 273 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_table_cell: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 274 | 0 | my ( $alignment, $colspan, $is_header ) = $validator->(@_); | |||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 0 | ▶ | my $tag = $is_header ? 'th' : 'td'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | 0 | my %attr; | |||||||||||||||||||||||||||
| 279 | 0 | ▶ | $attr{style} = "text-align: $alignment" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | if $alignment; | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | 0 | ▶ | $attr{colspan} = $colspan | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 283 | if $colspan != 1; | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | 0 | $self->_stream_start_tag( $tag, \%attr ); | |||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | { | ||||||||||||||||||||||||||||
| 290 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 291 | params => [ | ||||||||||||||||||||||||||||
| 292 | is_header_cell => { type => t('Bool') }, | ||||||||||||||||||||||||||||
| 293 | ], | ||||||||||||||||||||||||||||
| 294 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 295 | ); | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | sub end_table_cell { | ||||||||||||||||||||||||||||
| 298 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_table_cell: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 299 | 0 | my ($is_header) = $validator->(@_); | |||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | 0 | ▶ | $self->_stream_end_tag( $is_header ? 'th' : 'td' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 34 | sub start_emphasis { | |||||||||||||||||||||||||||
| 306 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_emphasis: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | 3 | $self->_stream_start_tag('em'); | |||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | sub end_emphasis { | ||||||||||||||||||||||||||||
| 312 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_emphasis: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | 3 | $self->_stream_end_tag('em'); | |||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | sub start_strong { | ||||||||||||||||||||||||||||
| 318 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_strong: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 3 | $self->_stream_start_tag('strong'); | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | sub end_strong { | ||||||||||||||||||||||||||||
| 324 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_strong: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 3 | $self->_stream_end_tag('strong'); | |||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | sub start_strikethrough { | ||||||||||||||||||||||||||||
| 330 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_strikethrough: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | 0 | $self->_stream_start_tag('del'); | |||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | sub end_strikethrough { | ||||||||||||||||||||||||||||
| 336 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_strikethrough: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | 0 | $self->_stream_end_tag('del'); | |||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | sub start_code { | ||||||||||||||||||||||||||||
| 342 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_code: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | 0 | $self->_stream_start_tag('code'); | |||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | sub end_code { | ||||||||||||||||||||||||||||
| 348 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_code: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | 0 | $self->_stream_end_tag('code'); | |||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | { | ||||||||||||||||||||||||||||
| 354 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 355 | params => [ | ||||||||||||||||||||||||||||
| 356 | uri => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 357 | ], | ||||||||||||||||||||||||||||
| 358 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 359 | ); | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | sub auto_link { | ||||||||||||||||||||||||||||
| 362 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
auto_link: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 363 | 0 | my ($uri) = $validator->(@_); | |||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 0 | $self->_stream_start_tag( 'a', { href => $uri } ); | |||||||||||||||||||||||||||
| 366 | 0 | $self->_stream_text($uri); | |||||||||||||||||||||||||||
| 367 | 0 | $self->_stream_end_tag('a'); | |||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | { | ||||||||||||||||||||||||||||
| 372 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 373 | params => { | ||||||||||||||||||||||||||||
| 374 | uri => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 375 | title => { | ||||||||||||||||||||||||||||
| 376 | type => t('Str'), | ||||||||||||||||||||||||||||
| 377 | optional => 1, | ||||||||||||||||||||||||||||
| 378 | }, | ||||||||||||||||||||||||||||
| 379 | id => { | ||||||||||||||||||||||||||||
| 380 | type => t('Str'), | ||||||||||||||||||||||||||||
| 381 | optional => 1, | ||||||||||||||||||||||||||||
| 382 | }, | ||||||||||||||||||||||||||||
| 383 | is_implicit_id => { | ||||||||||||||||||||||||||||
| 384 | type => t('Bool'), | ||||||||||||||||||||||||||||
| 385 | optional => 1, | ||||||||||||||||||||||||||||
| 386 | }, | ||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||
| 388 | ); | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | sub start_link { | ||||||||||||||||||||||||||||
| 391 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_link: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 392 | 0 | my %p = $validator->(@_); | |||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | 0 | delete @p{ grep { !defined $p{$_} } keys %p }; | |||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | $self->_stream_start_tag( | ||||||||||||||||||||||||||||
| 397 | 'a', { | ||||||||||||||||||||||||||||
| 398 | href => $p{uri}, | ||||||||||||||||||||||||||||
| 399 | 0 | ▶ | exists $p{title} ? ( title => $p{title} ) : (), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 400 | }, | ||||||||||||||||||||||||||||
| 401 | ); | ||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | 34 | sub end_link { | |||||||||||||||||||||||||||
| 406 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_link: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | 0 | $self->_stream_end_tag('a'); | |||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | sub line_break { | ||||||||||||||||||||||||||||
| 412 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
line_break: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | 0 | $self->_stream_start_tag('br'); | |||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | { | ||||||||||||||||||||||||||||
| 418 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 419 | params => [ | ||||||||||||||||||||||||||||
| 420 | text => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 421 | ], | ||||||||||||||||||||||||||||
| 422 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 423 | ); | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | sub text { | ||||||||||||||||||||||||||||
| 426 | 29 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 427 | 29 | my ($text) = $validator->(@_); | |||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | 29 | $self->_stream_text($text); | |||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | { | ||||||||||||||||||||||||||||
| 434 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 435 | params => [ | ||||||||||||||||||||||||||||
| 436 | tag => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 437 | attributes => { type => t('HashRef') }, | ||||||||||||||||||||||||||||
| 438 | ], | ||||||||||||||||||||||||||||
| 439 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 440 | ); | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | sub start_html_tag { | ||||||||||||||||||||||||||||
| 443 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_html_tag: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 444 | 1 | my ( $tag, $attributes ) = $validator->(@_); | |||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | 1 | $self->_stream_start_tag( $tag, $attributes ); | |||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | { | ||||||||||||||||||||||||||||
| 451 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 452 | params => [ | ||||||||||||||||||||||||||||
| 453 | text => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 454 | ], | ||||||||||||||||||||||||||||
| 455 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 456 | ); | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | sub html_comment_block { | ||||||||||||||||||||||||||||
| 459 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
html_comment_block: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 460 | 0 | my ($text) = $validator->(@_); | |||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | 0 | $self->_stream_raw( '<!--' . $text . '-->' . "\n" ); | |||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | { | ||||||||||||||||||||||||||||
| 467 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 468 | params => [ | ||||||||||||||||||||||||||||
| 469 | text => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 470 | ], | ||||||||||||||||||||||||||||
| 471 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 472 | ); | ||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||
| 474 | sub html_comment { | ||||||||||||||||||||||||||||
| 475 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
html_comment: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 476 | 0 | my ($text) = $validator->(@_); | |||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | 0 | $self->_stream_raw( '<!--' . $text . '-->' ); | |||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | { | ||||||||||||||||||||||||||||
| 483 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 484 | params => [ | ||||||||||||||||||||||||||||
| 485 | tag => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 486 | attributes => { type => t('HashRef') }, | ||||||||||||||||||||||||||||
| 487 | ], | ||||||||||||||||||||||||||||
| 488 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 489 | ); | ||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | sub html_tag { | ||||||||||||||||||||||||||||
| 492 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
html_tag: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 493 | 0 | my ( $tag, $attributes ) = $validator->(@_); | |||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | 0 | $self->_stream_start_tag( $tag, $attributes ); | |||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | { | ||||||||||||||||||||||||||||
| 500 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 501 | params => [ | ||||||||||||||||||||||||||||
| 502 | tag => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 503 | ], | ||||||||||||||||||||||||||||
| 504 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 505 | ); | ||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | sub end_html_tag { | ||||||||||||||||||||||||||||
| 508 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
end_html_tag: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 509 | 1 | my ($tag) = $validator->(@_); | |||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||
| 511 | 1 | $self->_stream_end_tag($tag); | |||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | { | ||||||||||||||||||||||||||||
| 516 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 517 | params => [ | ||||||||||||||||||||||||||||
| 518 | entity => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 519 | ], | ||||||||||||||||||||||||||||
| 520 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 521 | ); | ||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||
| 523 | sub html_entity { | ||||||||||||||||||||||||||||
| 524 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
html_entity: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 525 | 0 | my ($entity) = $validator->(@_); | |||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||
| 527 | 0 | $self->_stream_raw( '&' . $entity . ';' ); | |||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||
| 531 | { | ||||||||||||||||||||||||||||
| 532 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 533 | params => [ | ||||||||||||||||||||||||||||
| 534 | html => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 535 | ], | ||||||||||||||||||||||||||||
| 536 | named_to_list => 1, | ||||||||||||||||||||||||||||
| 537 | ); | ||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||
| 539 | sub html_block { | ||||||||||||||||||||||||||||
| 540 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
html_block: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 541 | 0 | my ($html) = $validator->(@_); | |||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | 0 | $self->_output->print($html); | |||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||
| 547 | { | ||||||||||||||||||||||||||||
| 548 | 34 | my $validator = validation_for( | |||||||||||||||||||||||||||
| 549 | params => { | ||||||||||||||||||||||||||||
| 550 | alt_text => { type => t('Str') }, | ||||||||||||||||||||||||||||
| 551 | uri => { | ||||||||||||||||||||||||||||
| 552 | type => t('Str'), | ||||||||||||||||||||||||||||
| 553 | optional => 1, | ||||||||||||||||||||||||||||
| 554 | }, | ||||||||||||||||||||||||||||
| 555 | title => { | ||||||||||||||||||||||||||||
| 556 | type => t('Str'), | ||||||||||||||||||||||||||||
| 557 | optional => 1, | ||||||||||||||||||||||||||||
| 558 | }, | ||||||||||||||||||||||||||||
| 559 | id => { | ||||||||||||||||||||||||||||
| 560 | type => t('Str'), | ||||||||||||||||||||||||||||
| 561 | optional => 1, | ||||||||||||||||||||||||||||
| 562 | }, | ||||||||||||||||||||||||||||
| 563 | is_implicit_id => { | ||||||||||||||||||||||||||||
| 564 | type => t('Bool'), | ||||||||||||||||||||||||||||
| 565 | optional => 1, | ||||||||||||||||||||||||||||
| 566 | }, | ||||||||||||||||||||||||||||
| 567 | }, | ||||||||||||||||||||||||||||
| 568 | ); | ||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||
| 570 | sub image { | ||||||||||||||||||||||||||||
| 571 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
image: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 572 | 0 | my %p = $validator->(@_); | |||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||
| 574 | 0 | delete @p{ grep { !defined $p{$_} } keys %p }; | |||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||
| 576 | $self->_stream_start_tag( | ||||||||||||||||||||||||||||
| 577 | 'img', { | ||||||||||||||||||||||||||||
| 578 | src => $p{uri}, | ||||||||||||||||||||||||||||
| 579 | ( exists $p{alt_text} ? ( alt => $p{alt_text} ) : () ), | ||||||||||||||||||||||||||||
| 580 | 0 | ▶ | ( exists $p{title} ? ( title => $p{title} ) : () ), | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 581 | }, | ||||||||||||||||||||||||||||
| 582 | ); | ||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | 34 | sub horizontal_rule { | |||||||||||||||||||||||||||
| 587 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
horizontal_rule: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||
| 589 | 0 | $self->_stream_start_tag('hr'); | |||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||
| 592 | sub _stream_start_tag { | ||||||||||||||||||||||||||||
| 593 | 32 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_stream_start_tag: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 594 | 32 | my $tag = shift; | |||||||||||||||||||||||||||
| 595 | 32 | my $attr = shift; | |||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||
| 597 | $self->_output->print( | ||||||||||||||||||||||||||||
| 598 | '<' | ||||||||||||||||||||||||||||
| 599 | . $tag | ||||||||||||||||||||||||||||
| 600 | . ( | ||||||||||||||||||||||||||||
| 601 | 32 | ▶ | keys %{$attr} | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 602 | ? q{ } . $self->_attributes($attr) | ||||||||||||||||||||||||||||
| 603 | : q{} | ||||||||||||||||||||||||||||
| 604 | ) | ||||||||||||||||||||||||||||
| 605 | . '>' | ||||||||||||||||||||||||||||
| 606 | ); | ||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||
| 609 | sub _stream_end_tag { | ||||||||||||||||||||||||||||
| 610 | 30 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_stream_end_tag: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 611 | 30 | my $tag = shift; | |||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||
| 613 | 30 | $self->_output->print( '</' . $tag . '>' ); | |||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||
| 616 | sub _stream_text { | ||||||||||||||||||||||||||||
| 617 | 30 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_stream_text: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||
| 619 | 30 | $self->_output->print( | |||||||||||||||||||||||||||
| 620 | encode_entities( | ||||||||||||||||||||||||||||
| 621 | shift, | ||||||||||||||||||||||||||||
| 622 | $self->_encodable_entities, | ||||||||||||||||||||||||||||
| 623 | ) | ||||||||||||||||||||||||||||
| 624 | ); | ||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||
| 627 | sub _stream_raw { | ||||||||||||||||||||||||||||
| 628 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_stream_raw: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||
| 630 | 1 | $self->_output->print(shift); | |||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||
| 633 | sub _attributes { | ||||||||||||||||||||||||||||
| 634 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_attributes: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 635 | 1 | my $attr = shift; | |||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||
| 637 | return join q{ }, | ||||||||||||||||||||||||||||
| 638 | 2 | map { $self->_attribute( $_, $attr->{$_} ) } | |||||||||||||||||||||||||||
| 639 | 1 | sort { $a cmp $b } keys %{$attr}; | |||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||
| 642 | sub _attribute { | ||||||||||||||||||||||||||||
| 643 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_attribute: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 644 | 2 | my $key = shift; | |||||||||||||||||||||||||||
| 645 | 2 | my $value = shift; | |||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||
| 647 | 2 | ▶ | return $key unless defined $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||
| 649 | 2 | return join '=', $key, | |||||||||||||||||||||||||||
| 650 | q{"} . encode_entities( | ||||||||||||||||||||||||||||
| 651 | $value, | ||||||||||||||||||||||||||||
| 652 | $self->_encodable_entities, | ||||||||||||||||||||||||||||
| 653 | ) . q{"}; | ||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||
| 656 | 34 | 1; | |||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||
| 658 | # ABSTRACT: A role for handlers which generate HTML | ||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||
| 660 | __END__ | ||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||
| 662 | =pod | ||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||
| 664 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||
| 666 | =head1 NAME | ||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||
| 668 | Markdent::Role::HTMLStream - A role for handlers which generate HTML | ||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||
| 670 | =head1 VERSION | ||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||
| 672 | version 0.39 | ||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||
| 674 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||
| 676 | This role implements most of the code needed for event receivers which | ||||||||||||||||||||||||||||
| 677 | generate a stream of HTML output based on those events. | ||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||
| 679 | =head1 REQUIRED METHODS | ||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||
| 681 | This role requires that consuming classes implement two methods, C<< | ||||||||||||||||||||||||||||
| 682 | $handler->start_document >> and C<< $handler->end_document >>. | ||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||
| 684 | =head1 ROLES | ||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||
| 686 | This role does the L<Markdent::Role::EventsAsMethods> and | ||||||||||||||||||||||||||||
| 687 | L<Markdent::Role::Handler> roles. | ||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||
| 689 | =head1 BUGS | ||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||
| 691 | See L<Markdent> for bug reporting details. | ||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||
| 693 | Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>. | ||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||
| 695 | I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. | ||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||
| 697 | =head1 SOURCE | ||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||
| 699 | The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>. | ||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||
| 701 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||
| 703 | Dave Rolsky <autarch@urth.org> | ||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||
| 705 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||
| 707 | This software is copyright (c) 2021 by Dave Rolsky. | ||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||
| 709 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 710 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||
| 712 | The full text of the license can be found in the | ||||||||||||||||||||||||||||
| 713 | F<LICENSE> file included with this distribution. | ||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||
| 715 | =cut | ||||||||||||||||||||||||||||