| 1 | package DTL::Fast::Filter::Slugify; | ||
| 2 | 2 | ▶ | use strict; use utf8; use warnings FATAL => 'all'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use parent 'DTL::Fast::Filter'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 2 | $DTL::Fast::FILTER_HANDLERS{'slugify'} = __PACKAGE__; | |
| 6 | |||
| 7 | #@Override | ||
| 8 | #@todo this should translit locales symbols | ||
| 9 | sub filter | ||
| 10 | { | ||
| 11 | 5 | ▶ | shift; # self |
|
Subroutine
filter: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 12 | 5 | shift; # filter manager | |
| 13 | 5 | my $value = shift; # value | |
| 14 | |||
| 15 | 5 | $value =~ s/[^\w]+/-/gs; | |
| 16 | 5 | $value =~ s/(^\-+|\-+$)//gs; | |
| 17 | |||
| 18 | 5 | return lc($value); | |
| 19 | } | ||
| 20 | |||
| 21 | 2 | 1; | |