File Coverage

blib/lib/Kwiki/Footnote.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package Kwiki::Footnote;
2              
3 1     1   33832 use strict;
  1         3  
  1         58  
4             our $VERSION = '0.01';
5 1     1   505 use Kwiki::Plugin '-Base';
  0            
  0            
6             use Kwiki::Installer '-Base';
7              
8             const class_id => 'footnote';
9             const class_title => 'Footnote Wafl';
10             const css_file => 'footnote.css';
11              
12             field footnotes => [];
13              
14             sub register {
15             my $registry = shift;
16             $registry->add(wafl => footnote => "Kwiki::Footnote::Footnote");
17             $registry->add(wafl => footnotelist => "Kwiki::Footnote::FootnoteList");
18             }
19              
20             package Kwiki::Footnote::Footnote;
21             use base 'Spoon::Formatter::WaflPhrase';
22              
23             sub html {
24             my $text = $self->arguments;
25             my $footnotes = $self->hub->footnote->footnotes;
26             push @$footnotes, $text;
27             my $num = @$footnotes;
28             return <
29             $num
30             EOF
31             }
32              
33             package Kwiki::Footnote::FootnoteList;
34             use base 'Spoon::Formatter::WaflPhrase';
35              
36             sub html {
37             my @footnotes = @{$self->hub->footnote->footnotes};
38             my $html = qq(
    \n);
39             for my $idx (0..$#footnotes) {
40             my $text = $footnotes[$idx];
41             my $num = $idx + 1;
42             $html .= <
43            
  • *$num: @{[$self->hub->formatter->text_to_html($text)]}
  • 44             EOF
    45             ;
    46             }
    47             $html .= "\n";
    48             return $html;
    49             }
    50              
    51             package Kwiki::Footnote;
    52             1;
    53             __DATA__