Added --enable-viewboxing option and stop setting width/height to 100% by default
This commit is contained in:
parent
8caa66edf9
commit
22fd47ab23
4 changed files with 17 additions and 4 deletions
|
|
@ -3,5 +3,5 @@ mkdir $1
|
|||
for FILE in `ls fulltests`
|
||||
do
|
||||
echo Doing $FILE:
|
||||
./scour.py -i fulltests/$FILE -o $1/$FILE 2>> $1/report.txt
|
||||
python ./scour.py -i fulltests/$FILE -o $1/$FILE 2>> $1/report.txt
|
||||
done
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
<p>TBD</p>
|
||||
<ul>
|
||||
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/482215">Bug 482215</a> by using os.linesep to end lines</li>
|
||||
<li>Fix unittests to run properly in Windows</li>
|
||||
<li>Removed default scaling of image to 100%/100% and creating a viewBox. Added --enable-viewboxing option to explicitly turn that on</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
15
scour.py
15
scour.py
|
|
@ -63,8 +63,15 @@ except ImportError:
|
|||
from fixedpoint import *
|
||||
Decimal = FixedPoint
|
||||
|
||||
# Import Psyco if available
|
||||
try:
|
||||
import psyco
|
||||
psyco.full()
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
APP = 'scour'
|
||||
VER = '0.22'
|
||||
VER = '0.23'
|
||||
COPYRIGHT = 'Copyright Jeff Schiller, 2009'
|
||||
|
||||
NS = { 'SVG': 'http://www.w3.org/2000/svg',
|
||||
|
|
@ -2266,7 +2273,8 @@ def scourString(in_string, options=None):
|
|||
embedRasters(elem, options)
|
||||
|
||||
# properly size the SVG document (ideally width/height should be 100% with a viewBox)
|
||||
properlySizeDoc(doc.documentElement)
|
||||
if options.viewboxing:
|
||||
properlySizeDoc(doc.documentElement)
|
||||
|
||||
# output the document as a pretty string with a single space for indent
|
||||
# NOTE: removed pretty printing because of this problem:
|
||||
|
|
@ -2340,6 +2348,9 @@ _options_parser.add_option("--keep-editor-data",
|
|||
_options_parser.add_option("--strip-xml-prolog",
|
||||
action="store_true", dest="strip_xml_prolog", default=False,
|
||||
help="won't output the <?xml ?> prolog")
|
||||
_options_parser.add_option("--enable-viewboxing",
|
||||
action="store_true", dest="viewboxing", default=False,
|
||||
help="changes document width/height to 100%/100% and creates viewbox coordinates")
|
||||
|
||||
# GZ: this is confusing, most people will be thinking in terms of
|
||||
# decimal places, which is not what decimal precision is doing
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class ScourOptions:
|
|||
keep_editor_data = False
|
||||
strip_xml_prolog = False
|
||||
indent_type = "space"
|
||||
viewboxing = False
|
||||
|
||||
class NoInkscapeElements(unittest.TestCase):
|
||||
def runTest(self):
|
||||
|
|
@ -829,7 +830,6 @@ class RemoveDefaultGradFYValue(unittest.TestCase):
|
|||
class CDATAInXml(unittest.TestCase):
|
||||
def runTest(self):
|
||||
lines = scour.scourString(open('unittests/cdata.svg').read()).splitlines()
|
||||
print lines[4]
|
||||
self.assertEquals( lines[3],
|
||||
" alert('pb&j');",
|
||||
'CDATA did not come out correctly')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue