23 lines
785 B
Python
23 lines
785 B
Python
import sys
|
|
|
|
scale = 1.5
|
|
|
|
def transform():
|
|
with open(sys.argv[1]) as f:
|
|
for line in f.readlines():
|
|
if line.strip().startswith("<svg xmlns"):
|
|
width = line.split('width="')[1].split('"')[0]
|
|
height = line.split('height="')[1].split('"')[0]
|
|
viewbox = line.split('viewBox="')[1].split('"')[0]
|
|
width = float(width) * scale
|
|
height = float(height) * scale
|
|
|
|
template = f'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{width}" height="{height}" viewBox="{viewbox}">'
|
|
yield template
|
|
else:
|
|
yield line
|
|
|
|
lines = list(transform())
|
|
with open(sys.argv[1], 'w') as f:
|
|
f.write(''.join(lines))
|