Accept [[!inline ... atomid="..."]] and use it to populate the feed's Atom <id>.
authorSimon McVittie <http://smcv.pseudorandom.co.uk/>
Sat, 12 Jul 2008 14:20:28 +0000 (15:20 +0100)
committerSimon McVittie <http://smcv.pseudorandom.co.uk/>
Sat, 12 Jul 2008 16:09:41 +0000 (17:09 +0100)
This is often the same as the feed's <link> (in which case it can be omitted) but sometimes it's a urn:uuid: URN instead.

IkiWiki/Plugin/inline.pm
templates/atompage.tmpl

index 02c04cc003e4886414b48afc8e2e60b87f385c9a..802fae93a4a68a73850c8c79721f401698a5261a 100644 (file)
@@ -308,7 +308,7 @@ sub preprocess_inline (@) { #{{{
                        if (! $params{preview}) {
                                writefile($rssp, $config{destdir},
                                        genfeed("rss",
                        if (! $params{preview}) {
                                writefile($rssp, $config{destdir},
                                        genfeed("rss",
-                                               $config{url}."/".rsspage($params{destpage}).$feednum, $desc, $params{destpage}, @feedlist));
+                                               $config{url}."/".rsspage($params{destpage}).$feednum, $desc, $params{atomid}, $params{destpage}, @feedlist));
                                $toping{$params{destpage}}=1 unless $config{rebuild};
                                $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />};
                        }
                                $toping{$params{destpage}}=1 unless $config{rebuild};
                                $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />};
                        }
@@ -318,7 +318,7 @@ sub preprocess_inline (@) { #{{{
                        will_render($params{destpage}, $atomp);
                        if (! $params{preview}) {
                                writefile($atomp, $config{destdir},
                        will_render($params{destpage}, $atomp);
                        if (! $params{preview}) {
                                writefile($atomp, $config{destdir},
-                                       genfeed("atom", $config{url}."/".atompage($params{destpage}).$feednum, $desc, $params{destpage}, @feedlist));
+                                       genfeed("atom", $config{url}."/".atompage($params{destpage}).$feednum, $desc, $params{atomid}, $params{destpage}, @feedlist));
                                $toping{$params{destpage}}=1 unless $config{rebuild};
                                $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/atom+xml" title="Atom" href="$atomurl" />};
                        }
                                $toping{$params{destpage}}=1 unless $config{rebuild};
                                $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/atom+xml" title="Atom" href="$atomurl" />};
                        }
@@ -411,10 +411,11 @@ sub atompage ($) { #{{{
        return targetpage(shift, "atom");
 } #}}}
 
        return targetpage(shift, "atom");
 } #}}}
 
-sub genfeed ($$$$@) { #{{{
+sub genfeed ($$$$$@) { #{{{
        my $feedtype=shift;
        my $feedurl=shift;
        my $feeddesc=shift;
        my $feedtype=shift;
        my $feedurl=shift;
        my $feeddesc=shift;
+       my $atomid=shift;
        my $page=shift;
        my @pages=@_;
        
        my $page=shift;
        my @pages=@_;
        
@@ -484,6 +485,7 @@ sub genfeed ($$$$@) { #{{{
                pageurl => $url,
                content => $content,
                feeddesc => $feeddesc,
                pageurl => $url,
                content => $content,
                feeddesc => $feeddesc,
+               atomid => $atomid,
                feeddate => date_3339($lasttime),
                feedurl => $feedurl,
                version => $IkiWiki::version,
                feeddate => date_3339($lasttime),
                feedurl => $feedurl,
                version => $IkiWiki::version,
index b7ba74f47ba8506473b5f9dd37c8766b7bc93e10..9ec7df435b3be286a82f30c771c9ec3a1ef0bc4a 100644 (file)
   </rights>
  </TMPL_IF>
 </TMPL_IF>
   </rights>
  </TMPL_IF>
 </TMPL_IF>
-<id><TMPL_VAR PAGEURL></id>
+<TMPL_IF NAME="ATOMID">
+  <id><TMPL_VAR ATOMID></id>
+<TMPL_ELSE>
+  <id><TMPL_VAR PAGEURL></id>
+</TMPL_IF>
 <subtitle type="html"><TMPL_VAR FEEDDESC ESCAPE=HTML></subtitle>
 <generator uri="http://ikiwiki.info/" version="<TMPL_VAR VERSION>">ikiwiki</generator>
 <updated><TMPL_VAR FEEDDATE></updated>
 <subtitle type="html"><TMPL_VAR FEEDDESC ESCAPE=HTML></subtitle>
 <generator uri="http://ikiwiki.info/" version="<TMPL_VAR VERSION>">ikiwiki</generator>
 <updated><TMPL_VAR FEEDDATE></updated>