File Coverage

lib/Kwiki/DisableWikiNames.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package Kwiki::DisableWikiNames;
2              
3 1     1   21392 use 5.008005;
  1         3  
  1         38  
4 1     1   5 use strict;
  1         3  
  1         27  
5 1     1   11 use warnings;
  1         13  
  1         35  
6              
7 1     1   1270 use Kwiki::Plugin -Base;
  0            
  0            
8             use mixin 'Kwiki::Installer';
9              
10             our $VERSION = '0.02';
11              
12             const class_id => 'disable_wiki_names';
13             const class_title => "Disable WikiNames auto markup";
14              
15             sub init {
16             super;
17             }
18              
19             sub register {
20             my $registry = shift;
21             $registry->add(preload => 'disable_wiki_names');
22             $registry->add(hook => 'page:kwiki_link', pre => 'dwn_uri_hook');
23             }
24              
25             sub dwn_uri_hook { ## Adopted from Kwiki::CoolURI
26             my $hook = pop;
27             $hook->code(undef);
28             my ($label) = @_;
29             my $page_uri = $self->uri;
30             if(!defined $label) {
31             qq($page_uri);
32             } else {
33             my $class = $self->active? '' : ' class="empty"';
34             qq($label);
35             }
36             }
37              
38             1;
39             __END__