line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Slugify; |
2
|
2
|
|
|
2
|
|
775
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
2
|
|
|
2
|
|
|
2
|
|
47
|
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
34
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
58
|
|
3
|
2
|
|
|
2
|
|
6
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{'slugify'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#@Override |
8
|
|
|
|
|
|
|
#@todo this should translit locales symbols |
9
|
|
|
|
|
|
|
sub filter |
10
|
|
|
|
|
|
|
{ |
11
|
5
|
|
|
5
|
0
|
4
|
shift; # self |
12
|
5
|
|
|
|
|
2
|
shift; # filter manager |
13
|
5
|
|
|
|
|
5
|
my $value = shift; # value |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
|
|
31
|
$value =~ s/[^\w]+/-/gs; |
16
|
5
|
|
|
|
|
30
|
$value =~ s/(^\-+|\-+$)//gs; |
17
|
|
|
|
|
|
|
|
18
|
5
|
|
|
|
|
17
|
return lc($value); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |