File Coverage

blib/lib/WikiText.pm
Criterion Covered Total %
statement 16 16 100.0
branch 1 2 50.0
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 21 24 87.5


line stmt bran cond sub pod time code
1 2     2   916 use strict; use warnings;
  2     2   4  
  2         68  
  2         11  
  2         3  
  2         496  
2             package WikiText;
3             our $VERSION = '0.19';
4              
5             sub new {
6 1     1 0 21 my $class = shift;
7 1         5 my $self = bless {}, $class;
8 1         8 $self->{wikitext} = shift;
9 1         11 return $self;
10             }
11              
12             sub to_html {
13 1     1 0 2 my $self = shift;
14 1         4 my $parser_class = ref($self) . '::Parser';
15 1 50       115 eval "require $parser_class; 1"
16             or die "Can't load $parser_class:\n$@";
17 1         605 require WikiText::HTML::Emitter;
18 1         17 my $parser = $parser_class->new(
19             receiver => WikiText::HTML::Emitter->new,
20             );
21              
22 1         11 return $parser->parse($self->{wikitext});
23             }
24              
25             1;