line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Slugify; |
2
|
2
|
|
|
2
|
|
1224
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
4
|
|
|
2
|
|
|
2
|
|
49
|
|
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
47
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
70
|
|
3
|
2
|
|
|
2
|
|
10
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12
|
|
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
|
7
|
shift; # self |
12
|
5
|
|
|
|
|
7
|
shift; # filter manager |
13
|
5
|
|
|
|
|
9
|
my $value = shift; # value |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
|
|
34
|
$value =~ s/[^\w]+/-/gs; |
16
|
5
|
|
|
|
|
42
|
$value =~ s/(^\-+|\-+$)//gs; |
17
|
|
|
|
|
|
|
|
18
|
5
|
|
|
|
|
20
|
return lc($value); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |