-
Notifications
You must be signed in to change notification settings - Fork 88
Unique ids #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Unique ids #7
Conversation
… ids in order to avoid id name clashes
id_attributes[idvalue] = newidvalue | ||
|
||
## Update references | ||
for e in root.xpath("//*[contains(@*, 'url(#')]"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'url(#' is not enough. SVG also allows for simple references (like '#id'). I think it might be better to look for '#id' references for each renamed id
Thanks for the PR. Your solution looks mostly fine, but there are some small problem. Since it is a bigger PR, it would be cool to have a unit test. |
this PR has been stalled for some time, it need rebasing (that is making up-to-date with the version on master) and fixing the issues in the comments. |
My impression is that this pull request is "not fully supported" any more. The problem it tries to solve is an important one, though, I think. I have run into the issue myself before and my workaround was to rename IDs manually, where it was needed: That approach doesn't scale well. @btel if we pretended that we had no suggested implementation yet at all, what would be your requirements about any implementation other than being covered by tests? Can you share what comes to mind on that topic? |
yes, i think the idea is very good. The main requirement is that we find and replace all possible instances of the id and its referrers. We could either prefix them or change them to something unique like uuid. |
I just wanted to add, that I had the exact same issue and also ended up sed-ing .svg files. So any work on this is very much appreciated =) Thanks alot! |
Hi,
I tried to put a collection of svg in a single figure and ran into problems with elements with same ids in the different files. This problem caused all kind of strange artifacts in the resulting SVG file. I fixed it by adding a unique prefix to every id attribute in the fromfile function.
/Henrik