sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit b50c0f5b36e9b88367bacb6ca44f4791b8f7eebc
parent de0c78b3da8a37962327cddf7c00389478e106ea
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon,  5 Jan 2015 14:59:58 +0100

sfeed: fix start tags (HTML) in Atom content + style fix

Diffstat:
Msfeed.c | 21+++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/sfeed.c b/sfeed.c @@ -552,9 +552,9 @@ xml_handler_attr(XMLParser *p, const char *tag, size_t taglen, if(ISCONTENTTAG(ctx)) { if(isattr(name, namelen, STRP("type")) && (isattr(value, valuelen, STRP("xhtml")) || - isattr(value, valuelen, STRP("text/xhtml")) || - isattr(value, valuelen, STRP("html")) || - isattr(value, valuelen, STRP("text/html")))) + isattr(value, valuelen, STRP("text/xhtml")) || + isattr(value, valuelen, STRP("html")) || + isattr(value, valuelen, STRP("text/html")))) { ctx.item.contenttype = ContentTypeHTML; ctx.iscontent = 1; @@ -575,16 +575,13 @@ xml_handler_attr(XMLParser *p, const char *tag, size_t taglen, static void xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) { - if(ISCONTENTTAG(ctx)) { - /* starts with div, handle as XML, don't convert entities (set handle to NULL) */ - if(ctx.item.feedtype == FeedTypeAtom && - namelen == STRSIZ("div") && - !strncmp(name, STRP("div"))) { - p->xmldataentity = NULL; - } + /* starts with div, handle as XML, don't convert entities + * (set handler to NULL) */ + if(ISCONTENTTAG(ctx) && ctx.item.feedtype == FeedTypeAtom && + namelen == STRSIZ("div") && !strncmp(name, STRP("div"))) { + p->xmldataentity = NULL; } - /* TODO: changed, iscontenttag can be 0 or 1 ? */ - if(ISINCONTENT(ctx)) { + if(ctx.iscontent) { ctx.attrcount = 0; ctx.iscontenttag = 0; xml_handler_data(p, "<", 1);