Handle multiline text by splitting into "flowPara"s

This commit is contained in:
Adam Goldsmith 2017-07-13 23:22:19 -04:00
parent a4c65413da
commit 31868b3bf9

View File

@ -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)