Commit graph

117 commits

Author SHA1 Message Date
Tobias Oberstein
0d6725e05d Merge pull request #46 from Ede123/options
Facilitate command line usage
2016-03-22 16:20:41 +01:00
Eduard Braun
77906518c0 Use option groups for command line arguments to achieve clearer help output 2016-02-20 18:43:43 +01:00
Eduard Braun
72c2ec8e1c Add possibility to specify input/output filename using positional arguments (e.g. 'scour input.svg output.svg') 2016-02-20 17:57:30 +01:00
Tobias Oberstein
ab90d18cb2 Merge pull request #45 from Ede123/console_output
Switch order of new/old size in console output
2016-02-19 14:08:29 +01:00
Tobias Oberstein
7c3331d6f6 Merge pull request #44 from Ede123/default_options
Mechanism for sanitizing options
2016-02-19 14:07:29 +01:00
Eduard Braun
b042c93b2c Switch order of new/old size in console output
(It already looked like a fraction, now it also yields the correct result if it's read like one)
2016-02-19 04:47:33 +01:00
Eduard Braun
cf08a72e41 Unittests: Add two tests for and simplify after e701acdc25 2016-02-19 04:40:57 +01:00
Eduard Braun
e701acdc25 Add a mechanism to sanitize options.
This simplifies usage of the Scour module while avoiding any compatibility issues that might be caused by adding/removing/renaming options.
2016-02-19 04:03:59 +01:00
Tobias Oberstein
1a9d6119e0 bump version 2016-01-29 09:26:12 +01:00
Tobias Oberstein
170f8c7baa turn down log noise; improve logging 2016-01-29 09:25:43 +01:00
Tobias Oberstein
939dd160bc scour does indeed work on py3 2016-01-15 13:17:34 +01:00
Tobias Oberstein
73ec7da13e allow installation via direct execution of setup.py from outside the package directory 2016-01-15 11:15:22 +01:00
Tobias Oberstein
07e9ec0257 add notes on how to install latest trunk 2016-01-15 11:07:29 +01:00
Tobias Oberstein
f05d73b859 cleanup readme 2016-01-15 10:53:35 +01:00
Tobias Oberstein
dccb80314c Merge pull request #37 from Eitot/sketch
Sketch support
2016-01-15 10:44:32 +01:00
Eitot
184efee16e - Initial support for Sketch
- Typos in README.md
2015-12-24 17:07:40 +01:00
Tobias Oberstein
fbf4e3ec2e Merge pull request #36 from Eitot/readme
Update README.md
2015-12-21 12:59:06 +01:00
Eitot
972812e6c7 Update README.md 2015-12-21 09:10:09 +01:00
Tobias Oberstein
232f27269a bump version for release 2015-12-10 23:39:16 +01:00
Tobias Oberstein
130a71327a Merge pull request #28 from Ede123/comments
Simplify and fix "removeComments()"
2015-12-10 23:34:59 +01:00
Tobias Oberstein
0a0a062718 Merge pull request #27 from Ede123/encoding
Fix character encoding issues
2015-12-10 23:32:22 +01:00
Eduard Braun
c698522c28 Simplify and fix "removeComments()"
* The separate treatment of comments at the documentElement's level is not necessary - they have a parent (as tested in Python 3.5.0 and 2.7.11 and 2.6.6)! It might not have worked before due to a typo - note the "if isinstance(element,...)" and "len(element.data)" which should both refer to "subelement" instead - or a bug in very old versions of Python).
* Fix the iteration over childNodes (i.e. replace "for subelement in element.childNodes:" with ""for subelement in element.childNodes[:]:". We have to create a copy of the list to iterate over, otherwise we'd be iterating over a list as we change it which leads to unpredictable results.

Fixes #25
2015-12-10 22:51:27 +01:00
Eduard Braun
946ca3ce4a Unittests: Add a test for proper decoding of ISO 8859-15 2015-12-09 21:32:18 +01:00
Eduard Braun
8984e550b0 Read from stdin in binary mode an let XML parser deal with encoding. Also write to stdout in binary mode as the output is already encoded. 2015-12-09 00:30:16 +01:00
Eduard Braun
4eade69201 Open input file in binary mode an let XML parser deal with encoding.
Fixes #26
2015-12-08 23:38:06 +01:00
Jeff Schiller
1a6ff29c14 Merge pull request #24 from Ede123/unittests
Import unittests from old repository
2015-12-08 08:23:30 -08:00
Eduard Braun
32e7e5517f Unittests: Account for b979fe19e5 (fix one test and add two more)
- Unused XML namespace declarations *are supposed* to be removed
- XML namespace declarations that are used as prefix for elements/attributes *must not* be removed
2015-12-07 00:33:08 +01:00
Eduard Braun
ab1aa0e2f8 Fix a bug with "points" attribute of "polyline/polygon" starting with a negative number.
In this case "len(nums) = 0" and "nums[len(nums)-1]" triggered an "IndexError: list index out of range"
2015-12-06 23:47:56 +01:00
Eduard Braun
f0c69b827e Unittests: Sync options with current Scour
(fixes yet two other errors when running tests)
2015-12-06 23:07:06 +01:00
Eduard Braun
2293e1bd4a Fix regex for list of points splitting: Expect at least one whitespace character or comma between coords.
The previous regex would have allowed zero length matches and therefore could have split the string after every character - luckily this was not (yet) correctly implemented in Python. Since Python 3.5 a warning is raised informing of this problem. Future versions will correctly split also at zero length matches.

See also note on https://docs.python.org/3/library/re.html#re.split
2015-12-06 22:53:03 +01:00
Eduard Braun
c54c5e5d7e Unittests: Fix warnings
- Replace deprecated assertion-aliases
- Make sure opened files are properly closed after usage
2015-12-06 22:13:21 +01:00
Eduard Braun
320bdda6e9 Unittests: Run python-modernize 2015-12-06 21:20:05 +01:00
Eduard Braun
391ff77659 Unittests: Fix import paths 2015-12-06 20:10:12 +01:00
Eduard Braun
3b7e8a0091 Restore unittests from history 2015-12-06 19:59:06 +01:00
Tobias Oberstein
ebccae8cad Merge pull request #17 from Ede123/compat_fix
Compatibility fix for Python 2.6
2015-11-26 22:56:48 +01:00
Eduard Braun
6254548582 Compatibility fix for Python 2.6
(NamedNodeList seems not to have had the iterkeys method back then)
2015-11-21 23:29:59 +01:00
Tobias Oberstein
46a2ada361 Merge pull request #14 from Ede123/namespaces
Remove unused XML namespace declarations
2015-11-17 23:18:46 +01:00
Eduard Braun
532f664001 Minor fix in console output (superfluous space) 2015-11-17 23:09:25 +01:00
Eduard Braun
89f4b687f2 Statistics: count also attributes removed from root SVG element 2015-11-17 22:49:50 +01:00
Eduard Braun
67bacc2f23 Remove metadata right away
(i.e. before checking for unused XML namespaces; otherwise the relevant namespaces used for metadata would not yet be unused)
2015-11-17 22:46:50 +01:00
Eduard Braun
b979fe19e5 Remove unused XML namespace declarations 2015-11-17 22:30:23 +01:00
Tobias Oberstein
302f7f7477 use absolute imports 2015-11-16 20:36:12 +01:00
Tobias Oberstein
d3b29a68da fix links; only upload source dist 2015-11-16 18:12:56 +01:00
Tobias Oberstein
ec7385c995 update readme 2015-11-16 18:08:02 +01:00
Tobias Oberstein
e903475289 cleanups; bump version 2015-11-16 18:05:35 +01:00
Tobias Oberstein
27d5cd3881 Merge pull request #13 from Ede123/options
Add some options to optimize pretty-printing
2015-11-16 16:39:58 +01:00
Eduard Braun
7e36be4aaa Add an option to strip the xml:space="preserve" attribute from the root SVG element
This attribute is added by at least one popular vector graphics editor thwarting our efforts to pretty-print the output.
2015-11-15 19:26:39 +01:00
Eduard Braun
e21e362353 Add an option to suppress output of line breaks
(obviously this also disables indentation)
2015-11-15 18:44:17 +01:00
Eduard Braun
18266ca1ec Add an option to set number of spaces (or tabs used for indentation) 2015-11-15 18:14:03 +01:00
Tobias Oberstein
a5b09e3824 add notice of repo move 2015-10-17 17:29:47 +02:00