Commit graph

292 commits

Author SHA1 Message Date
Eduard Braun
386d5d8656 Allow elements to be found via Document.getElementById() in the minidom document returned by scourXmlFile() (#68) 2016-08-25 21:13:09 +02:00
Eduard Braun
8d6301950b Redirect informational output to stderr when SVG is output to stdout (#67)
fixes #47
2016-08-23 22:31:55 +02:00
Eduard Braun
4f23ea7a34 Print usage information if no input file was specified (and no data is available from stdin) (#65)
fixes #34
2016-08-23 21:16:14 +02:00
Eduard Braun
57f93efc89 Don't escape quotes ('/") in text nodes and attributes. (#64)
- In text nodes quotes are fine
- In attributes quotes are fine if used reciprocally.

Escaping in the latter case often causes issues, e.g. with quoted font names (#21) or inline CSS styles (#56), while it probably does not gain anything (if quotes are wrongly used in attribute names the XML is most likely invalid to start with)
2016-08-16 00:10:41 +02:00
Eduard Braun
fe2884c3e8 Don't remove unreferenced defs if --keep-unreferenced-defs is specified (#62)
* Don't remove unreferenced defs if `--keep-unreferenced-defs` is specified
(fixes #18)

* Add unittests for previous commit
2016-08-14 18:52:55 +02:00
Eduard Braun
3299f8f6e0 Also shorten unused IDs when --shorten-ids is specified 2016-08-14 17:12:48 +02:00
Eduard Braun
df142a2f22 Drop official support for Python 2.6 2016-08-13 17:15:03 +02:00
Eduard Braun
3f5c6c76c0 Sync version 2016-08-13 17:14:29 +02:00
Tobias Oberstein
06457a7461 trigger build 2016-07-30 15:21:17 +02:00
Tobias Oberstein
e41893d98f trigger build 2016-07-30 15:17:14 +02:00
Tobias Oberstein
a766a3256b force travis 2016-07-30 13:14:43 +02:00
Tobias Oberstein
c564b89d21 Merge pull request #59 from dirk-thomas/order_attributes_option
add --order-attributes option
2016-07-30 13:02:09 +02:00
Dirk Thomas
371f14786a add --order-attributes option 2016-07-29 10:22:59 -07:00
Tobias Oberstein
8a2d9d604d Merge pull request #57 from Ede123/xml_standalone
Only include "standalone" attribute if it was explicitly set to "yes"
2016-07-25 12:46:45 +02:00
Eduard Braun
f83b03707b Fix unittests for previous commit 2016-06-12 15:42:30 +02:00
Eduard Braun
84b36c7109 Only include "standalone" attribute if it was explicitly set to "yes" in input document ("no" is the default value) 2016-06-12 15:36:02 +02:00
Tobias Oberstein
1a8ece216d Merge pull request #53 from codedread/detect_flowtext
add option to check and warn or bail out on flowtext
2016-04-18 19:01:56 +02:00
Tobias Oberstein
d2faa6bffd Merge pull request #52 from Ede123/travis
Basic implementation for Travis CI
2016-04-03 09:11:06 +02:00
Eduard Braun
6bb2b35ba2 Continuous integration with Travis and tox 2016-04-02 19:30:30 +02:00
Tobias Oberstein
6a23a4cd71 add unit tests 2016-04-02 17:41:20 +02:00
Tobias Oberstein
d710fb3f6c whitespace 2016-04-02 17:40:40 +02:00
Tobias Oberstein
99dc0dfae9 fix opt groups 2016-04-02 17:11:14 +02:00
Tobias Oberstein
b14e801cb7 add option to check and warn or bail out on flowtext 2016-04-02 16:49:10 +02:00
Tobias Oberstein
70e6fb776e Merge pull request #51 from Ede123/fix1
Small fix
2016-04-02 15:22:40 +02:00
Eduard Braun
ea610e5c09 Fix regression in 77906518c0
(accidentally removed default value for  "shorten_ids_prefix")
2016-04-02 01:54:27 +02:00
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