Hi Martin
it sounds good, just 1 thing that came up when testing : the script doesn't check if style exist when launching. So this can result in duplicate style if you do it twice on a shape.
Personnally i think that doing 2 different actions : - get_style_from_shape - apply_style would help avoid this situation and give more flexibility.
cheers
----- Mail original ----- De: "Martin Owens" <doctormo@...400...> À: "Inkscape Developer Mailing List" <inkscape-devel@...1239....net> Envoyé: Lundi 17 Mars 2014 15:36:52 Objet: [Inkscape-devel] Extension: Merge Style
Hi devs,
I've committed in r13161 an extension which will take the inline styles from the selected elements, find the common values and create a new css style in the existing or new style element at the top of the document. This replaces the inline styles with a class reference.
<rect style="fill:red;"/> <rect style="fill:red;"/> <rect style="fill:yellow;"/> <rect style="fill:red;stroke:green;"/>
Becomes:
<style> .name_of_choice { fill:red; } </style> <rect class="foo"/> <rect class="foo"/> <rect style="fill:yellow;"/> <rect class="foo" style="stroke:green;"/>
I've added this into the extensions menu under Stylesheets > Merge Styles into CSS. And I decided to push it into trunk instead of just keeping it on my hard drive because it might be useful to other users.
But I'd also like to sound it out too. So any issues you think, I'd love to hear. This should make it easier to make web svg I think.
Best Regards, Martin Owens
------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel