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

Upstream-Status: Submitted [https://github.com/itstool/itstool/pull/57]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 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)
-- 
2.49.0

