Luya Tshimbalanga wrote:
Matthias Clasen wrote:
I've used Charlies script and included svgs in yesterdays echo snapshot.
Please give it a try.
_______________________________________________
Fedora-art-list mailing list
Fedora-art-list@xxxxxxxxxx
http://www.redhat.com/mailman/listinfo/fedora-art-list
It work well. I wish the script allows the ability to directly save the
modification instead of the copy and paste. Idon't know much about perl
though.
I've included the updated version that does this. I generally use pipes
and a bash line script which makes copies (because there are often
accidents overwriting originals).
You could do something like this:
mkdir done;
for SVG in *.svg; do cat "$SVG" | trim_svg.pl > "done/$SVG" ; done;
But the new version will accept command line filename arguments which
will be overwritten.
e.g.
trim_svg.pl *.svg
#!/usr/bin/perl
use XML::Twig;
if (!@ARGV) {
@ARGV = "-";
}
foreach (@ARGV) {
my $twig=XML::Twig->new(twig_handlers => {
'i:pgf' => sub {
if ($_->{'att'}->{'id'} eq 'adobe_illustrator_pgf'){
$_->delete;
}
},
'i:pgfRef' => sub {
$_->delete;
},
'x:xmpmeta' => sub {
$_->delete;
},
}
); # create the twig
$twig->parsefile($_); # build it
open OUTFILE, "> $_" or die "Can't open $_ : $!";
$twig->flush (\*OUTFILE); # output the twig
close OUTFILE;
}
_______________________________________________
Fedora-art-list mailing list
Fedora-art-list@xxxxxxxxxx
http://www.redhat.com/mailman/listinfo/fedora-art-list