lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Sputnik (http://sputnik.freewisdom.org/) generates RSS for changes to
wiki pages.  The relevant code is:

1. A template library called "Cosmo" (http://sputnik.freewisdom.org/en/Cosmo)

2. A Cosmo template for RSS 2.0:

RSS = [====[<rss version="2.0">
 <channel>
  <title>$title</title>
  <description/>
   <link>$baseurl</link>
     $items[[
      <item>
       <link>$link</link>
       <title>$title</title>
       <guid isPermalink="$ispermalink">$guid</guid>
       <description>$summary</description>
      </item>]]
 </channel>
</rss>
]====]

3. Code that fills it with the appropriate content (somewhat
simplified from the actual Sputnik usage):

   return cosmo.fill(templates.RSS, {
      title   = "My RSS Feed",
      baseurl = MY_BASE_URL,
      items   = function()
         for i, page in ipairs(recently_changed_pages) do
            cosmo.yield{
               link = page.url,
               title = page.title.." change by "..page.author,
               ispermalink = "false",
               guid = page.name .. "/" .. page.version,
               summary = page.summary
            }
         end
      end,
   }), "application/rss+xml"

 - yuri


On Nov 29, 2007 5:27 PM, Norman Ramsey <nr@eecs.harvard.edu> wrote:
> I'm interested in creating my own RSS feed by automatically
> selecting certain of my incoming email messages and putting them on
> the web.  I'd like also to maintain an RSS file that would make
> it easy to spot these new messages using a mobile device.
> Kepler would seem to be very well suited to this task, but
> my XML skills are rusty.  Has anybody tried to create RSS
> from Lua?  Are you willing to share code?
>
> How is http://www.lua.org/rss.html created?
>
>
> Norman
>



-- 
Yuri Takhteyev
Ph.D. Candidate, UC Berkeley School of Information
http://takhteyev.org/, http://www.freewisdom.org/