From 31868b3bf92753d568b5a649c5dfc957ead30639 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Thu, 13 Jul 2017 23:22:19 -0400 Subject: [PATCH] Handle multiline text by splitting into "flowPara"s --- SotMDeckBuilder.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SotMDeckBuilder.py b/SotMDeckBuilder.py index a21f3cf..2692d9f 100755 --- a/SotMDeckBuilder.py +++ b/SotMDeckBuilder.py @@ -23,7 +23,11 @@ def setText(tree, id, text): print("id", id, "not found") return elif element.tag == "{http://www.w3.org/2000/svg}flowRoot": - element.find("{http://www.w3.org/2000/svg}flowPara").text = text + for e in element.findall("{http://www.w3.org/2000/svg}flowPara"): + element.remove(e) # clear child paragraphs + lines = str(text).splitlines() + for line in lines: + etree.SubElement(element, "{http://www.w3.org/2000/svg}flowPara").text=line else: element[0].text = str(text)