Skip to content
Snippets Groups Projects
Commit 1fb8a379 authored by Pregmodder's avatar Pregmodder
Browse files

Merge remote-tracking branch 'upstream/pregmod-master' into pregmod-master

parents 0cf9cbdf 77986405
Branches
Tags
No related merge requests found
#!/usr/bin/env python3 #!/usr/bin/env python3
''' '''
Application for "fixing" SVGs edited with Inkscape Application for "normalizing" SVGs
These problems are addressed: These problems are addressed:
...@@ -44,8 +44,23 @@ def fix(tree): ...@@ -44,8 +44,23 @@ def fix(tree):
if (i != l): if (i != l):
print("Overwriting ID %s with Label %s..."%(i, l)) print("Overwriting ID %s with Label %s..."%(i, l))
elem.set('id', l) elem.set('id', l)
# remove all offending style attributes # clean styles (for easier manual merging)
style_string = elem.get('style')
if style_string:
split_styles = style_string.strip('; ').split(';')
styles_pairs = [s.strip('; ').split(':') for s in split_styles]
filtered_pairs = [ (k,v) for k,v in styles_pairs if not (
k.startswith('font-') or
k.startswith('text-') or
k.endswith('-spacing') or
k in ["line-height", " direction", " writing", " baseline-shift", " white-space", " writing-mode"]
)]
split_styles = [':'.join(p) for p in filtered_pairs]
style_string = ';'.join(sorted(split_styles))
elem.attrib["style"] = style_string
# remove all style attributes offending class styles
s = elem.get('style') s = elem.get('style')
c = elem.get('class') c = elem.get('class')
if (c and s): if (c and s):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment