Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Ipe crashes on empty paths (which are created by svgtoipe) #163
current ipe cannot load a file containing this path:
However, a path like this is sometimes being created by svgtoipe, for example when converting the attached file (which I had to zip so that github allows me to attach it…)
I'm not sure if this is a bug in ipe or svgtoipe, but I think from http://ipe.otfried.org/manual/manual_47.html paths with "just a move" are not explicitly forbidden, right?
Yes, but I think refusing to open the file is probably not the correct behaviour? At least for SVGs, such an "useless" path is allowed by the specs, I think. For ipe, I also think that the manual does not forbid this. Thus, either ipe currently refuses to open a well-formed Ipe-XML file, or svgtoipe transforms a valid SVG file into an invalid Ipe XML file.
Maybe it would be better to just silently ignore such paths? Either during conversion from SVG to Ipe-XML or when opening the file in ipe.
Edit: I looked at the code of both ipe and ipetosvg and could not figure out a "trivial" way of ignoring such things. For ipe, the problem is that for the file to open,
It's always debatable what to do with ill-formed input. One strategy is to accept as input nearly anything that can be interpreted in some way, but to conform strictly to the specs when writing output.
HTML browsers are extreme in this respect, since there is so much ill-formed HTML around. SVG viewers again will try to interpret as much as they can, because there are so many different SVG-producers around.
There are not many Ipe-format producers around, and I think being strict on what Ipe accepts helps them quickly identify bugs in their code. If I'm creating Ipe files and I make a mistake, I definitely want Ipe telling me what's wrong with my output rather than silently ignoring some element.
From this point of view, this should be changed in svgtoipe. As you say, this isn't easy, because svgtoipe is a rather simple script that doesn't fully parse the SVG before creating Ipe output - it rather translates elements on the fly (there are a few other things it can't do because of that).
<path> 0 0 m </path>
It would recommend it because it is safer to use than regular expression (e.g. it should always return a valid XML file)