Skip to content

Commit de698f4

Browse files
committed
Implemented SVG path cleaning
1 parent 182fb39 commit de698f4

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Utils/svg_cleaner.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ def rgb_replacer(m):
224224
a[k] = re.sub(re_hex, hex_replacer, a[k])
225225
a[k] = re.sub(re_rgb, rgb_replacer, a[k])
226226

227+
def sanitize_path_points(node):
228+
d = node.attrib.get("d", None)
229+
230+
if not d:
231+
return
232+
233+
node.attrib["d"] = d.replace(",", " ")
234+
227235
def process_node(node, pack_style):
228236
if pack_style:
229237
pack_style_props(node)
@@ -234,6 +242,7 @@ def process_node(node, pack_style):
234242
sort_attrs(node)
235243
sort_style_props(node)
236244
sanitize_attrs(node)
245+
sanitize_path_points(node)
237246

238247
def process_xmls(paths, suffix, pack_styles):
239248
for ns_name, ns_url in xml_namespaces.items():

0 commit comments

Comments
 (0)