summaryrefslogtreecommitdiff
path: root/templates/base-feed.tt
blob: f36db5ea1bd21a245840d9f5cbcd722c0712407b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
[% USE df = DateTimeFormat('DateTime::Format::Strptime',
   { pattern => '%FT%T',
   locale => 'en_US',
   time_zone => 'GMT' }) -%]
[% USE Dumper -%]
[% tag='';
   IF (matches = path.match('^(?:.*/)?tags/(.*)$'));
    tag = matches.0;
   END;
 
   all_docs=changed.nsortf('last_change');
   docs=[];
   FOR doc IN all_docs;
    NEXT UNLESS isLang(language,doc);
    NEXT IF doc.match('^(?:.*/)?tags/(.*)$');
    IF tag;
     doc_duxml=typedAs(doc,'du.xml');
     IF tagged.$tag.grep(doc_duxml).size == 0; # bad regex...
       NEXT;
     END;
    END;
    docs.push(doc);
   END;
 
   CALL docs.splice(0,-10);
-%]
<?xml version="1.0" encoding="utf-8"?>
<a:feed xmlns:a="http://www.w3.org/2005/Atom">
<a:id>tag:thenautilus.net,2009-08-18:tags/[% tag %]/feed.[% language %].xml</a:id>
[% IF docs.size > 0 -%]
<a:updated>[% l=docs.last;df.format(changed.$l.last_change) %]Z</a:updated>
[% END -%]
[% FOR doc IN docs -%]
<a:entry>
 [% IF changed.$doc.creation %]<a:published>[% df.format(changed.$doc.creation) %]Z</a:published>[% END %]
 [% IF changed.$doc.last_change %]<a:updated>[% df.format(changed.$doc.last_change) %]Z</a:updated>[% END %]
 <a:id>tag:thenautilus.net,2009-08-18:[% atomIdFor(language,filename,dstUriFor(doc,filename)) %]</a:id>
 <a:PH>[% dstUriFor(doc,filename) %]</a:PH>
</a:entry>
[% END -%]
</a:feed>