File Coverage

blib/lib/Text/Markup/Creole.pm
Criterion Covered Total %
statement 27 27 100.0
branch 5 6 83.3
condition n/a
subroutine 8 8 100.0
pod 0 1 0.0
total 40 42 95.2


line stmt bran cond sub pod time code
1             package Text::Markup::Creole;
2              
3 1     1   15176 use 5.8.1;
  1         4  
4 1     1   7 use strict;
  1         2  
  1         30  
5 1     1   5 use warnings;
  1         2  
  1         53  
6 1     1   5 use Text::Markup;
  1         2  
  1         31  
7 1     1   5 use File::BOM qw(open_bom);
  1         1  
  1         78  
8 1     1   7 use Text::WikiCreole;
  1         3  
  1         422  
9              
10             our $VERSION = '0.41';
11              
12             sub import {
13             # Replace the regex if passed one.
14 3 100   3   76 Text::Markup->register( creole => $_[1] ) if $_[1];
15             }
16              
17             sub parser {
18 2     2 0 48 my ($file, $encoding, $opts) = @_;
19 2         14 open_bom my $fh, $file, ":encoding($encoding)";
20 2         706 local $/;
21 2         63 my $html = creole_parse(<$fh>);
22 2 100       16146 return unless $html =~ /\S/;
23 1         6 utf8::encode($html);
24 1 50       2 return $html if { @{ $opts } }->{raw};
  1         6  
25 1         38 return qq{
26            
27            
28            
29            
30             $html
31            
32            
33             };
34              
35             }
36              
37             1;
38             __END__