line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Code::TidyAll::Plugin::SVG; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
9576
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
51
|
|
4
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
52
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1942
|
use XML::Twig; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use String::Escape qw(escape); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Moo; |
10
|
|
|
|
|
|
|
use namespace::clean; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
extends 'Code::TidyAll::Plugin'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JONASS'; |
15
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'indent' => ( is => 'ro', default => sub {"\t"} ); |
18
|
|
|
|
|
|
|
has 'style' => ( is => 'ro', default => sub {'cvs'} ); |
19
|
|
|
|
|
|
|
has 'comments' => ( is => 'ro', default => sub {'keep'} ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub transform_file |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
my $self = shift; |
24
|
|
|
|
|
|
|
my $file = shift; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $svg = XML::Twig->new( |
27
|
|
|
|
|
|
|
keep_encoding => 1, |
28
|
|
|
|
|
|
|
pretty_print => $self->style, |
29
|
|
|
|
|
|
|
comments => $self->comments, |
30
|
|
|
|
|
|
|
twig_handlers => { |
31
|
|
|
|
|
|
|
_all_ => sub { $_[0]->flush; }, |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$svg->set_indent( |
36
|
|
|
|
|
|
|
escape( 'unqqbackslash unsinglequote', $self->indent ) ); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$svg->parsefile_inplace($file); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |