Accept [[!inline ... atomid="..."]] and use it to populate the feed's Atom <id>.

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.
master
Simon McVittie 2008-07-12 15:20:28 +01:00
parent 50ec532bba
commit 2bd8ada5a6
2 changed files with 10 additions and 4 deletions

View File

@ -308,7 +308,7 @@ sub preprocess_inline (@) { #{{{
if (! $params{preview}) { if (! $params{preview}) {
writefile($rssp, $config{destdir}, writefile($rssp, $config{destdir},
genfeed("rss", 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}; $toping{$params{destpage}}=1 unless $config{rebuild};
$feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />}; $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); will_render($params{destpage}, $atomp);
if (! $params{preview}) { if (! $params{preview}) {
writefile($atomp, $config{destdir}, 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}; $toping{$params{destpage}}=1 unless $config{rebuild};
$feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/atom+xml" title="Atom" href="$atomurl" />}; $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 $feedtype=shift;
my $feedurl=shift; my $feedurl=shift;
my $feeddesc=shift; my $feeddesc=shift;
my $atomid=shift;
my $page=shift; my $page=shift;
my @pages=@_; my @pages=@_;
@ -484,6 +485,7 @@ sub genfeed ($$$$@) { #{{{
pageurl => $url, pageurl => $url,
content => $content, content => $content,
feeddesc => $feeddesc, feeddesc => $feeddesc,
atomid => $atomid,
feeddate => date_3339($lasttime), feeddate => date_3339($lasttime),
feedurl => $feedurl, feedurl => $feedurl,
version => $IkiWiki::version, version => $IkiWiki::version,

View File

@ -31,7 +31,11 @@
</rights> </rights>
</TMPL_IF> </TMPL_IF>
</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> <subtitle type="html"><TMPL_VAR FEEDDESC ESCAPE=HTML></subtitle>
<generator uri="http://ikiwiki.info/" version="<TMPL_VAR VERSION>">ikiwiki</generator> <generator uri="http://ikiwiki.info/" version="<TMPL_VAR VERSION>">ikiwiki</generator>
<updated><TMPL_VAR FEEDDATE></updated> <updated><TMPL_VAR FEEDDATE></updated>