1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

rss: minor cleanups

This commit is contained in:
Jonas Fonseca 2007-08-29 02:15:06 +02:00
parent 19b271e417
commit 16a4110467

View File

@ -50,12 +50,8 @@ dom_rss_push_element(struct dom_stack *stack, struct dom_node *node, void *xxx)
switch (node->data.element.type) { switch (node->data.element.type) {
case RSS_ELEMENT_CHANNEL: case RSS_ELEMENT_CHANNEL:
/* The stack should have: #document * channel */ /* The stack should have: #document * channel */
if (stack->depth != 3) if (stack->depth == 3 && !data->channel)
break;
if (!data->channel) {
data->channel = node; data->channel = node;
}
break; break;
case RSS_ELEMENT_ITEM: case RSS_ELEMENT_ITEM:
@ -66,10 +62,10 @@ dom_rss_push_element(struct dom_stack *stack, struct dom_node *node, void *xxx)
break; break;
#endif #endif
/* ... but be exclusive. */ /* ... but be exclusive. */
if (data->item) if (!data->item) {
break; add_to_dom_node_list(&data->items, node, -1);
add_to_dom_node_list(&data->items, node, -1); data->item = node;
data->item = node; }
break; break;
case RSS_ELEMENT_LINK: case RSS_ELEMENT_LINK:
@ -77,10 +73,8 @@ dom_rss_push_element(struct dom_stack *stack, struct dom_node *node, void *xxx)
case RSS_ELEMENT_TITLE: case RSS_ELEMENT_TITLE:
case RSS_ELEMENT_AUTHOR: case RSS_ELEMENT_AUTHOR:
case RSS_ELEMENT_PUBDATE: case RSS_ELEMENT_PUBDATE:
if (data->node != node->parent) if (data->node == node->parent)
break; data->node = node;
data->node = node;
} }
return DOM_CODE_OK; return DOM_CODE_OK;
@ -120,9 +114,6 @@ dom_rss_pop_element(struct dom_stack *stack, struct dom_node *node, void *xxx)
done_dom_string(&data->text); done_dom_string(&data->text);
data->node = NULL; data->node = NULL;
break; break;
default:
break;
} }
return DOM_CODE_OK; return DOM_CODE_OK;