File Coverage

lib/Templer/Plugin/HTML.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition 1 3 33.3
subroutine 5 5 100.0
pod 3 3 100.0
total 23 25 92.0


line stmt bran cond sub pod time code
1              
2             =head1 NAME
3            
4             Templer::Plugin::HTML - A simple (nop) HTML-formatting plugin
5            
6             =cut
7              
8             =head1 DESCRIPTION
9            
10             This class implements a formatter plugin for C<templer> which allows
11             pages to be written using HTML.
12            
13             It is provided as NOP.
14            
15             This allows input such as this to be executed:
16            
17             =for example begin
18            
19             Title: This is my page
20             format: html
21             ----
22             <p>This is my page text</p>
23            
24             =for example end
25            
26             =cut
27              
28             =head1 LICENSE
29            
30             This module is free software; you can redistribute it and/or modify it
31             under the terms of either:
32            
33             a) the GNU General Public License as published by the Free Software
34             Foundation; either version 2, or (at your option) any later version,
35             or
36            
37             b) the Perl "Artistic License".
38            
39             =cut
40              
41             =head1 AUTHOR
42            
43             Steve Kemp <steve@steve.org.uk>
44            
45             =cut
46              
47             =head1 COPYRIGHT AND LICENSE
48            
49             Copyright (C) 2012-2015 Steve Kemp <steve@steve.org.uk>.
50            
51             This library is free software. You can modify and or distribute it under
52             the same terms as Perl itself.
53            
54             =cut
55              
56             =head1 METHODS
57            
58             =cut
59              
60              
61 11     11   6513 use strict;
  11         11  
  11         247  
62 11     11   48 use warnings;
  11         12  
  11         1103  
63              
64              
65             package Templer::Plugin::HTML;
66              
67              
68             =head2 new
69            
70             Constructor. No arguments are supported/expected.
71            
72             =cut
73              
74             sub new
75             {
76 5     5 1 5     my ( $proto, %supplied ) = (@_);
77 5   33     20     my $class = ref($proto) || $proto;
78              
79 5         7     my $self = {};
80 5         6     bless( $self, $class );
81 5         9     return $self;
82             }
83              
84              
85             =head2 available
86            
87             This plugin is always available.
88            
89             =cut
90              
91             sub available
92             {
93 1     1 1 5     return 1;
94             }
95              
96              
97             =head2 format
98            
99             Format the given text: In our case return it unmodified.
100            
101             =cut
102              
103             sub format
104             {
105 1     1 1 2     my ( $self, $str, $data ) = (@_);
106              
107 1         2     return ($str);
108             }
109              
110             Templer::Plugin::Factory->new()
111               ->register_formatter( "html", "Templer::Plugin::HTML" );
112