diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-07-20 08:03:57 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-07-20 08:03:57 +0000 |
commit | e2a169b856d1954c5cd38c4dd47cbb7a68afe41c (patch) | |
tree | 7edcda4e9455f7e6dcccecace1e2dcedfba5beb8 | |
parent | 0a0bc26c836bfa0f82f26b8d6c9534ac058a32a7 (diff) |
supported <br/> HTML tag.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2927 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | libsylph/html.c | 18 |
2 files changed, 18 insertions, 5 deletions
@@ -1,3 +1,8 @@ +2011-07-20 + + * libsylph/html.c: html_get_tag(): support tags such as <br/> and + <name value="foo" />. + 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; } |