On Fri, Mar 20, 2009 at 11:37 AM, Niels Mayer <nielsmayer@gmail.com> wrote:
Finally, it would be nice if there was a more-useful-for-use-in-velocity version of {rss:feed} something that just generated the feed as an abstract "iterator" and then let you pull out fields as strings, and then decorate them as you wish in velocity&html, e.g. via #beginfeedbox() #endfeedbox() and #feedbox-item() in the example/wish below:
#set( $feeds = $xwiki.getFeed("http://kcrw.com/podcast/show/ww") #beginfeedbox() #foreach ($f in $feeds) #feedbox-item ($f.title , !$f.date, !$f.description , !$f.link ) #end #endfeedbox()
Answering my own question, you can do the kind of things I asked for like this in Velocity and Xwiki: http://nielsmayer.com/xwiki/bin/view/Timeline/KcrwFeeds2?viewer=code which when wrapped in http://nielsmayer.com/xwiki/bin/view/Timeline/TL3?viewer=code gives: http://nielsmayer.com/xwiki/bin/view/Timeline/TL3 (warning, takes a long time to load). With the RSS code looking like this: {pre} <data> #set( $allcasts = [["http://kcrw.com/podcast/show/at","Crimson"], ["http://kcrw.com/podcast/show/bw","Cyan"], ["http://kcrw.com/podcast/show/de","DarkBlue"], ["http://kcrw.com/podcast/show/fr","DarkCyan"], ["http://kcrw.com/podcast/show/gg","DarkGoldenRod"], ["http://kcrw.com/podcast/show/gf","DarkGray"], ["http://kcrw.com/podcast/show/gd","DarkGreen"], ["http://kcrw.com/podcast/show/lo","DarkKhaki"], ["http://kcrw.com/podcast/show/lr","DarkMagenta"], ["http://kcrw.com/podcast/show/ls","DarkOliveGreen"], ["http://kcrw.com/podcast/show/ma","Darkorange"], ["http://kcrw.com/podcast/show/mb","DarkOrchid"], ["http://kcrw.com/podcast/show/ob","DarkRed"], ["http://kcrw.com/podcast/show/so","DarkSalmon"], ["http://kcrw.com/podcast/show/th","DarkSeaGreen"], ["http://kcrw.com/podcast/show/tb","DarkSlateBlue"], ["http://kcrw.com/podcast/show/bb","DarkSlateGray"], ["http://kcrw.com/podcast/show/pc","DarkTurquoise"], ["http://kcrw.com/podcast/show/ts","DarkViolet"], ["http://kcrw.com/podcast/show/tt","DeepPink"], ["http://kcrw.com/podcast/show/ur","DeepSkyBlue"], ["http://kcrw.com/podcast/show/tu","DimGray"], ["http://kcrw.com/podcast/show/tp","DodgerBlue"], ["http://kcrw.com/podcast/show/ti","ForestGreen"], ["http://kcrw.com/podcast/show/ww","Fuchsia"]] ) #set( $openTab = $xwiki.getXMLEncoded("<TABLE><TBODY>") ) #set( $closeTab = $xwiki.getXMLEncoded("</TBODY></TABLE>") ) #set( $openDesc = $xwiki.getXMLEncoded("<TR><TH>") ) #set( $closeDescOpenVal = $xwiki.getXMLEncoded("</TH><TD>") ) #set( $closeVal = $xwiki.getXMLEncoded("</TD></TR>") ) #set( $openA = $xwiki.getXMLEncoded("<A ") ) #set( $endA = $xwiki.getXMLEncoded(">") ) #set( $closeA = $xwiki.getXMLEncoded("</A>") ) #foreach ($feed in $allcasts) ##{ #set( $feed_obj = $xwiki.feed.getFeed($feed.get(0)) ) #set( $feed_title = $xwiki.getXMLEncoded($feed_obj.getTitle()) ) #set( $feed_link = $xwiki.getXMLEncoded($feed_obj.getLink()) ) #foreach($entry in ${feed_obj.entries}) ##{ #set( $entry_link = $xwiki.getXMLEncoded(${entry.link}) ) #set( $entry_desc = $xwiki.getXMLEncoded(${entry.description.value}) ) <event start="$entry.getPublishedDate().toLocaleString()" title="$xwiki.getXMLEncoded($entry.title)" color="$feed.get(1)" textColor="$feed.get(1)"> ${openTab} ${openDesc}Feed: ${closeDescOpenVal}${feed_title}${closeVal} ${openDesc}Link: ${closeDescOpenVal}${openA}href=’${feed_link}’ target=’_blank’${endA}${feed_link}${closeA}${closeVal} ${openDesc}Media: ${closeDescOpenVal}${openA}href=’${entry_link}’ target=’_blank’${endA}${entry_link}${closeA}${closeVal} ${openDesc}${closeDescOpenVal}${entry_desc}${closeVal} ${closeTab} </event> #end ##} #end ##} </data> {/pre} -- Niels http:nielsmayer.com