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

Shapes exports to SVG without their identifiers #407

Closed
evgeny-sureev opened this issue Jun 6, 2018 · 3 comments
Closed

Shapes exports to SVG without their identifiers #407

evgeny-sureev opened this issue Jun 6, 2018 · 3 comments
Assignees
Milestone

Comments

@evgeny-sureev
Copy link
Contributor

The "id" attribute is lost after exporting from Macaw to SVG.

@f3dm76
Copy link
Collaborator

f3dm76 commented Jun 9, 2018

Could you please provide an example?

@evgeny-sureev
Copy link
Contributor Author

Consider this SVG:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1005"
     height="640">
        <rect height="55" x="894" y="259" width="100" fill="#1ABD9D"
              id="dc1b6550-5770-4f44-8173-8449267b8fdf"/>
        <rect height="55" x="894" y="143" width="100" fill="#1ABD9D"
              id="bd7ae432-e619-42d4-8b36-07541e5b2da1"/>
</svg>

Now if we import svg into Macaw, we can access identifiers via tag property:

let svg = try SVGParser.parse(text: String(contentsOf: svgData))!
let rect = svg.contents[0]
print(rect.tag.first)
// prints 'dc1b6550-5770-4f44-8173-8449267b8fdf'

But after exporting to SVG back, all identifiers are lost:

print(SVGSerializer.serialize(node: svg))
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1005"
     height="640">
        <rect height="55" x="894" y="259" width="100" fill="#1ABD9D"/>
        <rect height="55" x="894" y="143" width="100" fill="#1ABD9D"/>
</svg>

@ystrot ystrot modified the milestones: 0.9.2, 0.9.3 Jun 13, 2018
f3dm76 added a commit to f3dm76/Macaw that referenced this issue Jun 21, 2018
@ystrot ystrot modified the milestones: 0.9.3, 0.9.2 Jun 21, 2018
@ystrot ystrot closed this as completed in 56e762b Jun 21, 2018
ystrot added a commit that referenced this issue Jun 21, 2018
Fix #407: Shapes exports to SVG without their identifiers
@ystrot
Copy link
Member

ystrot commented Jun 21, 2018

Hi Evgeny,

This issue fixed in the master branch and quite soon will be available in the 0.9.2 release.

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

No branches or pull requests

3 participants