sdtui: further improve the XML mangler

Comments should be more or less reliably handled by GMarkup now.
This commit is contained in:
Přemysl Eric Janouch 2021-10-11 06:29:20 +02:00
parent ce2b8b39c0
commit 6f569e076e
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -353,8 +353,10 @@ view_entry_split_add_xdxf (ViewEntry *ve, const gchar *xml)
GString *filtered = g_string_new ("");
while (*xml)
{
// GMarkup can read some of the wilder XML constructs, Pango skips them
const gchar *p = NULL;
if (*xml != '<' || !*(p = xml + 1 + (xml[1] == '/'))
if (*xml != '<' || xml[1] == '!' || xml[1] == '?'
|| g_ascii_isspace (xml[1]) || !*(p = xml + 1 + (xml[1] == '/'))
|| (strchr ("biu", *p) && p[1] == '>') || !(p = strchr (p, '>')))
g_string_append_c (filtered, *xml++);
else if (xml[1] != 'k' || xml[2] != '>' || !(xml = strstr (p, "</k>")))