Comparison

mod_pubsub_feeds/feeds.lib.lua @ 2378:649f733aa3dc

mod_pubsub_feeds/feeds.lib: Fix converting RSS items to more than one Atom entry (thanks walduhu)
author Kim Alvefur <zash@zash.se>
date Sat, 19 Nov 2016 18:48:49 +0100
parent 2133:85762420a2c0
child 4427:c402b273f2e3
comparison
equal deleted inserted replaced
2377:02532f28b207 2378:649f733aa3dc
62 -- Translate a single item to atom 62 -- Translate a single item to atom
63 local function translate_rss(rss_feed) 63 local function translate_rss(rss_feed)
64 local feed = st.stanza("feed", { xmlns = "http://www.w3.org/2005/Atom" }); 64 local feed = st.stanza("feed", { xmlns = "http://www.w3.org/2005/Atom" });
65 local channel = rss_feed:get_child("channel"); 65 local channel = rss_feed:get_child("channel");
66 -- TODO channel properties 66 -- TODO channel properties
67 feed:tag("entry");
68 for item in channel:childtags("item") do 67 for item in channel:childtags("item") do
68 feed:tag("entry");
69 for tag in item:childtags() do 69 for tag in item:childtags() do
70 local translator = rss2atom[tag.name]; 70 local translator = rss2atom[tag.name];
71 if translator then 71 if translator then
72 translator(feed, tag); 72 translator(feed, tag);
73 end 73 end
74 end 74 end
75 feed:reset();
75 end 76 end
76 feed:reset();
77 return feed; 77 return feed;
78 end 78 end
79 79
80 return { translate_rss = translate_rss } 80 return { translate_rss = translate_rss }