meerk40t / svgelements

SVG Parsing for Elements, Paths, and other SVG Objects.
MIT License
133 stars 29 forks source link

Degenerate Polygon/Polylines with 0 points are produced. #105

Closed tatarize closed 3 years ago

tatarize commented 3 years ago

<polygon/> as parsed text should produce 0 shapes. This shape is valid as a bit of code but is not rendered. As such parse/elements should not actually publish produce a polygon object in that case.

tatarize commented 3 years ago

Upon review, this requires clarification.

        q = io.StringIO(u'''<?xml version="1.0" encoding="utf-8" ?>
                        <svg>
                        <polygon points=""/>
                        <polygon/>
                        <rect x="0" y="0" width="0" height="10"/>
                        <circle cx="0" cy="0" r="0"/>
                        </svg>''')
        m = SVG.parse(q)

This produces all the generate shapes even though the shapes themselves cannot produce path elements. Which is basically the rendering process here.