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

Breaks file by removing clip even when child is referenced by a clone (<use>) #296

Open
nathanal opened this issue May 11, 2022 · 0 comments · May be fixed by #302
Open

Breaks file by removing clip even when child is referenced by a clone (<use>) #296

nathanal opened this issue May 11, 2022 · 0 comments · May be fixed by #302

Comments

@nathanal
Copy link

nathanal commented May 11, 2022

Downstream report: https://gitlab.com/inkscape/extensions/-/issues/468

Steps to Replicate

What happened?

  • The object the <use> element links to is deleted (because it is in a unused clone)

What should have happened?

  • Object is not deleted.
  • Ideally the clone is removed but relevant children preserved; however, keeping the clip is better than current behavior.

Input

min_example_lost_clone

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
 <defs>
  <clipPath id="unusedclip">
  <rect id="the_path" width="100" height="100"/>
  </clipPath>
 </defs>
 <use fill="red" width="100%" height="100%" xlink:href="#the_path"/>
</svg>

Output

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
 <use width="100%" height="100%" fill="red" xlink:href="#the_path"/>
</svg>

Version info

  • Testing by cloning this repository and pip3 install . (I edited the scour version to make sure I could see it was properly installed) (0609c59)
  • Also happens with python3-scour from repos (0.37) and 0.38.2 from pip3
  • Python 3.8.10, Linux Mint 20
@nathanal nathanal changed the title Clip removed even if child is referenced by a in-use clone (<use>) Breaks file by removing clip even when child is referenced by a clone (<use>) May 11, 2022
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 a pull request may close this issue.

1 participant