");
++
++ g_string_append_len (str, text, text_len);
++
++ if (helper->is_code_text)
++ g_string_append (str, "
");
++ if (helper->is_em_text)
++ g_string_append (str, "");
++
++ data->cdata = as_ref_string_new_with_length (str->str, str->len);
++ return;
+ }
++
++ data->cdata = as_ref_string_new_with_length (text, text_len);
+ }
+
+ static void
+@@ -790,7 +846,7 @@
+ AsNodeFromXmlFlags flags,
+ GError **error)
+ {
+- AsNodeToXmlHelper helper;
++ AsNodeToXmlHelper helper = {0};
+ AsNode *root = NULL;
+ gboolean ret;
+ g_autoptr(GError) error_local = NULL;
+@@ -927,7 +983,7 @@
+ GCancellable *cancellable,
+ GError **error)
+ {
+- AsNodeToXmlHelper helper;
++ AsNodeToXmlHelper helper = {0};
+ GError *error_local = NULL;
+ AsNode *root = NULL;
+ const gchar *content_type = NULL;
+diff -Nru appstream-glib-0.7.18/libappstream-glib/as-self-test.c appstream-glib-0.7.18/libappstream-glib/as-self-test.c
+--- appstream-glib-0.7.18/libappstream-glib/as-self-test.c 2020-09-07 11:20:43.896573000 +0100
++++ appstream-glib-0.7.18/libappstream-glib/as-self-test.c 2023-06-07 20:58:11.000000000 +0100
+@@ -2861,6 +2861,20 @@
+ ""
+ ""
++ "It now also supports em and code
tags."
++ "
Emphasis at the start of the paragraph
" ++ "" ++ "
empty emphasis
" ++ "code
tags.");
++ as_node_unref (root);
++
++ root = as_node_from_xml (valid_em_code_2, 0, &error);
++ g_assert_no_error (error);
++ g_assert (root != NULL);
++
++ n2 = as_node_find (root, "description/p");
++ g_assert (n2 != NULL);
++ g_assert_cmpstr (as_node_get_data (n2), ==, "Emphasis at the start of the paragraph");
++ as_node_unref (root);
++
++ root = as_node_from_xml (valid_em_code_empty, 0, &error);
++ g_assert_no_error (error);
++ g_assert (root != NULL);
++
++ n2 = as_node_find (root, "description/p");
++ g_assert (n2 != NULL);
++ g_assert_cmpstr (as_node_get_data (n2), ==, NULL);
++ as_node_unref (root);
++
++ root = as_node_from_xml (valid_em_code_empty_2, 0, &error);
++ g_assert_no_error (error);
++ g_assert (root != NULL);
++
++ n2 = as_node_find (root, "description/p");
++ g_assert (n2 != NULL);
++ g_assert_cmpstr (as_node_get_data (n2), ==, "empty emphasis");
++ as_node_unref (root);
++
+ /* keep comments */
+ root = as_node_from_xml (valid,
+ AS_NODE_FROM_XML_FLAG_KEEP_COMMENTS,
diff --git a/SPECS/libappstream-glib.spec b/SPECS/libappstream-glib.spec
index f9e1dfe..5614159 100644
--- a/SPECS/libappstream-glib.spec
+++ b/SPECS/libappstream-glib.spec
@@ -6,11 +6,14 @@
Summary: Library for AppStream metadata
Name: libappstream-glib
Version: 0.7.18
-Release: 4%{?dist}
+Release: 5%{?dist}
License: LGPLv2+
URL: http://people.freedesktop.org/~hughsient/appstream-glib/
Source0: http://people.freedesktop.org/~hughsient/appstream-glib/releases/appstream-glib-%{version}.tar.xz
+# backported from upstream
+Patch0: 0001-Improve-handling-of-em-and-code-tags.patch
+
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: docbook-utils
BuildRequires: gtk-doc
@@ -131,6 +134,10 @@ from a directory of packages.
%{_mandir}/man1/appstream-builder.1.gz
%changelog
+* Fri Apr 26 2024 Richard Hughes