lib/Kwiki/DisableWikiNames.pm

filter: Statementstmt 81.8% 9 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 86.6% 13 / 15 CC 1 SCAR 0.7
CC
1
Cov
82%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 package Kwiki::DisableWikiNames;
2  
3 1 ▶use 5.008005;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 0 ▶use Kwiki::Plugin -Base;
Subroutine BEGIN: called CC=1 SCAR=2.6
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(<a href="$page_uri"$class>$label</a>);
35 }
36 }
37  
38 1;
39 __END__
↑ Summary