From: Jim Evins Date: Mon, 13 Oct 2003 02:00:10 +0000 (+0000) Subject: Patch #820699: corrects interpretation of Object-text nodes when it consists of... X-Git-Tag: glabels-2_3_0~578 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=07a7b6952d0e27a252e12ef720bbc4d3e43bcd8b;p=glabels Patch #820699: corrects interpretation of Object-text nodes when it consists of a single Field node. Interpretation gets screwed up by the automatic XML indentation. Patch provided by: Emmanuel Pacaud . git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@312 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/src/xml-label.c b/glabels2/src/xml-label.c index 9df777b3..21c19d77 100644 --- a/glabels2/src/xml-label.c +++ b/glabels2/src/xml-label.c @@ -876,12 +876,18 @@ xml_parse_toplevel_span (xmlNodePtr node, for (child = node->xmlChildrenNode; child != NULL; child = child->next) { if (xmlNodeIsText (child)) { - - /* Literal text */ - text_node = g_new0 (glTextNode, 1); - text_node->field_flag = FALSE; - text_node->data = xmlNodeGetContent (child); - text_nodes = g_list_append (text_nodes, text_node); + gchar *data = xmlNodeGetContent (child); + + /* Hack: if the first char is LF, it's a xml formatting string */ + if (data[0] != '\n') { + /* Literal text */ + text_node = g_new0 (glTextNode, 1); + text_node->field_flag = FALSE; + text_node->data = data; + text_nodes = g_list_append (text_nodes, text_node); + } + else + g_free (data); } else if (xmlStrEqual (child->name, "Span")) {