Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: blogToRSS Arguments: blogName Description: Converts blog-style data to an RSS feed Page type: html Render function: Module: site Page source: <webl> var data = WubCall("%blogName%", []); var title = (data.title ? "Blog Title"); var url = (data.url ? "http://www.wubhub.com:4110/webl/WubHub_DoIt?cmdline=" + "%blogName%"); var desc = (data.description ? "No description"); var aboutURL = "http://www.wubhub.com:4110/webl/WubHub_EditFunction?cmdine=about"; var convertDateTime = fun(dateTime) var df = Wub_GetDateFormatClass(); var dfmed = df.getDateTimeInstance(df.SHORT, df.MEDIUM); var dfshort = df.getDateTimeInstance(df.SHORT, df.SHORT); var dt = (dfmed.parse(dateTime) ? dfshort.parse(dateTime) ? ""); var sdf1 = Wub_SimpleDateFormat("yyyy-MM-dd"); var sdf2 = Wub_SimpleDateFormat("HH:mm:ss"); return sdf1.format(dt) + "T" + sdf2.format(dt) + "Z"; end; /* title=``, postedby=``, when=`12/23/05 05:20:00 AM`, content=`` .], */ var items=""; var itemsdetail=""; every entry in data.entries do var eid = (entry.id ? "id"); var etitle = (entry.title ? "Entry Title"); var ewho = (entry.postedby ? "Author"); var edesc = (entry.content ? "Entry Description"); var ewhen = convertDateTime(entry.when); // 2005-11-07T16:32:44Z var link = `http://www.wubhub.com:4110/webl/WubHub_DoIt?cmdline=blogItem(` + "%blogName%" + "," + ToString(eid) + `)`; items = items + ` <rdf:li rdf:resource="` + link + `" />` + "\n"; itemsdetail= itemsdetail + ` <item rdf:about="` + link + `"> <title><![CDATA[` + etitle + `]]></title> <link>` + link + `</link> <description><![CDATA[` + edesc + `]]> </description> <dc:publisher>No publisher</dc:publisher> <dc:creator>` + ewho + `</dc:creator> <dc:rights /> <dc:date>` + ewhen + `</dc:date> </item> `; end; var res = `<?xml version="1.0" ?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns="http://purl.org/rss/1.0/"> <channel about="` + aboutURL + `"> <title><![CDATA[` + title + `]]></title> <link>` + url + `</link> <description><![CDATA[` + desc + `]]> </description> <image rdf:resource="http://www.wubhub.com:4110/static/wubhub.png" /> <items> <rdf:Seq> ` + items + ` </rdf:Seq> </items> </channel> ` + itemsdetail + ` </rdf:RDF>`; </webl>