Debian Codegraph @

docs/images/ansible/pcaps/stroke-width.py

raw
1
2 import sys
3 # Add viewBox attr to SVGs lacking it, so IE scales properly.
4
5 import lxml.etree
6 import glob
7
8
9 for name in sys.argv[1:]: # glob.glob('*/*.svg'): #+ glob.glob('images/ansible/*.svg'):
10 doc = lxml.etree.parse(open(name))
11 svg = doc.getroot()
12 for elem in svg.cssselect('[stroke-width]'):
13 if elem.attrib['stroke-width'] < '2':
14 elem.attrib['stroke-width'] = '2'
15
16 open(name, 'w').write(lxml.etree.tostring(svg, xml_declaration=True, encoding='UTF-8'))