File Coverage

blib/lib/Text/Markup/Multimarkdown.pm
Criterion Covered Total %
statement 29 29 100.0
branch 5 6 83.3
condition n/a
subroutine 8 8 100.0
pod 0 1 0.0
total 42 44 95.4


line stmt bran cond sub pod time code
1             package Text::Markup::Multimarkdown;
2              
3 1     1   34613 use 5.8.1;
  1         3  
4 1     1   4 use strict;
  1         1  
  1         15  
5 1     1   3 use warnings;
  1         1  
  1         35  
6 1     1   3 use Text::Markup;
  1         1  
  1         17  
7 1     1   3 use File::BOM qw(open_bom);
  1         2  
  1         38  
8 1     1   3 use Text::MultiMarkdown ();
  1         2  
  1         223  
9              
10             our $VERSION = '0.41';
11              
12             sub import {
13             # Replace the regex if passed one.
14 3 100   3   29 Text::Markup->register( multimarkdown => $_[1] ) if $_[1];
15             }
16              
17             sub parser {
18 2     2 0 5 my ($file, $encoding, $opts) = @_;
19 2         3 my %params = @{ $opts };
  2         4  
20 2         12 my $md = Text::MultiMarkdown->new(%params);
21 2         77 open_bom my $fh, $file, ":encoding($encoding)";
22 2         426 local $/;
23 2         37 my $html = $md->markdown(<$fh>);
24 2 100       6758 return unless $html =~ /\S/;
25 1         3 utf8::encode($html);
26 1 50       2 return $html if $params{raw};
27 1         35 return qq{
28            
29            
30            
31            
32             $html
33            
34            
35             };
36              
37             }
38              
39             1;
40             __END__