Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: REBOL Script to convert REBOL format to RSS XML

From: greggirwin:mindspring at: 31-Dec-2004 0:01

Thanks Carl, CR> There's an RSS validator here... CR> http://feedvalidator.org/ CR> which should tell you when you give it the feed. I think I found CR> TO-IDATE wanting with some Net stuff in the past - may have been CR> RSS. Looks like it wants time values in there, then it's OK. So, here's another real quick rewrite. Carl wants a link to a reader too. Not my area, but he should know about http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=rss.r in addition to others. Not sure on the Apache question. Just an AddType for rss+xml or something? Sunanda? Premshree? I'll leave my contributions here and let someone take the next step(s) for Carl if they would. -- Gregg REBOL [ Title: "RSS Generator for Carl's Blog" Date: 31-Dec-2004 File: %carl-rss.r Home: http://www.livejournal.com/~premshree Author: ["Premshree Pillai" "Gregg Irwin"] Version: 0.0.3 Purpose: {Generate valid RSS 2.0 feeds for Carl's blogs} Comment: { 0.0.2 Massive code changes for instructional purposes. --Gregg 0.0.3 More changes, knowing Carl actually wants to use it. :) --Gregg } ] make-rss-ctx: context [ make-entry: func [series key] [ rejoin [tab to tag! :key series/:key to tag! join #"/" :key newline] ] channel-entries: func [keys [block!] /local result] [ result: copy "" foreach key keys [append result make-entry channel :key] result ] set 'make-rss func [channel items /local output] [ output: copy "" repend output [ <?xml version='1.0' encoding='utf-8' ?> <rss version='2.0'> newline <channel> newline channel-entries [title link description language copyright generator] newline ] foreach item items [ repend output [ tab <item> newline tab make-entry item 'title tab make-entry item 'link tab make-entry item 'description tab tab <guid isPermaLink='true'> item/link </guid> newline tab tab <pubDate> to-idate item/pubdate </pubDate> newline tab </item> newline newline ] ] repend output [</channel> newline </rss>] ] ] ;; Test Code below ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; comment { ;; channel data channel: [ title "Carl's REBOL Blog - Vive la REBOLution" link http://www.rebol.net/ description "describes this blog channel" language "en" ;"English" copyright "2005 Carl Sassenrath" generator "REBOL" ] ;; blog items go here items: [ [ title "Blog item title...." link http://www.rebol.net/cgi-bin/blog.r?view=0080 description "synopsis of the blog goes here" author "Carl Sassenrath" pubdate 30-Dec-2004/23:24:32-7:00 ] [ title "Blog item title 2...." link http://www.rebol.net/cgi-bin/blog.r?view=0081 description "synopsis of the blog goes here" author "Carl Sassenrath" pubdate 31-Dec-2004/23:24:32-7:00 ] ] print make-rss channel items halt ;write %carl-rss2.xml output }