[evolution-rss] Bug 648490 - arXiv rss feeds: from not shown properly
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] Bug 648490 - arXiv rss feeds: from not shown properly
- Date: Sun, 24 Apr 2011 08:15:08 +0000 (UTC)
commit bc5d36cbd9b1c22c5ecbf3a6ebc8ab6a64a0c855
Author: Lucian Langa <lucilanga gnome org>
Date: Sun Apr 24 09:53:13 2011 +0300
Bug 648490 - arXiv rss feeds: from not shown properly
src/parser.c | 29 +++++++++++++++++++++++++++++
src/parser.h | 1 +
2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/parser.c b/src/parser.c
index d74c012..ce9c0ba 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -990,6 +990,30 @@ process_images(gchar *text, gchar *link, gboolean decode, EMFormatHTML *format)
return g_strdup(text);
}
+static void
+saxCharacters (void *user_data, const xmlChar *string, int len)
+{
+ GString *buffer = (GString *)user_data;
+ g_string_append_len(buffer, (gchar *)string, len);
+}
+
+GString*
+rss_strip_html (gchar *string)
+{
+ htmlParserCtxtPtr ctxt;
+ htmlSAXHandlerPtr sax;
+ GString *buffer = g_string_new(NULL);
+
+ sax = g_new0 (htmlSAXHandler, 1);
+ sax->characters = saxCharacters;
+ ctxt = htmlCreatePushParserCtxt
+ (sax, buffer, string, strlen (string), "", XML_CHAR_ENCODING_UTF8);
+ htmlParseChunk (ctxt, string, 0, 1);
+ htmlFreeParserCtxt (ctxt);
+ g_free (sax);
+ return buffer;
+}
+
create_feed *
parse_channel_line(xmlNode *top, gchar *feed_name, RDF *r, gchar **article_uid)
{
@@ -1077,6 +1101,11 @@ parse_channel_line(xmlNode *top, gchar *feed_name, RDF *r, gchar **article_uid)
q = g_strdup(layer_find (top, "author",
layer_find (top, "creator", NULL))); //this catches dc:creator too. wrong!
}
+ if (q) {
+ GString *s = rss_strip_html(q);
+ q = s->str;
+ g_string_free(s, 0);
+ }
//we might end with a subject containing nothing but spaces
if (q) g_strstrip (q);
diff --git a/src/parser.h b/src/parser.h
index 12d66c7..20c8c9a 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -34,6 +34,7 @@ void display_channel_items (RDF *r,
gpointer user_data);
xmlDoc *rss_html_url_decode(const char *html, int len);
+GString *rss_strip_html (gchar *string);
const char *layer_find (xmlNodePtr node,
const char *match,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]