From e2a169b856d1954c5cd38c4dd47cbb7a68afe41c Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 20 Jul 2011 08:03:57 +0000 Subject: supported
HTML tag. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2927 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 5 +++++ libsylph/html.c | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed21c127..ee6cd97f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-07-20 + + * libsylph/html.c: html_get_tag(): support tags such as
and + . + 2011-07-05 * libsylph/procmsg.c: use memory mapped file to read cache files. diff --git a/libsylph/html.c b/libsylph/html.c index 74d07c55..e61ea7cf 100644 --- a/libsylph/html.c +++ b/libsylph/html.c @@ -368,16 +368,20 @@ static HTMLTag *html_get_tag(const gchar *str) if (*str == '\0' || *str == '!') return NULL; - Xstrdup_a(tmp, str, return NULL); + tmp = g_strdup(str); tag = g_new0(HTMLTag, 1); - for (tmpp = tmp; *tmpp != '\0' && !g_ascii_isspace(*tmpp); tmpp++) - ; + for (tmpp = tmp; *tmpp != '\0' && !g_ascii_isspace(*tmpp); tmpp++) { + if (tmpp > tmp && *tmpp == '/') { + *tmpp = '\0'; + break; + } + } if (*tmpp == '\0') { g_strdown(tmp); - tag->name = g_strdup(tmp); + tag->name = tmp; return tag; } else { *tmpp++ = '\0'; @@ -393,6 +397,8 @@ static HTMLTag *html_get_tag(const gchar *str) gchar quote; while (g_ascii_isspace(*tmpp)) tmpp++; + if (tmpp > tmp && *tmpp == '/') + break; attr_name = tmpp; while (*tmpp != '\0' && !g_ascii_isspace(*tmpp) && @@ -414,7 +420,7 @@ static HTMLTag *html_get_tag(const gchar *str) attr_value = tmpp; if ((p = strchr(attr_value, quote)) == NULL) { g_warning("html_get_tag(): syntax error in tag: '%s'\n", str); - return tag; + break; } tmpp = p; *tmpp++ = '\0'; @@ -437,6 +443,8 @@ static HTMLTag *html_get_tag(const gchar *str) tag->attr = g_list_append(tag->attr, attr); } + g_free(tmp); + return tag; } -- cgit v1.2.3