File Coverage

blib/lib/Kwiki/Image.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package Kwiki::Image;
2 1     1   30415 use strict;
  1         2  
  1         46  
3 1     1   6 use warnings;
  1         2  
  1         35  
4 1     1   572 use Kwiki::Plugin '-Base';
  0            
  0            
5              
6             our $VERSION = 0.01;
7              
8             const class_title => 'Image';
9             const class_id => 'image';
10              
11             sub register {
12             my $registry = shift;
13             $registry->add(wafl => image => 'Kwiki::Image::Wafl');
14             }
15              
16             package Kwiki::Image::Wafl;
17             use Spoon::Formatter;
18              
19             use base 'Spoon::Formatter::WaflPhrase';
20              
21             sub html {
22             my $string = $self->arguments;
23             my ($src,$url,$alt,$class) = split /\s/, $string;
24             my $altString = $alt || 'image';
25             my $classString = '';
26             if ($class) {
27             $classString = " class=\"$class\"";
28             }
29             my $html = "\"$altString\"$classString";
30             if ($url) {
31             $html = '' . $html . '';
32             }
33             return $html;
34             }
35              
36             1;