Improving the diff-ability of inkscape
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
First of all: I am not exactly shure if this belongs into -user if it should be put into the dev mailing list please tell me to do so
Today I ran some experiments on collaborative work Inkscape. I put a file in a simple Hg-repository, created two branches, made some changes to each of them and afterwards tried to merge them back together. while doing so I ran into 3 Problems:
The first one can't be changed by Inkscape: when you add objects to the same layer in both branches you need to tell the diff tool to insert them after each others so no big deal The second one is that Inkscape saves the zoom and view position; while its a bit annoying and i don’t relay see the advantage of saving those its easy to resolve. The third one is the reason for this mail: the svg format was designed not to waste too much bandwidth for path definitions (http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation) so it was allowed to put skip some whitespaces, have relative and absolute formats and so on. While its not necessary to use it Inkscape actually uses some of those optimizations for size. That is where it gets problematic: No line based diff algorithm will ever be able to understand
d="M 94.560583,882.94114 202.33942,447.30755 149.72092,186.54185 C 322.59461,172.3981 497.26518,91.769646 666.84911,199.34693 l 44.50099,59.86379 6.19919,124.61 -138.89214,182.52301 - -292.02038,376.68278 z"
it would be way better if Inkscape would save all the commands in their own line with the correct command in front so you can put other lines in between without breaking everything:
d="M94.560583,882.94114 M202.33942,447.30755 M149.72092,186.54185 C322.59461,172.3981 C497.26518,91.769646 C666.84911,199.34693 l44.50099,59.86379 l6.19919,124.61 l-138.89214,182.52301 l-292.02038,376.68278 z"
would allow adding a point to the line by just adding a line without creating a huge diff. Additionally it would be good to never use relative coordinates (l) as changing one point would change two lines otherwise Please note that this suggestion is for the so-called Inkscape-SVG only (as that is the one people will use to work ), it should obviously be optimized as much as possible in the plain svg format.
- -- Yannik Völker
On 2013-05-08 15:42 +0100, Yannik Völker wrote:
First of all: I am not exactly shure if this belongs into -user if it should be put into the dev mailing list please tell me to do so
Today I ran some experiments on collaborative work Inkscape. I put a file in a simple Hg-repository, created two branches, made some changes to each of them and afterwards tried to merge them back together. while doing so I ran into 3 Problems:
The first one can't be changed by Inkscape: when you add objects to the same layer in both branches you need to tell the diff tool to insert them after each others so no big deal
The second one is that Inkscape saves the zoom and view position; while its a bit annoying and i don’t relay see the advantage of saving those its easy to resolve.
Already adressed in current trunk:
- Bug #928205 “Do not save viewport metadata option” https://bugs.launchpad.net/inkscape/+bug/928205
The third one is the reason for this mail: the svg format was designed not to waste too much bandwidth for path definitions (http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation) so it was allowed to put skip some whitespaces, have relative and absolute formats and so on. While its not necessary to use it Inkscape actually uses some of those optimizations for size. That is where it gets problematic: No line based diff algorithm will ever be able to understand
d="M 94.560583,882.94114 202.33942,447.30755 149.72092,186.54185 C 322.59461,172.3981 497.26518,91.769646 666.84911,199.34693 l 44.50099,59.86379 6.19919,124.61 -138.89214,182.52301
- -292.02038,376.68278 z"
it would be way better if Inkscape would save all the commands in their own line with the correct command in front so you can put other lines in between without breaking everything:
d="M94.560583,882.94114 M202.33942,447.30755 M149.72092,186.54185 C322.59461,172.3981 C497.26518,91.769646 C666.84911,199.34693 l44.50099,59.86379 l6.19919,124.61 l-138.89214,182.52301 l-292.02038,376.68278 z"
would allow adding a point to the line by just adding a line without creating a huge diff.
Additionally it would be good to never use relative coordinates (l) as changing one point would change two lines otherwise
See Inkscape Preferences > SVG output > Path data: [ ] Allow relative coordinates
Note: changing this setting will affect newly created or modified objects. For existing objects/paths a rewrite of the path data needs to be triggered manually (e.g. by nudging a selection with the arrow keys a tick up and back down).
Please note that this suggestion is for the so-called Inkscape-SVG only (as that is the one people will use to work ), it should obviously be optimized as much as possible in the plain svg format.
i am a user, not a developer of inkscape. and i think i can share some information with you.
1. you can get rid of the view point thing by saving your file into plain svg format. however, doing this loses information, for instance, rx, ry, cx, cy in circles. 2. you can find an option in configuration that forces inkscape to save path in absolute coordinates. that means, all the m, c, a commands in path will be converted into M, C, A commands. of course this list is not exhaustive.
as for the one line per command, or coordinate pair, thing in path, i have no idea at all.
regards,
On Wed, May 8, 2013 at 9:42 PM, Yannik Völker <yannikv@...266...> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
First of all: I am not exactly shure if this belongs into -user if it should be put into the dev mailing list please tell me to do so
Today I ran some experiments on collaborative work Inkscape. I put a file in a simple Hg-repository, created two branches, made some changes to each of them and afterwards tried to merge them back together. while doing so I ran into 3 Problems:
The first one can't be changed by Inkscape: when you add objects to the same layer in both branches you need to tell the diff tool to insert them after each others so no big deal The second one is that Inkscape saves the zoom and view position; while its a bit annoying and i don’t relay see the advantage of saving those its easy to resolve. The third one is the reason for this mail: the svg format was designed not to waste too much bandwidth for path definitions (http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation) so it was allowed to put skip some whitespaces, have relative and absolute formats and so on. While its not necessary to use it Inkscape actually uses some of those optimizations for size. That is where it gets problematic: No line based diff algorithm will ever be able to understand
d="M 94.560583,882.94114 202.33942,447.30755 149.72092,186.54185 C 322.59461,172.3981 497.26518,91.769646 666.84911,199.34693 l 44.50099,59.86379 6.19919,124.61 -138.89214,182.52301
- -292.02038,376.68278 z"
it would be way better if Inkscape would save all the commands in their own line with the correct command in front so you can put other lines in between without breaking everything:
d="M94.560583,882.94114 M202.33942,447.30755 M149.72092,186.54185 C322.59461,172.3981 C497.26518,91.769646 C666.84911,199.34693 l44.50099,59.86379 l6.19919,124.61 l-138.89214,182.52301 l-292.02038,376.68278 z"
would allow adding a point to the line by just adding a line without creating a huge diff. Additionally it would be good to never use relative coordinates (l) as changing one point would change two lines otherwise Please note that this suggestion is for the so-called Inkscape-SVG only (as that is the one people will use to work ), it should obviously be optimized as much as possible in the plain svg format.
Yannik Völker -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQIcBAEBAgAGBQJRilZAAAoJEDqk81AiCyXKzNwQAJP2BwXDVJ0ASIc+0Pw6TjsW yF3s6nGm4/5cWHbXXDUosCJNu4VH9bccFyEfwfoUHgPXoPWM7XQJWF+Imj+W5rTJ XfrCEyrLC/8fcqZpS301vfjv0492J4UZi+mMuIVVQQwa3djCISDg3GQHkOgiEPxw Gu7KJSDGvmct6sW+vKsErHLBgjh+NeE8d8ySEIXXryEi5boBO3+4Ai9IVEfkOCs7 qvDIXgmkePaLvFukLnAvOVJxSeXnTFRyQyozX5IQE+M7tTL6HQKf7qhDTXuJOkuJ tSdoCIcTE4Ksy0h+7wRgvZ/+rMcle+cZg9gt8YzAypsdSewLYDLljM0geIAfkxvp K8eVZs6f7Fmsqzb/hlVZrQLzb/oA+WR7iLcWuKGa3dtIYR1udvTA+UYzUNvjXn4t p50eqZ4a4yreg34GsM9dOuvEcy2RrVzvRxX0+Y5whzvx1ndj+XJwmrudOykfyip6 Xg6o9wtqYN4FCnEPTwcixUSl3uyCUN0QnjJtZLwlL6wSvOTJyCedsGv5Sh3lrIMr UUnK6kQoGKlmvWBdXB3eBqTJSUUC+NZdPZMCXD0TEm04SdaYS1901JpTyJMT0TXU NFz42yVz/pbU5y/j/zMDLhrmdPeAmDMqazyqwEXRTBOaxFvec/upyixuwNRPqsDO bpx80Tt5vkz4YA5+MT/W =o356 -----END PGP SIGNATURE-----
Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
On Wed, 08 May 2013 15:42:24 +0200 Yannik Völker <yannikv@...266...> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
First of all: I am not exactly shure if this belongs into -user if it should be put into the dev mailing list please tell me to do so
Today I ran some experiments on collaborative work Inkscape. I put a file in a simple Hg-repository, created two branches, made some changes to each of them and afterwards tried to merge them back together. while doing so I ran into 3 Problems:
The first one can't be changed by Inkscape: when you add objects to the same layer in both branches you need to tell the diff tool to insert them after each others so no big deal The second one is that Inkscape saves the zoom and view position; while its a bit annoying and i don___t relay see the advantage of saving those its easy to resolve. The third one is the reason for this mail: the svg format was designed not to waste too much bandwidth for path definitions (http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation) so it was allowed to put skip some whitespaces, have relative and absolute formats and so on. While its not necessary to use it Inkscape actually uses some of those optimizations for size. That is where it gets problematic: No line based diff algorithm will ever be able to understand
d="M 94.560583,882.94114 202.33942,447.30755 149.72092,186.54185 C 322.59461,172.3981 497.26518,91.769646 666.84911,199.34693 l 44.50099,59.86379 6.19919,124.61 -138.89214,182.52301
- -292.02038,376.68278 z"
it would be way better if Inkscape would save all the commands in their own line with the correct command in front so you can put other lines in between without breaking everything:
d="M94.560583,882.94114 M202.33942,447.30755 M149.72092,186.54185 C322.59461,172.3981 C497.26518,91.769646 C666.84911,199.34693 l44.50099,59.86379 l6.19919,124.61 l-138.89214,182.52301 l-292.02038,376.68278 z"
would allow adding a point to the line by just adding a line without creating a huge diff. Additionally it would be good to never use relative coordinates (l) as changing one point would change two lines otherwise Please note that this suggestion is for the so-called Inkscape-SVG only (as that is the one people will use to work ), it should obviously be optimized as much as possible in the plain svg format.
Yannik Völker
If you edit the svg file in gvim, select the range of lines you want to clarify, and within that range replace the space with a space carriage return as apppropriate for your OS then that might do the trick. Hven't tested it yet, time to go to church followed by Mother's Day brunch. I'll try tomorrow.
Gvim runs on all three common OS. go to http://www.vim.org to download/install.
On Wed, 08 May 2013 15:42:24 +0200 Yannik Völker <yannikv@...266...> wrote:
The first one can't be changed by Inkscape: when you add objects to the same layer in both branches you need to tell the diff tool to insert them after each others so no big deal
I don't understand the preceding, but since you seem to have a handle on it, let's move on.
The second one is that Inkscape saves the zoom and view position; while its a bit annoying and i don’t relay see the advantage of saving those its easy to resolve. The third one is the reason for this mail: the svg format was designed not to waste too much bandwidth for path definitions (http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation) so it was allowed to put skip some whitespaces, have relative and absolute formats and so on. While its not necessary to use it Inkscape actually uses some of those optimizations for size. That is where it gets problematic: No line based diff algorithm will ever be able to understand
d="M 94.560583,882.94114 202.33942,447.30755 149.72092,186.54185 C 322.59461,172.3981 497.26518,91.769646 666.84911,199.34693 l 44.50099,59.86379 6.19919,124.61 -138.89214,182.52301
- -292.02038,376.68278 z"
it would be way better if Inkscape would save all the commands in their own line with the correct command in front so you can put other lines in between without breaking everything
If I were going to diff two Inscape files, I think what I would do is get my hands on an XML parser for my computer language of choice, and write myself a generic XML writer to write the elements back. For the most part, they'd simply be written, but in the case of a path, my writer would intervene to put every command at the beginning of the line, while removing all other newlines and finding a uniform space treatment. Somebody else mentioned you can turn off relative coordinates in Inkscape.
This is a lot of work, but sometimes, when I just can't do something in Inkscape, I'll try to do it in the XML itself, and it often helps to add or change something in a diagram and then diff it against the pre-change version.
Please let us all know what you come up with.
Thanks,
SteveT
Steve Litt * http://www.troubleshooters.com/ Troubleshooting Training * Human Performance
This thread reminded me of a project that was created to address the issue of SVG diffs:
https://github.com/pghpy/diffsvg
The last commit was 2 years ago, but the general design looks sound:
* it's better to use a XML-aware diff tool than the usual line-based approach * it could also conceivably be enhanced to parse the path data differences properly
This approach does away with the huge and improbable task of asking authors of SVG editing software to change their SVG output.
Also, see this promising proposal regarding the visual display of diffs on SVG files:
About: http://w.xuv.be/projects/design_with_git Demo: http://xuv.github.io/design-with-git/static-svg-diff/
:r
On 05/08/2013 02:42 PM, Yannik Völker wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
First of all: I am not exactly shure if this belongs into -user if it should be put into the dev mailing list please tell me to do so
Today I ran some experiments on collaborative work Inkscape. I put a file in a simple Hg-repository, created two branches, made some changes to each of them and afterwards tried to merge them back together. while doing so I ran into 3 Problems:
The first one can't be changed by Inkscape: when you add objects to the same layer in both branches you need to tell the diff tool to insert them after each others so no big deal The second one is that Inkscape saves the zoom and view position; while its a bit annoying and i don’t relay see the advantage of saving those its easy to resolve. The third one is the reason for this mail: the svg format was designed not to waste too much bandwidth for path definitions (http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation) so it was allowed to put skip some whitespaces, have relative and absolute formats and so on. While its not necessary to use it Inkscape actually uses some of those optimizations for size. That is where it gets problematic: No line based diff algorithm will ever be able to understand
d="M 94.560583,882.94114 202.33942,447.30755 149.72092,186.54185 C 322.59461,172.3981 497.26518,91.769646 666.84911,199.34693 l 44.50099,59.86379 6.19919,124.61 -138.89214,182.52301
- -292.02038,376.68278 z"
it would be way better if Inkscape would save all the commands in their own line with the correct command in front so you can put other lines in between without breaking everything:
d="M94.560583,882.94114 M202.33942,447.30755 M149.72092,186.54185 C322.59461,172.3981 C497.26518,91.769646 C666.84911,199.34693 l44.50099,59.86379 l6.19919,124.61 l-138.89214,182.52301 l-292.02038,376.68278 z"
would allow adding a point to the line by just adding a line without creating a huge diff. Additionally it would be good to never use relative coordinates (l) as changing one point would change two lines otherwise Please note that this suggestion is for the so-called Inkscape-SVG only (as that is the one people will use to work ), it should obviously be optimized as much as possible in the plain svg format.
Yannik Völker -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQIcBAEBAgAGBQJRilZAAAoJEDqk81AiCyXKzNwQAJP2BwXDVJ0ASIc+0Pw6TjsW yF3s6nGm4/5cWHbXXDUosCJNu4VH9bccFyEfwfoUHgPXoPWM7XQJWF+Imj+W5rTJ XfrCEyrLC/8fcqZpS301vfjv0492J4UZi+mMuIVVQQwa3djCISDg3GQHkOgiEPxw Gu7KJSDGvmct6sW+vKsErHLBgjh+NeE8d8ySEIXXryEi5boBO3+4Ai9IVEfkOCs7 qvDIXgmkePaLvFukLnAvOVJxSeXnTFRyQyozX5IQE+M7tTL6HQKf7qhDTXuJOkuJ tSdoCIcTE4Ksy0h+7wRgvZ/+rMcle+cZg9gt8YzAypsdSewLYDLljM0geIAfkxvp K8eVZs6f7Fmsqzb/hlVZrQLzb/oA+WR7iLcWuKGa3dtIYR1udvTA+UYzUNvjXn4t p50eqZ4a4yreg34GsM9dOuvEcy2RrVzvRxX0+Y5whzvx1ndj+XJwmrudOykfyip6 Xg6o9wtqYN4FCnEPTwcixUSl3uyCUN0QnjJtZLwlL6wSvOTJyCedsGv5Sh3lrIMr UUnK6kQoGKlmvWBdXB3eBqTJSUUC+NZdPZMCXD0TEm04SdaYS1901JpTyJMT0TXU NFz42yVz/pbU5y/j/zMDLhrmdPeAmDMqazyqwEXRTBOaxFvec/upyixuwNRPqsDO bpx80Tt5vkz4YA5+MT/W =o356 -----END PGP SIGNATURE-----
Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
participants (6)
-
Auguste Pop
-
john Culleton
-
Ricardo Lafuente
-
Steve Litt
-
Yannik Völker
-
~suv