1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8 -*-
4
4
from scour import scourString
5
input = file(sys.argv[1], "r")
6
sys.stdout.write(scourString(input.read()).encode("UTF-8"))
6
class ScourInkscape (inkex.Effect):
9
inkex.Effect.__init__(self)
10
self.OptionParser.add_option("--tab",
11
action="store", type="string",
13
self.OptionParser.add_option("--simplify-colors", type="inkbool",
14
action="store", dest="simple_colors", default=True,
15
help="won't convert all colors to #RRGGBB format")
16
self.OptionParser.add_option("--style-to-xml", type="inkbool",
17
action="store", dest="style_to_xml", default=True,
18
help="won't convert styles into XML attributes")
19
self.OptionParser.add_option("--group-collapsing", type="inkbool",
20
action="store", dest="group_collapse", default=True,
21
help="won't collapse <g> elements")
22
self.OptionParser.add_option("--enable-id-stripping", type="inkbool",
23
action="store", dest="strip_ids", default=False,
24
help="remove all un-referenced ID attributes")
25
self.OptionParser.add_option("--embed-rasters", type="inkbool",
26
action="store", dest="embed_rasters", default=True,
27
help="won't embed rasters as base64-encoded data")
28
self.OptionParser.add_option("--keep-editor-data", type="inkbool",
29
action="store", dest="keep_editor_data", default=False,
30
help="won't remove Inkscape, Sodipodi or Adobe Illustrator elements and attributes")
31
self.OptionParser.add_option("--strip-xml-prolog", type="inkbool",
32
action="store", dest="strip_xml_prolog", default=False,
33
help="won't output the <?xml ?> prolog")
34
self.OptionParser.add_option("-p", "--set-precision",
35
action="store", type=int, dest="digits", default=5,
36
help="set number of significant digits (default: %default)")
37
self.OptionParser.add_option("--indent",
38
action="store", type="string", dest="indent_type", default="space",
39
help="indentation of the output: none, space, tab (default: %default)")
40
self.OptionParser.add_option("--enable-viewboxing", type="inkbool",
41
action="store", dest="enable_viewboxing", default=False,
42
help="changes document width/height to 100%/100% and creates viewbox coordinates")
46
input = file(sys.argv[12], "r")
47
sys.stdout.write(scourString(input.read(), self.options).encode("UTF-8"))
52
if __name__ == '__main__':
54
e.affect(output=False)