From 2200f8dc819c4a330b49050569fb8aa0b01ff574 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 2 Jul 2018 01:05:54 +0200 Subject: [PATCH] temp --- scour/scour.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scour/scour.py b/scour/scour.py index 08027b8..000142d 100644 --- a/scour/scour.py +++ b/scour/scour.py @@ -3359,7 +3359,10 @@ def serializeXML(element, options, indent_depth=0, preserveWhitespace=False): # As a workaround for inconsistent handling of renderers keep newlines if they were in the original if element.nodeName in ['text', 'tspan', 'tref', 'textPath', 'altGlyph']: text_content = text_content.replace('\t', ' ') - text_content = text_content.strip(' ') + if child == element.firstChild: + text_content = text_content.lstrip() + elif child == element.lastChild: + text_content = text_content.rstrip() while ' ' in text_content: text_content = text_content.replace(' ', ' ') else: