16 lines
378 B
Python
16 lines
378 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import inkex
|
||
|
|
||
|
class CleanGroups(inkex.Effect):
|
||
|
|
||
|
def __init__(self):
|
||
|
inkex.Effect.__init__(self)
|
||
|
|
||
|
def effect(self):
|
||
|
groups = self.document.xpath('//svg:g',namespaces=inkex.NSS)
|
||
|
for group in groups:
|
||
|
if len(group.getchildren()) == 0:
|
||
|
group.getparent().remove(group)
|
||
|
|
||
|
CleanGroups().run()
|