Merge pull request #57 from Ede123/xml_standalone

Only include "standalone" attribute if it was explicitly set to "yes"
This commit is contained in:
Tobias Oberstein 2016-07-25 12:46:45 +02:00 committed by GitHub
commit 8a2d9d604d
2 changed files with 6 additions and 3 deletions

View file

@ -3090,7 +3090,10 @@ def scourString(in_string, options=None):
# return the string with its XML prolog and surrounding comments
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:
total_output = ""

View file

@ -1031,7 +1031,7 @@ class DoNotPrettyPrintWhenWhitespacePreserved(unittest.TestCase):
def runTest(self):
with open('unittests/whitespace-important.svg') as f:
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">
<text xml:space="preserve">This is some <tspan font-style="italic">messed-up</tspan> markup</text>
</svg>
@ -1044,7 +1044,7 @@ class DoNotPrettyPrintWhenNestedWhitespacePreserved(unittest.TestCase):
def runTest(self):
with open('unittests/whitespace-nested.svg') as f:
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">
<text xml:space="preserve"><tspan font-style="italic">Use <tspan font-style="bold">bold</tspan> text</tspan></text>
</svg>