Merge pull request #57 from Ede123/xml_standalone
Only include "standalone" attribute if it was explicitly set to "yes"
This commit is contained in:
commit
8a2d9d604d
2 changed files with 6 additions and 3 deletions
|
|
@ -3090,7 +3090,10 @@ def scourString(in_string, options=None):
|
||||||
|
|
||||||
# return the string with its XML prolog and surrounding comments
|
# return the string with its XML prolog and surrounding comments
|
||||||
if options.strip_xml_prolog == False:
|
if options.strip_xml_prolog == False:
|
||||||
total_output = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'
|
total_output = '<?xml version="1.0" encoding="UTF-8"'
|
||||||
|
if doc.standalone:
|
||||||
|
total_output += ' standalone="yes"'
|
||||||
|
total_output += '?>\n'
|
||||||
else:
|
else:
|
||||||
total_output = ""
|
total_output = ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1031,7 +1031,7 @@ class DoNotPrettyPrintWhenWhitespacePreserved(unittest.TestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
with open('unittests/whitespace-important.svg') as f:
|
with open('unittests/whitespace-important.svg') as f:
|
||||||
s = scour.scourString(f.read()).splitlines()
|
s = scour.scourString(f.read()).splitlines()
|
||||||
c = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
c = '''<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg">
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
<text xml:space="preserve">This is some <tspan font-style="italic">messed-up</tspan> markup</text>
|
<text xml:space="preserve">This is some <tspan font-style="italic">messed-up</tspan> markup</text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
@ -1044,7 +1044,7 @@ class DoNotPrettyPrintWhenNestedWhitespacePreserved(unittest.TestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
with open('unittests/whitespace-nested.svg') as f:
|
with open('unittests/whitespace-nested.svg') as f:
|
||||||
s = scour.scourString(f.read()).splitlines()
|
s = scour.scourString(f.read()).splitlines()
|
||||||
c = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
c = '''<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg">
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
<text xml:space="preserve"><tspan font-style="italic">Use <tspan font-style="bold">bold</tspan> text</tspan></text>
|
<text xml:space="preserve"><tspan font-style="italic">Use <tspan font-style="bold">bold</tspan> text</tspan></text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue