Hiroyuki Ikezoe
ikezo****@users*****
Tue Dec 5 14:09:35 JST 2006
Index: kazehakase/src/utils/utils.c diff -u kazehakase/src/utils/utils.c:1.60 kazehakase/src/utils/utils.c:1.61 --- kazehakase/src/utils/utils.c:1.60 Mon Dec 4 21:50:43 2006 +++ kazehakase/src/utils/utils.c Tue Dec 5 14:09:35 2006 @@ -145,6 +145,50 @@ gchar * +html_to_text (const gchar *html) +{ + GString *work_string; + guint i=0; + + work_string = g_string_new(NULL); + while (html[i] != '\0') + { + gboolean ignore = FALSE; + if (html[i] == '<') + { + gchar *name = NULL; + if (!g_ascii_strncasecmp(html+i+1, "script", 6)) + { + name = "/script"; + ignore = TRUE; + } + else if (!g_ascii_strncasecmp(html+i+1, "style", 5)) + { + name = "/style"; + ignore = TRUE; + } + while (html[i] != '>' && html[i] != '\0') + i++; + if (ignore) + { + /* ignore until close tag */ + while (html[i] != '<' && html[i] != '\0' && + g_ascii_strncasecmp(html+i+1, name, strlen(name))) + i++; + while (html[i] != '>' && html[i] != '\0') + i++; + } + } + else + g_string_append_c(work_string, html[i]); + i++; + } + + return g_string_free(work_string, FALSE); +} + + +gchar * create_filename_from_uri (const gchar *uri) { gchar *filename; Index: kazehakase/src/utils/utils.h diff -u kazehakase/src/utils/utils.h:1.24 kazehakase/src/utils/utils.h:1.25 --- kazehakase/src/utils/utils.h:1.24 Tue Oct 17 23:28:48 2006 +++ kazehakase/src/utils/utils.h Tue Dec 5 14:09:35 2006 @@ -31,6 +31,7 @@ gboolean key_seems_sequential (const gchar *key, const gchar *prefix); gchar *remove_tag (const gchar *string, gsize len); +gchar *html_to_text (const gchar *string); gchar *create_filename_from_uri (const gchar *uri);