line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::Maketext::Utils::Phrase::Norm::Markup; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1865
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
91
|
|
4
|
4
|
|
|
4
|
|
12
|
use warnings; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
559
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub normalize_maketext_string { |
7
|
78
|
|
|
78
|
0
|
63
|
my ($filter) = @_; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# & is handled more in depth in it's own module |
10
|
78
|
100
|
|
|
|
133
|
if ( $filter->get_orig_str() =~ m/[<>"']/ ) { |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# normalize <>"' to [output,ENT] |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# this filter could be smarter like ampersand’s 'Prefer [output,amp] over …' and 'Prefer chr(38) over …' |
15
|
|
|
|
|
|
|
|
16
|
14
|
|
|
|
|
24
|
my $string_sr = $filter->get_string_sr(); |
17
|
|
|
|
|
|
|
|
18
|
14
|
100
|
|
|
|
14
|
if ( ${$string_sr} =~ s/'/[output,apos]/g ) { |
|
14
|
|
|
|
|
48
|
|
19
|
10
|
|
|
|
|
21
|
$filter->add_warning('consider if, instead of using a straight apostrophe, using ‘’ for single quoting and ’ for an apostrophe is the right thing here (i.e. instead of bracket notation)'); |
20
|
|
|
|
|
|
|
} |
21
|
14
|
50
|
|
|
|
12
|
if ( ${$string_sr} =~ s/"/[output,quot]/g ) { |
|
14
|
|
|
|
|
49
|
|
22
|
14
|
|
|
|
|
28
|
$filter->add_warning('consider if, instead of using straight double quotes, using “” is the right thing here (i.e. instead of bracket notation)'); |
23
|
|
|
|
|
|
|
} |
24
|
14
|
|
|
|
|
15
|
${$string_sr} =~ s/>/[output,gt]/g; |
|
14
|
|
|
|
|
23
|
|
25
|
14
|
|
|
|
|
11
|
${$string_sr} =~ s/[output,lt]/g; |
|
14
|
|
|
|
|
32
|
|
26
|
|
|
|
|
|
|
|
27
|
14
|
|
|
|
|
60
|
$filter->add_violation('Contains markup related characters'); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
78
|
|
|
|
|
141
|
return $filter->return_value; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |