Well, nobody uses RSS anymore :-) so here is an experimental patch to
add ATOM support (just replace a=rss by a=atom in the URL, I did not
add a button yet).
New patches:

[ATOM support for syndication
[EMAIL PROTECTED] {
hunk ./darcsweb.cgi 23
+iso_datetime = '%Y-%m-%dT%H:%M:%SZ'
hunk ./darcsweb.cgi 1718
+def do_atom():
+       print "Content-type: application/atom+xml; charset=utf-8\n"
+       print '<?xml version="1.0" encoding="utf-8"?>'
+       inv = config.repodir + '/_darcs/inventory'
+       repo_lastmod = os.stat(inv).st_mtime
+       print """<feed xmlns="http://www.w3.org/2005/Atom";>
+  <title>%(reponame)s darcs repository</title>
+  <link rel="alternate" type="text/html" href="%(url)s"/>
+  <link rel="self" type="application/atom+xml" 
href="%(url)s/%(reponame)s;a=atom"/>
+  <id>%(url)s</id> <!-- TODO: find a better <id>, see RFC 4151 -->
+  <author><name>darcs repository (several authors)</name></author>
+  <generator>darcsweb.cgi</generator>
+  <updated>%(lastmod)s</updated> 
+  <subtitle>%(desc)s</subtitle>
+       """ % {
+               'reponame': config.reponame,
+               'url': config.myurl + '/' + config.myreponame,
+               'desc': config.repodesc,
+               'lastmod':      time.strftime(iso_datetime, 
time.localtime(repo_lastmod))}
+       ps = get_last_patches(20)
+       for p in ps:
+               title = time.strftime('%d %b %H:%M', time.localtime(p.date))
+               title += ' - ' + p.name
+               pdate = time.strftime(iso_datetime,
+                               time.localtime(p.date))
+               link = '%s/%s;a=commit;h=%s' % (config.myurl,
+                               config.myreponame, p.hash)
hunk ./darcsweb.cgi 1746
+               print """
+  <entry>
+    <title>%(title)s</title>
+    <author><name>%(author)s</name><!-- TODO: parse it to get the email. Not 
obvious, darcs authors can be anything --></author>
+    <updated>%(pdate)s</updated>
+    <id>%(url)s/%(pname)s</id> <!-- TODO: find a better <id>, see RFC 4151 -->
+    <link rel="alternate" href="%(link)s"/>
+    <summary>%(desc)s</summary>
+               """ % {
+                       'title': escape(title),
+                       'author': p.author,
+                       'url': config.myurl + '/' + config.myreponame,
+                       'pdate': pdate,
+                       'pname': escape(p.name),
+                       'link': link,
+                       'desc': escape(p.name),
+               }
+                # TODO: allow to get plain text, not HTML?
+               print '    <content type="xhtml"><div 
xmlns="http://www.w3.org/1999/xhtml";><p>'
+               print escape(p.name) + '<br/>'
+               if p.comment:
+                       print '<br/>'
+                       print escape(p.comment).replace('\n', '<br/>\n')
+                       print '<br/>'
+               print '<br/>'
+               changed = p.adds + p.removes + p.modifies.keys() + \
+                               p.moves.keys() + p.diradds + p.dirremoves + \
+                               p.replaces.keys()
+               for i in changed: # TODO: link to the file 
+                       print '<code>%s</code><br/>' % i
+               print '</p></div>'
+               print '</content></entry>'
+       print '</feed>'
+       
hunk ./darcsweb.cgi 2191
+
+elif action == 'atom':
+       do_atom()
}

Context:

[fixu8: honour config.repoencoding when decoding characters like [_\e3]
Kirill Smelkov <[EMAIL PROTECTED]>**20051130113626] 
[another basic validation issue
Alexandre Rossi <[EMAIL PROTECTED]>**20051112235916
 The issue was that there was an empty line before the XML declaration, which
 is not valid.
] 
[Make how_old() return a fixed date when caching is enabled.
Alberto Bertogli <[EMAIL PROTECTED]>**20051117144133
 
 how_old() becomes a problem when we have a cache, because the relative dates
 will get stalled in the cache.
 
 This is makes a workaround by making how_old() return a string containing the
 fixed date, which isn't quite nice but it will do the trick until a better
 solution comes up.
] 
[Don't close the file in a cache miss.
Alberto Bertogli <[EMAIL PROTECTED]>**20051117144027] 
[Call cache.cancel() only if we have a cache.
Alberto Bertogli <[EMAIL PROTECTED]>**20051117032757] 
[Implement a simple cache.
Alberto Bertogli <[EMAIL PROTECTED]>**20051117031028
 
 This patch implements a very simple but effective cache, so darcsweb can avoid
 regenerating everything all the time.
 
 Based on an idea from Alexandre Rossi.
] 
[Use a more human-friendly format por list configuration variables.
Leandro Lucarella <[EMAIL PROTECTED]>**20051110152239] 
[Highlight tags in the shortlog/summary.
Alberto Bertogli <[EMAIL PROTECTED]>**20051110003434] 
[Add exclusion lists to multidir configuration.
Alberto Bertogli <[EMAIL PROTECTED]>**20051109235947] 
[TAG 0.12
Alberto Bertogli <[EMAIL PROTECTED]>**20051109011031] 
Patch bundle hash:
600f074c8be70600b72df15a6f73dca98c6543fd
_______________________________________________
darcs-users mailing list
[email protected]
http://www.abridgegame.org/mailman/listinfo/darcs-users

Reply via email to