Markup/Textile.pm

filter: Statementstmt 100% 31 / 31 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 95.6% 44 / 46 CC 4 SCAR 5.5
CC
4
Cov
97%
parser
3.0
import
2.0
BEGIN
1.0
CRAP 1.7
« Markup/Multimarkdown.pm ↑ Summary Markup/Trac.pm »
1 package Text::Markup::Textile;
2  
3 1 ▶use 5.8.1;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Text::Markup;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use File::BOM qw(open_bom);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Text::Textile 2.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $VERSION = '0.43';
11  
12 3 ▶sub import {
Subroutine import: called CC=2 SCAR=6.9
13 # Replace the regex if passed one.
14 3 ▶ Text::Markup->register( textile => $_[1] ) if $_[1];
Branch: 1 branch
BranchTrueFalseTotal
if $_[1] 2 1 3
15 }
16  
17 2 ▶sub parser {
Subroutine parser: called CC=3 SCAR=11.0
Pod undocumented
18 2 my ($file, $encoding, $opts) = @_;
19 2 my %params = @{ $opts };
20 2 my $textile = Text::Textile->new(
21 charset => 'utf-8',
22 char_encoding => 0,
23 trim_spaces => 1,
24 %params,
25 );
26 2 open_bom my $fh, $file, ":encoding($encoding)";
27 2 local $/;
28 2 my $html = $textile->process(<$fh>);
29 2 ▶ return unless $html =~ /\S/;
Branch: 1 branch
BranchTrueFalseTotal
unless $html =~ /\S/ 1 1 2
30 1 utf8::encode($html);
31 1 ▶ return $html if $params{raw};
Branch: 1 branch
BranchTrueFalseTotal
if $params{"raw"} 0 1 1
32 1 return qq{<html>
33 <head>
34 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
35 </head>
36 <body>
37 $html
38 </body>
39 </html>
40 };
41  
42 }
43  
44 1 1;
45 __END__
« Markup/Multimarkdown.pm ↑ Summary Markup/Trac.pm »