Our copy of library/wikimedia/chess-_c-commoner.svg from
https://upload.wikimedia.org/wikipedia/commons/7/7d/Commoner_Transparent.svg
generates this error from inkscape's color_replace extension:
$ /usr/share/inkscape/extensions/color_replace.py -f 'ffffff' -t 'abcbfb' library/wikimedia/chess-_c-commoner.svg >library/wikimedia/chess-b-commoner.coloured.svg.0.tmp
Traceback (most recent call last):
File "/usr/share/inkscape/extensions/color_replace.py", line 25, in <module>
c.affect()
File "/usr/share/inkscape/extensions/inkex.py", line 283, in affect
self.effect()
File "/usr/share/inkscape/extensions/coloreffect.py", line 37, in effect
self.getAttribs(self.document.getroot())
File "/usr/share/inkscape/extensions/coloreffect.py", line 45, in getAttribs
self.getAttribs(child)
File "/usr/share/inkscape/extensions/coloreffect.py", line 45, in getAttribs
self.getAttribs(child)
File "/usr/share/inkscape/extensions/coloreffect.py", line 45, in getAttribs
self.getAttribs(child)
File "/usr/share/inkscape/extensions/coloreffect.py", line 45, in getAttribs
self.getAttribs(child)
File "/usr/share/inkscape/extensions/coloreffect.py", line 43, in getAttribs
self.changeStyle(node)
File "/usr/share/inkscape/extensions/coloreffect.py", line 55, in changeStyle
if node.attrib.has_key('style'):
AttributeError: '_ImmutableMapping' object has no attribute 'has_key'
$
This is reproducible by hand via the inkscape GUI.
Emprically, running the file through usvg first fixes it. *shrug*
We need to do this before we can start relying on the recolouring
support.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
my $coloured = $lupstream;
my $ci = 0;
- my $cfp = '$<';
+ my $cfp;
my $emitmap = sub {
my ($from, $to) = @_;
confess if $from =~ m/\W/ || $to =~ m/\W/;
- my $nfp = "\$@.$ci.tmp";
$coloured = $ncoloured;
- print $makefile <<END or die $! if $ci == 0;
+ if (!defined $cfp) {
+ $cfp ="\$@.$ci.tmp";
+ print $makefile <<END or die $!;
LIBRARY_CLEAN += $ncoloured
$ncoloured: $lupstream Makefile $makepath
+ \$(USVG_CMD) -c - <\$< >$cfp
END
+ }
$ci++;
+ my $nfp = "\$@.$ci.tmp";
print $makefile <<END or die $!;
\$(RECOLOUR_SVG) -f '$from' -t '$to' $cfp >$nfp
END