Skip to content
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

Unique ids #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Unique ids #7

wants to merge 1 commit into from

Conversation

henjo
Copy link

@henjo henjo commented Sep 26, 2013

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

id_attributes[idvalue] = newidvalue

## Update references
for e in root.xpath("//*[contains(@*, 'url(#')]"):
Copy link
Owner

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

@btel
Copy link
Owner

btel commented Sep 27, 2013

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.

@btel
Copy link
Owner

btel commented Oct 1, 2020

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.

@hartwork
Copy link
Collaborator

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?

@btel
Copy link
Owner

btel commented Feb 11, 2021

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.

@Leonard-Reuter
Copy link

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.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants