Handle multiline text by splitting into "flowPara"s
This commit is contained in:
parent
a4c65413da
commit
31868b3bf9
@ -23,7 +23,11 @@ def setText(tree, id, text):
|
|||||||
print("id", id, "not found")
|
print("id", id, "not found")
|
||||||
return
|
return
|
||||||
elif element.tag == "{http://www.w3.org/2000/svg}flowRoot":
|
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:
|
else:
|
||||||
element[0].text = str(text)
|
element[0].text = str(text)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user