Replace single style attribute with individual attributes?

Bug #168406 reported by singlecell
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Wishlist
Unassigned

Bug Description

I'm using Inkscape to create interactive SVG drawings that allow the viewer
colour in the picture, painting by numbers style.

The script needs to access the fill colour of each element, but Inkscape
uses the style attribute on each element to set the fill colour. The style
attribute is seen as a single text string to the script and I have to
manually go through each element changing them for my script code to work.
Manipulating the style attribute in code would require parsing to
preservation all the other style definitions.

Inscape saves using style attribute:
      <rect
         inkscape:label="#rect2160"
         y="365.26935"
         x="629.66992"
         height="74.285713"
         width="63.303665"
         id="paintBlack"

style="fill-opacity:1;fill:#000000;stroke:#000000;stroke-width:5.69999933;s
troke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashar
ray:none;stroke-dashoffset:0;stroke-opacity:1"
         onclick="setColour(evt)" />

but I have to convert to the following to access the fill colour from
script:
      <rect
         inkscape:label="#rect2160"
         y="365.26935"
         x="629.66992"
         height="74.285713"
         width="63.303665"
         id="paintBlack"

style="fill-opacity:1;stroke:#000000;stroke-width:5.69999933;stroke-linecap
:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stro
ke-dashoffset:0;stroke-opacity:1"
         fill="#000000"
         onclick="setColour(evt)" />

Can there be a way to force Inkscape to save style attributes of drawing
elements as separate attributes, either be an option during save, or as an
internally permanent solution (ie: drop use of single style attribute)?

Tags: saving styles svg
Revision history for this message
Bryce Harrington (bryce) wrote :

This is not something we can do easily at this time, due to the way our style code is implemented, however it's a good idea. Marking it as wishlist.

Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
summary: - Replace single style attribute with individual attrubutes?
+ Replace single style attribute with individual attributes?
su_v (suv-lp)
tags: added: styles svg
Revision history for this message
su_v (suv-lp) wrote :

Same request filed earlier (2006-09-11):
Bug #171503 “presentation attributes”

Note:
The Optimized SVG export format, based on Scour and added in version 0.47, has an option that allows to convert styles into XML attributes.
<http://tavmjong.free.fr/INKSCAPE/MANUAL/html/File-Export.html#File-Export-SVG>
<http://www.codedread.com/scour/#options>

Revision history for this message
Jonathan Hofinger (jhofinger) wrote :

Closing as part of Inkscape's bug migration, since this was implemented by using Scour for SVG cleaning a loong time ago.

Closed by: https://gitlab.com/jhofinger

Changed in inkscape:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.