On 29/11/11 17:00, Tavmjong Bah wrote:
On Tue, 2011-11-29 at 15:59 +0100, ~suv wrote:
On 29/11/11 12:38, Tavmjong Bah wrote:
I have just checked into trunk some of the fruits of Abhishek's GSOC project to improve Inkscape's SVG output. Abhishek wrote the core routines to which I added a variety of utility functions. This code can result in cleaner and smaller SVG. It does the following things:
For a given element (<rect>, <path>, etc.) it checks:
That all attributes are valid.[1]
That properties are appropriate.[2]
That properties are useful.[3]
Testing r10753 on Mac OS X 10.5.8 (i386) (not packaged as osxapp) built with Apple's GCC 4.2.1 deps: Glib 2.28.8, Gtk+ 2.24.4, Perl v5.12.3
This part:
What Inkscape does when it finds a problem is controlled by settings under the "SVG output" section of the Inkscape Preferences dialog. For each of the above cases, you can independently:
- Print out warnings to the console (if running Inkscape from the
command line).
- Delete the invalid or not useful items.
doesn't work independently for me: if I check to print warnings e.g. for not useful properties on writing, attributes in filter definitions considered as invalid are removed nevertheless [1]. Same when checking for not useful properties on reading: the 'invalid' attributes are unexpectedly removed from the filter definitions on load (e.g. when reverting the document after changing the preferences) [2].
Just checked in fixes. The Attributes appendix in the SVG spec left out "feMergeNode" from the list of elements using "in". The unrequested deletion was a bug. The same bug probably also caused the problem with "Save a copy as..."
Thanks for the quick update - r10754 no longer deletes when printing warnings e.g. for not useful properties, and also considers "in" a valid attribute of feMergeNode.
[2] unrelated to the changes in r10753, but annoying when testing: even when using 'Save a copy as...' 'Inkscape SVG' to keep the original file unchanged in the current document window, the content of the current document window appears to be replaced with the content of the saved copy (with e.g. "broken" custom filter effects).
The issue with 'Save a Copy as...' persists [1]. When saving a copy as 'Inkscape SVG' with 'remove invalid attributes' on 'writing', the content of the current window is modified too: e.g. using the test file attached earlier, the "in" attributes of the three feFlood filter primitives are gone when checking the filter definition in the XML editor (I'd expect that change to only occur in the saved copy). The otherwise unchanged document is not dirtied (no entry in the undo history either) and can be closed without prompting a close|cancel|save message.
~suv
[1] I had noticed a similar issue earlier this week when testing an issue reported on irc about the file format 'Plain SVG' removing a valid attribute of clip-paths and masks.
Download http://www.w3.org/Graphics/SVG/Test/20110816/svg/masking-path-02-b.svg from the test suite, open it in Inkscape trunk (default prefs) and save a copy as 'Plain SVG'. Now open the original file and the just created 'Plain SVG' version in new windows and compare the content of all three windows: 'clipPathUnits="objectBoundingBox"' is removed unexpectedly when saving as 'Plain SVG'. The content in the first window after saving a copy as 'Plain SVG' still has that attribute (checked in the XML editor), but looks otherwise different.
Saving a copy as 'Inkscape SVG' does not remove the attribute nor visibly change the content of the current window in this case.
(the same happens for 'maskContentUnits="objectBoundingBox"', which was the original question asked on irc about 'Plain SVG')