| 1 | package PAD::Plugin::Markdown; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use parent 'PAD::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use Text::Markdown 'markdown'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 0 | ▶ | sub suffix { qr/\.(?:markdown|mk?dn?)$/ } | ||||||||
|
Subroutine
suffix: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 8 | 0 | ▶ | sub content_type { 'text/html; charset=UTF-8' } | ||||||||
|
Subroutine
content_type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 9 | |||||||||||
| 10 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 11 | 0 | my $self = shift; | |||||||||
| 12 | 0 | my $path = $self->relative_path; | |||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | open my $text, '<', $path or die $!; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 0 | my $md = markdown(do { local $/; <$text> }); | |||||||||
| 16 | |||||||||||
| 17 | 0 | my $res = $self->request->new_response(200, ['Content-Type' => $self->content_type], $md); | |||||||||
| 18 | 0 | $res->finalize; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 2 | 1; | |||||||||
| 22 | __END__ | ||||||||||