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