From 0d79db8eacc6787b397caa34f0d849afec52c582 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 27 May 2025 20:15:56 +0200
Subject: [PATCH] Rewrite remaining call to `addContent`

---
 itstool.in | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/itstool.in b/itstool.in
index 4c39660..78887ca 100755
--- a/itstool.in
+++ b/itstool.in
@@ -791,7 +791,16 @@ class Document (object):
             if val is not None:
                 if not PY3:
                     val = val.encode('utf-8')
-                parent.addContent(val)
+                if len(parent):
+                    if parent[-1].tail:
+                        parent[-1].tail += val
+                    else:
+                        parent[-1].tail = val
+                else:
+                    if parent.text:
+                        parent.text += val
+                    else:
+                        parent.text = val
         else:
             newnode = parent.makeelement(node.tag, node.attrib)
             parent.append(newnode)
