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..."
Tav
~suv
[1] in this process modifying (custom) filter effects by removing the 'in' attribute for feMergeNode (declared as invalid), and thus changing files which had been saved as a copy (or loaded) to see the warnings only (for testing).
The printed warning when explicitly checking for invalid attributes:
WARNING **: <svg:feMergeNode id="feMergeNode3158">: Invalid attribute: "in" found.
[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).
Attached: test file with custom filter effect (WIP) in use for a custom Inkscape icons.svg file