Markdent/Simple/Document.pm

filter: Statementstmt 100% 39 / 39 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 96.3% 52 / 54 CC 3 SCAR 3.9
CC
3
Cov
95%
markdown_to_html
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Markdent/Handler/HTMLStream/Document.pm ↑ Summary Markdent/CheckedOutput.pm »
1 package Markdent::Simple::Document;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '0.41';
8  
9 1 ▶use Markdent::Handler::HTMLStream::Document;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Markdent::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Params::ValidationCompiler qw( validation_for );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Specio::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 with 'Markdent::Role::Simple';
18  
19 {
20 my $validator = validation_for(
21 params => [
22 dialects => {
23 type => union(
24 of => [
25 t('Str'),
26 t( 'ArrayRef', of => t('Str') )
27 ]
28 ),
29 1 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
30 },
31 1 title => { type => t('Str') },
32 charset => {
33 type => t('Str'),
34 optional => 1,
35 },
36 language => {
37 type => t('Str'),
38 optional => 1,
39 },
40 markdown => { type => t('Str') },
41 ],
42 named_to_list => 1,
43 );
44  
45 1 ▶ sub markdown_to_html {
Subroutine markdown_to_html: called CC=3 SCAR=11.3
46 1 my $self = shift;
47 1 my ( $dialects, $title, $charset, $language, $markdown )
48 = $validator->(@_);
49  
50 1 my $handler_class = 'Markdent::Handler::HTMLStream::Document';
51 1 ▶ my %handler_p = (
Branch: 2 branches
BranchTrueFalseTotal
$charset ? : 0 1 1
$language ? : 0 1 1
52 title => $title,
53 ( $charset ? ( charset => $charset ) : () ),
54 ( $language ? ( language => $language ) : () ),
55 );
56  
57 1 return $self->_parse_markdown(
58 $markdown,
59 $dialects,
60 $handler_class,
61 \%handler_p
62 );
63 }
64 }
65  
66 1 __PACKAGE__->meta->make_immutable;
67  
68 1 1;
69  
70 # ABSTRACT: Convert Markdown to an HTML Document
71  
72 __END__
« Markdent/Handler/HTMLStream/Document.pm ↑ Summary Markdent/CheckedOutput.pm »