aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-10-08 23:57:37 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-10-08 23:57:37 +0000
commitbe55f6fd7cf1a251c3977f857a44ee2769e39d8b (patch)
tree36c09168ec20798e5fd5d1e0725cb8577d816928
parentbf4e6716cc57eb6d0dfca43ce92b64934950513e (diff)
downloadikiwiki-be55f6fd7cf1a251c3977f857a44ee2769e39d8b.tar
ikiwiki-be55f6fd7cf1a251c3977f857a44ee2769e39d8b.tar.gz
* Atom feed support based on a patch by Clint Adams.
* Add feeds=no option to inline preprocessor directive to turn off all types of feeds. feeds=rss will still work, and feeds=atom was also added, for fine control. * $IkiWiki::version now holds the program version, and is accessible to plugins.
-rw-r--r--IkiWiki.pm10
-rw-r--r--IkiWiki/CGI.pm2
-rw-r--r--IkiWiki/Plugin/inline.pm78
-rw-r--r--basewiki/blog.mdwn4
-rw-r--r--basewiki/style.css6
-rw-r--r--debian/changelog10
-rw-r--r--doc/features.mdwn4
-rw-r--r--doc/ikiwiki.setup4
-rw-r--r--doc/patchqueue/atomfeed.mdwn203
-rw-r--r--doc/plugins/inline.mdwn10
-rw-r--r--doc/plugins/tag.mdwn3
-rw-r--r--doc/plugins/write.mdwn3
-rw-r--r--doc/templates.mdwn6
-rw-r--r--doc/usage.mdwn7
-rw-r--r--doc/w3mmode/ikiwiki.setup1
-rwxr-xr-xikiwiki.pl4
-rw-r--r--templates/atomitem.tmpl20
-rw-r--r--templates/atompage.tmpl15
-rw-r--r--templates/blogpost.tmpl5
-rw-r--r--templates/feedlink.tmpl8
-rw-r--r--templates/page.tmpl2
-rw-r--r--templates/rssitem.tmpl2
-rw-r--r--templates/rsslink.tmpl5
-rw-r--r--templates/rsspage.tmpl5
24 files changed, 156 insertions, 261 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 6c0bc1f60..168d800ba 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -16,7 +16,7 @@ our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match
bestlink htmllink readfile writefile pagetype srcfile pagename
displaytime
%config %links %renderedfiles %pagesources);
-our $VERSION = 1.01;
+our $VERSION = 1.01; # plugin interface version
# Optimisation.
use Memoize;
@@ -24,9 +24,10 @@ memoize("abs2rel");
memoize("pagespec_translate");
my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
+our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
sub defaultconfig () { #{{{
- wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.x?html?$|\.rss$|.arch-ids/|{arch}/)},
+ wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.x?html?$|\.rss$|\.atom$|.arch-ids/|{arch}/)},
wiki_link_regexp => qr/\[\[(?:([^\]\|]+)\|)?([^\s\]]+)\]\]/,
wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/,
verbose => 0,
@@ -42,6 +43,7 @@ sub defaultconfig () { #{{{
diffurl => '',
anonok => 0,
rss => 0,
+ atom => 0,
discussion => 1,
rebuild => 0,
refresh => 0,
@@ -90,8 +92,8 @@ sub checkconfig () { #{{{
if ($config{cgi} && ! length $config{url}) {
error("Must specify url to wiki with --url when using --cgi\n");
}
- if ($config{rss} && ! length $config{url}) {
- error("Must specify url to wiki with --url when using --rss\n");
+ if (($config{rss} || $config{atom}) && ! length $config{url}) {
+ error("Must specify url to wiki with --url when using --rss or --atom\n");
}
$config{wikistatedir}="$config{srcdir}/.ikiwiki"
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index b42489210..53eda2158 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -462,7 +462,7 @@ sub cgi_editpage ($$) { #{{{
value => $content, force => 1);
$form->field(name => "comments",
value => $comments, force => 1);
- $config{rss}=0; # avoid preview writing an rss feed!
+ $config{rss}=$config{atom}=0; # avoid preview writing a feed!
$form->tmpl_param("page_preview",
htmlize($page, $type,
linkify($page, "",
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index c7cafee12..1ee79180c 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -25,7 +25,7 @@ sub import { #{{{
package IkiWiki;
my %toping;
-my %rsslinks;
+my %feedlinks;
sub yesno ($) { #{{{
my $val=shift;
@@ -40,7 +40,9 @@ sub preprocess_inline (@) { #{{{
}
my $raw=yesno($params{raw});
my $archive=yesno($params{archive});
- my $rss=exists $params{rss} ? yesno($params{rss}) : 1;
+ my $rss=($config{rss} && exists $params{rss}) ? yesno($params{rss}) : $config{rss};
+ my $atom=($config{atom} && exists $params{atom}) ? yesno($params{atom}) : $config{atom};
+ my $feeds=exists $params{feeds} ? yesno($params{feeds}) : 1;
if (! exists $params{show} && ! $archive) {
$params{show}=10;
}
@@ -77,22 +79,23 @@ sub preprocess_inline (@) { #{{{
add_depends($params{page}, $params{pages});
my $rssurl=rsspage(basename($params{page}));
+ my $atomurl=atompage(basename($params{page}));
my $ret="";
if (exists $params{rootpage} && $config{cgiurl}) {
- # Add a blog post form, with a rss link button.
+ # Add a blog post form, with feed buttons.
my $formtemplate=template("blogpost.tmpl", blind_cache => 1);
$formtemplate->param(cgiurl => $config{cgiurl});
$formtemplate->param(rootpage => $params{rootpage});
- if ($config{rss}) {
- $formtemplate->param(rssurl => $rssurl);
- }
+ $formtemplate->param(rssurl => $rssurl) if $feeds && $rss;
+ $formtemplate->param(atomurl => $atomurl) if $feeds && $atom;
$ret.=$formtemplate->output;
}
- elsif ($config{rss} && $rss) {
- # Add a rss link button.
- my $linktemplate=template("rsslink.tmpl", blind_cache => 1);
- $linktemplate->param(rssurl => $rssurl);
+ elsif ($feeds) {
+ # Add feed buttons.
+ my $linktemplate=template("feedlink.tmpl", blind_cache => 1);
+ $linktemplate->param(rssurl => $rssurl) if $rss;
+ $linktemplate->param(atomurl => $atomurl) if $atom;
$ret.=$linktemplate->output;
}
@@ -154,12 +157,19 @@ sub preprocess_inline (@) { #{{{
}
}
- if ($config{rss} && $rss) {
+ if ($feeds && $rss) {
will_render($params{page}, rsspage($params{page}));
writefile(rsspage($params{page}), $config{destdir},
- genrss($desc, $params{page}, @list));
+ genfeed("rss", $rssurl, $desc, $params{page}, @list));
+ $toping{$params{page}}=1 unless $config{rebuild};
+ $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />};
+ }
+ if ($feeds && $atom) {
+ will_render($params{page}, atompage($params{page}));
+ writefile(atompage($params{page}), $config{destdir},
+ genfeed("atom", $atomurl, $desc, $params{page}, @list));
$toping{$params{page}}=1 unless $config{rebuild};
- $rsslinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />};
+ $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/atom+xml" title="Atom" href="$atomurl" />};
}
return $ret;
@@ -170,8 +180,8 @@ sub pagetemplate_inline (@) { #{{{
my $page=$params{page};
my $template=$params{template};
- $template->param(rsslink => $rsslinks{$page})
- if exists $rsslinks{$page} && $template->query(name => "rsslink");
+ $template->param(feedlinks => $feedlinks{$page})
+ if exists $feedlinks{$page} && $template->query(name => "feedlinks");
} #}}}
sub get_inline_content ($$) { #{{{
@@ -203,6 +213,17 @@ sub date_822 ($) { #{{{
return $ret;
} #}}}
+sub date_3339 ($) { #{{{
+ my $time=shift;
+
+ eval q{use POSIX};
+ my $lc_time= POSIX::setlocale(&POSIX::LC_TIME);
+ POSIX::setlocale(&POSIX::LC_TIME, "C");
+ my $ret=POSIX::strftime("%Y-%m-%dT%H:%M:%SZ", localtime($time));
+ POSIX::setlocale(&POSIX::LC_TIME, $lc_time);
+ return $ret;
+} #}}}
+
sub absolute_urls ($$) { #{{{
# sucky sub because rss sucks
my $content=shift;
@@ -221,15 +242,24 @@ sub rsspage ($) { #{{{
return $page.".rss";
} #}}}
-sub genrss ($$@) { #{{{
- my $desc=shift;
+sub atompage ($) { #{{{
+ my $page=shift;
+
+ return $page.".atom";
+} #}}}
+
+sub genfeed ($$$$@) { #{{{
+ my $feedtype=shift;
+ my $feedurl=shift;
+ my $feeddesc=shift;
my $page=shift;
my @pages=@_;
my $url=URI->new(encode_utf8($config{url}."/".htmlpage($page)));
- my $itemtemplate=template("rssitem.tmpl", blind_cache => 1);
+ my $itemtemplate=template($feedtype."item.tmpl", blind_cache => 1);
my $content="";
+ my $lasttime = 0;
foreach my $p (@pages) {
my $u=URI->new(encode_utf8($config{url}."/".htmlpage($p)));
@@ -237,7 +267,8 @@ sub genrss ($$@) { #{{{
title => pagetitle(basename($p)),
url => $u,
permalink => $u,
- pubdate => date_822($pagectime{$p}),
+ date_822 => date_822($pagectime{$p}),
+ date_3339 => date_3339($pagectime{$p}),
content => absolute_urls(get_inline_content($p, $page), $url),
);
run_hooks(pagetemplate => sub {
@@ -247,15 +278,20 @@ sub genrss ($$@) { #{{{
$content.=$itemtemplate->output;
$itemtemplate->clear_params;
+
+ $lasttime = $pagectime{$p} if $pagectime{$p} > $lasttime;
}
- my $template=template("rsspage.tmpl", blind_cache => 1);
+ my $template=template($feedtype."page.tmpl", blind_cache => 1);
$template->param(
title => $config{wikiname},
wikiname => $config{wikiname},
pageurl => $url,
content => $content,
- rssdesc => $desc,
+ feeddesc => $feeddesc,
+ feeddate => date_3339($lasttime),
+ feedurl => $feedurl,
+ version => $IkiWiki::version,
);
run_hooks(pagetemplate => sub {
shift->(page => $page, destpage => $page,
diff --git a/basewiki/blog.mdwn b/basewiki/blog.mdwn
index 4b4e376b1..b1c2b9b33 100644
--- a/basewiki/blog.mdwn
+++ b/basewiki/blog.mdwn
@@ -11,10 +11,6 @@ The optional `rootpage` parameter tells the wiki that new posts to this blog
should default to being [[SubPage]]s of "blog", and enables a form at the
top of the blog that can be used to add new items.
-There is also an optional `rss` parameter that can control whether an RSS
-feed is generated. The default is to generate an RSS feed, if the wiki is
-globally configured to do so, but you can set `rss=no` to disable this.
-
If you want your blog to have an archive page listing every post ever made
to it, you can accomplish that like this:
diff --git a/basewiki/style.css b/basewiki/style.css
index 6ec6f8950..2947851f4 100644
--- a/basewiki/style.css
+++ b/basewiki/style.css
@@ -113,8 +113,8 @@ td.changelog {
font-weight: bold;
}
-/* RSS button. */
-.rssbutton {
+/* Orange feed button. */
+.feedbutton {
background: #ff6600;
color: white !important;
border-left: 1px solid #cc9966;
@@ -128,7 +128,7 @@ td.changelog {
text-decoration: none;
margin-top: 1em;
}
-.rssbutton:hover {
+.feedbutton:hover {
color: white !important;
background: #ff9900;
}
diff --git a/debian/changelog b/debian/changelog
index 29bccaf11..81324d440 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,8 +16,14 @@ ikiwiki (1.29) UNRELEASED; urgency=low
but no longer rendered files will be cleaned up.
* Use will_render in the inline and linkmap plugins.
* You will need to rebuild your wiki on upgrade to this version.
-
- -- Joey Hess <joeyh@debian.org> Sun, 8 Oct 2006 16:53:17 -0400
+ * Atom feed support based on a patch by Clint Adams.
+ * Add feeds=no option to inline preprocessor directive to turn off all types
+ of feeds. feeds=rss will still work, and feeds=atom was also added, for
+ fine control.
+ * $IkiWiki::version now holds the program version, and is accessible to
+ plugins.
+
+ -- Joey Hess <joeyh@debian.org> Sun, 8 Oct 2006 18:36:30 -0400
ikiwiki (1.28) unstable; urgency=low
diff --git a/doc/features.mdwn b/doc/features.mdwn
index 3890bc5dc..5eafcbfbd 100644
--- a/doc/features.mdwn
+++ b/doc/features.mdwn
@@ -50,7 +50,7 @@ program, or other special file and link to it from your wiki pages.
You can turn any page in the wiki into a [[blog]]. Pages matching a
specified [[PageSpec]] will be displayed as a weblog within the blog
-page. And an RSS feed can be generated to follow the blog.
+page. And RSS or Atom feeds can be generated to follow the blog.
Ikiwiki's own [[TODO]], [[news]], and [[plugins]] pages are good examples
of some of the flexible ways that this can be used.
@@ -90,7 +90,7 @@ incomplete list of some of them.
You can tag pages and use these tags in various ways. Tags will show
up in the ways you'd expect, like at the bottom of pages, in blogs, and
-in rss feeds.
+in RSS and Atom feeds.
### [[SubPages|SubPage]]
diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup
index 18c413e6f..8534c7adc 100644
--- a/doc/ikiwiki.setup
+++ b/doc/ikiwiki.setup
@@ -71,8 +71,10 @@ use IkiWiki::Setup::Standard {
# Can anonymous web users edit pages?
#anonok => 1,
- # Generate rss feeds for pages?
+ # Generate rss feeds for blogs?
rss => 1,
+ # Generate atom feeds for blogs?
+ atom => 1,
# Urls to ping with XML-RPC when rss feeds are updated
#pingurl => [qw{http://rpc.technorati.com/rpc/ping}],
# Include discussion links on all pages?
diff --git a/doc/patchqueue/atomfeed.mdwn b/doc/patchqueue/atomfeed.mdwn
deleted file mode 100644
index 4569e30fa..000000000
--- a/doc/patchqueue/atomfeed.mdwn
+++ /dev/null
@@ -1,203 +0,0 @@
-diff -x {arch} -x .arch-ids -Nur ikiwiki--upstream--1.0--patch-26/IkiWiki/Plugin/inline.pm ikiwiki--devo--1.0--patch-9/IkiWiki/Plugin/inline.pm
---- ikiwiki--upstream--1.0--patch-26/IkiWiki/Plugin/inline.pm 2006-09-17 16:08:18.969109484 -0400
-+++ ikiwiki--devo--1.0--patch-9/IkiWiki/Plugin/inline.pm 2006-09-16 13:38:36.336193934 -0400
-@@ -26,6 +26,7 @@
-
- my %toping;
- my %rsslinks;
-+my %atomlinks;
-
- sub yesno ($) { #{{{
- my $val=shift;
-@@ -41,6 +42,7 @@
- my $raw=yesno($params{raw});
- my $archive=yesno($params{archive});
- my $rss=exists $params{rss} ? yesno($params{rss}) : 1;
-+ my $atom=exists $params{atom} ? yesno($params{atom}) : 1;
- if (! exists $params{show} && ! $archive) {
- $params{show}=10;
- }
-@@ -67,6 +69,7 @@
- add_depends($params{page}, $params{pages});
-
- my $rssurl=rsspage(basename($params{page}));
-+ my $atomurl=atompage(basename($params{page}));
- my $ret="";
-
- if (exists $params{rootpage} && $config{cgiurl}) {
-@@ -77,6 +80,9 @@
- if ($config{rss}) {
- $formtemplate->param(rssurl => $rssurl);
- }
-+ if ($config{atom}) {
-+ $formtemplate->param(atomurl => $atomurl);
-+ }
- $ret.=$formtemplate->output;
- }
- elsif ($config{rss} && $rss) {
-@@ -85,6 +91,12 @@
- $linktemplate->param(rssurl => $rssurl);
- $ret.=$linktemplate->output;
- }
-+ elsif ($config{atom} && $atom) {
-+ # Add a Atom link button.
-+ my $linktemplate=template("atomlink.tmpl", blind_cache => 1);
-+ $linktemplate->param(atomurl => $atomurl);
-+ $ret.=$linktemplate->output;
-+ }
-
- my $template=template(
- ($archive ? "inlinepagetitle.tmpl" : "inlinepage.tmpl"),
-@@ -149,10 +161,16 @@
- # only supports listing one file per page.
- if ($config{rss} && $rss) {
- writefile(rsspage($params{page}), $config{destdir},
-- genrss($desc, $params{page}, @list));
-+ genfeed("rss", $rssurl, $desc, $params{page}, @list));
- $toping{$params{page}}=1 unless $config{rebuild};
- $rsslinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />};
- }
-+ if ($config{atom} && $atom) {
-+ writefile(atompage($params{page}), $config{destdir},
-+ genfeed("atom", $atomurl, $desc, $params{page}, @list));
-+ $toping{$params{page}}=1 unless $config{rebuild};
-+ $atomlinks{$params{destpage}}=qq{<link rel="alternate" type="application/atom+xml" title="Atom" href="$atomurl" />};
-+ }
-
- return $ret;
- } #}}}
-@@ -164,6 +182,8 @@
-
- $template->param(rsslink => $rsslinks{$page})
- if exists $rsslinks{$page} && $template->query(name => "rsslink");
-+ $template->param(atomlink => $atomlinks{$page})
-+ if exists $atomlinks{$page} && $template->query(name => "atomlink");
- } #}}}
-
- sub get_inline_content ($$) { #{{{
-@@ -195,6 +215,17 @@
- return $ret;
- } #}}}
-
-+sub date_3339 ($) { #{{{
-+ my $time=shift;
-+
-+ eval q{use POSIX};
-+ my $lc_time= POSIX::setlocale(&POSIX::LC_TIME);
-+ POSIX::setlocale(&POSIX::LC_TIME, "C");
-+ my $ret=POSIX::strftime("%Y-%m-%dT%H:%M:%SZ", localtime($time));
-+ POSIX::setlocale(&POSIX::LC_TIME, $lc_time);
-+ return $ret;
-+} #}}}
-+
- sub absolute_urls ($$) { #{{{
- # sucky sub because rss sucks
- my $content=shift;
-@@ -213,15 +244,24 @@
- return $page.".rss";
- } #}}}
-
--sub genrss ($$@) { #{{{
-+sub atompage ($) { #{{{
-+ my $page=shift;
-+
-+ return $page.".atom";
-+} #}}}
-+
-+sub genfeed ($$$$@) { #{{{
-+ my $feedtype=shift;
-+ my $feedurl=shift;
- my $desc=shift;
- my $page=shift;
- my @pages=@_;
-
- my $url=URI->new(encode_utf8($config{url}."/".htmlpage($page)));
-
-- my $itemtemplate=template("rssitem.tmpl", blind_cache => 1);
-+ my $itemtemplate=template($feedtype."item.tmpl", blind_cache => 1);
- my $content="";
-+ my $lasttime;
- foreach my $p (@pages) {
- next unless exists $renderedfiles{$p};
-
-@@ -232,6 +272,7 @@
- url => $u,
- permalink => $u,
- pubdate => date_822($pagectime{$p}),
-+ atompubdate => date_3339($pagectime{$p}),
- content => absolute_urls(get_inline_content($p, $page), $url),
- );
- run_hooks(pagetemplate => sub {
-@@ -241,15 +282,19 @@
-
- $content.=$itemtemplate->output;
- $itemtemplate->clear_params;
-+
-+ $lasttime = $pagectime{$p};
- }
-
-- my $template=template("rsspage.tmpl", blind_cache => 1);
-+ my $template=template($feedtype."page.tmpl", blind_cache => 1);
- $template->param(
- title => $config{wikiname},
- wikiname => $config{wikiname},
- pageurl => $url,
- content => $content,
- rssdesc => $desc,
-+ feeddate => date_3339($lasttime),
-+ feedurl => $feedurl,
- );
- run_hooks(pagetemplate => sub {
- shift->(page => $page, destpage => $page,
-diff -x {arch} -x .arch-ids -Nur ikiwiki--upstream--1.0--patch-26/templates/atomitem.tmpl ikiwiki--devo--1.0--patch-9/templates/atomitem.tmpl
---- ikiwiki--upstream--1.0--patch-26/templates/atomitem.tmpl 1969-12-31 19:00:00.000000000 -0500
-+++ ikiwiki--devo--1.0--patch-9/templates/atomitem.tmpl 2006-09-16 02:56:56.075533012 -0400
-@@ -0,0 +1,20 @@
-+<entry>
-+ <title><TMPL_VAR TITLE ESCAPE=HTML></title>
-+ <TMPL_IF NAME="AUTHOR">
-+ <author><TMPL_VAR AUTHOR ESCAPE=HTML></author>
-+ <TMPL_ELSE>
-+ </TMPL_IF>
-+ <id><TMPL_VAR URL></id>
-+ <link href="<TMPL_VAR PERMALINK>"/>
-+ <TMPL_IF NAME="CATEGORIES">
-+ <TMPL_LOOP NAME="CATEGORIES">
-+ <category><TMPL_VAR CATEGORY></category>
-+ </TMPL_LOOP>
-+ </TMPL_IF>
-+ <updated><TMPL_VAR ATOMPUBDATE></updated>
-+ <content type="xhtml" xml:lang="en">
-+ <div xmlns="http://www.w3.org/1999/xhtml">
-+ ![CDATA[<TMPL_VAR CONTENT>]]
-+ </div>
-+ </content>
-+</entry>
-diff -x {arch} -x .arch-ids -Nur ikiwiki--upstream--1.0--patch-26/templates/atomlink.tmpl ikiwiki--devo--1.0--patch-9/templates/atomlink.tmpl
---- ikiwiki--upstream--1.0--patch-26/templates/atomlink.tmpl 1969-12-31 19:00:00.000000000 -0500
-+++ ikiwiki--devo--1.0--patch-9/templates/atomlink.tmpl 2006-09-16 02:56:56.079533423 -0400
-@@ -0,0 +1,5 @@
-+<div id="atomlink">
-+<TMPL_IF NAME="ATOMURL">
-+<a class="atombutton" type="application/atom+xml" href="<TMPL_VAR NAME=ATOMURL>">Atom</a>
-+</TMPL_IF>
-+</div>
-diff -x {arch} -x .arch-ids -Nur ikiwiki--upstream--1.0--patch-26/templates/atompage.tmpl ikiwiki--devo--1.0--patch-9/templates/atompage.tmpl
---- ikiwiki--upstream--1.0--patch-26/templates/atompage.tmpl 1969-12-31 19:00:00.000000000 -0500
-+++ ikiwiki--devo--1.0--patch-9/templates/atompage.tmpl 2006-09-16 02:56:56.079533423 -0400
-@@ -0,0 +1,15 @@
-+<?xml version="1.0" encoding="utf-8"?>
-+
-+<feed xmlns="http://www.w3.org/2005/Atom">
-+ <title><TMPL_VAR TITLE ESCAPE=HTML></title>
-+ <link href="<TMPL_VAR PAGEURL>"/>
-+ <link href="<TMPL_VAR FEEDURL>" rel="self"/>
-+ <author>
-+ <name>John Doe</name>
-+ </author>
-+ <id><TMPL_VAR PAGEURL></id>
-+ <subtitle type="html"><TMPL_VAR RSSDESC ESCAPE=HTML></subtitle>
-+ <generator uri="http://ikiwiki.kitenet.net/" version="1.0">ikiwiki</generator>
-+ <updated><TMPL_VAR FEEDDATE></updated>
-+<TMPL_VAR CONTENT>
-+</feed>
diff --git a/doc/plugins/inline.mdwn b/doc/plugins/inline.mdwn
index ef08d2cb2..807b7f79a 100644
--- a/doc/plugins/inline.mdwn
+++ b/doc/plugins/inline.mdwn
@@ -6,7 +6,7 @@ inside another. For example:
\[[inline pages="blog/*"]]
-The most common use of inlining is generating blogs and RSS feeds.
+The most common use of inlining is generating blogs and RSS or Atom feeds.
See [[blog]] for details.
## usage
@@ -18,8 +18,12 @@ directive:
* `show` - Specify the maximum number of matching pages to inline.
Default is 10, unless archiving, when the default is to show all.
Set to 0 to show all matching pages.
-* `rss` - Controls generation of an RSS feed. On by default, set to "no" to
- disable.
+* `rss` - controls generation of an rss feed. On by default if the wiki is
+ configured to use rss feeds, set to "no" to disable.
+* `atom` - controls generation of an atom feed. On by default if the wiki is
+ configured to use atom feeds, set to "no" to disable.
+* `feeds` - controls generation of all types of feeds. Set to "no" to
+ disable generating any feeds.
* `rootpage` - Enables a form to post new pages to a [[blog]].
* `archive` - If set to "yes", only list page titles and some metadata, not
full controls.
diff --git a/doc/plugins/tag.mdwn b/doc/plugins/tag.mdwn
index 499d6f273..1bc38e6fb 100644
--- a/doc/plugins/tag.mdwn
+++ b/doc/plugins/tag.mdwn
@@ -8,7 +8,8 @@ This plugin allows tagging pages. List tags as follows:
The tags work the same as if you had put a (hidden) [[WikiLink]] on the page
for each tag, so you can use a [[PageSpec]] match all pages that are
tagged with a given tag, for example. The tags will also show up on blog
-entries and at the bottom of the tagged pages, as well as in rss feeds.
+entries and at the bottom of the tagged pages, as well as in RSS and Atom
+feeds.
This plugin has a configuration option. Set --tagbase=tag and links to tags
will be located under the specified base page. If ikiwiki is configured
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 8145a3562..18aa34dca 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -201,6 +201,9 @@ use the following hashes, using a page name as the key:
reference.
* `%pagesources` contains the name of the source file for a page.
+Also, the %IkiWiki::version variable contains the version number for the
+ikiwiki program.
+
### Library functions
#### `hook(@)`
diff --git a/doc/templates.mdwn b/doc/templates.mdwn
index a0a7f44c7..05fdc4426 100644
--- a/doc/templates.mdwn
+++ b/doc/templates.mdwn
@@ -18,6 +18,8 @@ It ships with some basic templates which can be customised:
generate the mail with the user's password in it.
* `rsspage.tmpl` - Used for generating rss feeds for [[blog]]s.
* `rssitem.tmpl` - Used for generating individual items on rss feeds.
+* `atompage.tmpl` - Used for generating atom feeds for [[blog]]s.
+* `atomitem.tmpl` - Used for generating individual items on atom feeds.
* `inlinepage.tmpl` - Used for adding a page inline in a blog
page.
* `inlinepagetitle.tmpl` - Used for listing a page inline in a blog
@@ -25,8 +27,8 @@ It ships with some basic templates which can be customised:
* `estseek.conf` - Not a html template, this is actually a template for
a config file for the [[HyperEstraier]] search engine. If you like you
can read the [[HyperEstraier]] docs and configure it using this.
-* `blogpost.tmpl` - Used for a form to add a post to a blog (and a rss link)
-* `rsslink.tmpl` - Used to add a rss link if blogpost.tmpl is not used.
+* `blogpost.tmpl` - Used for a form to add a post to a blog (and a rss/atom links)
+* `feedlink.tmpl` - Used to add rss/atom links if blogpost.tmpl is not used.
* `aggregatepost.tmpl` - Used by the [[plugins/aggregate]] plugin to create
a page for a post.
* `searchform.tmpl` - Used by the [[plugins/search]] plugin to add a search
diff --git a/doc/usage.mdwn b/doc/usage.mdwn
index aa352736c..9e260adc2 100644
--- a/doc/usage.mdwn
+++ b/doc/usage.mdwn
@@ -159,7 +159,12 @@ configuration options of their own.
* --rss, --norss
- If rss is set, ikiwiki will generate rss feeds for pages that inline
+ If rss is set, ikiwiki will generate RSS feeds for pages that inline
+ a [[blog]].
+
+* --atom, --noatom
+
+ If atom is set, ikiwiki will generate Arom feeds for pages that inline
a [[blog]].
* --pingurl url
diff --git a/doc/w3mmode/ikiwiki.setup b/doc/w3mmode/ikiwiki.setup
index bda511747..216e066c8 100644
--- a/doc/w3mmode/ikiwiki.setup
+++ b/doc/w3mmode/ikiwiki.setup
@@ -28,5 +28,6 @@ use IkiWiki::Setup::Standard {
anonok => 1,
rss => 1,
+ atom => 1,
discussion => 1,
}
diff --git a/ikiwiki.pl b/ikiwiki.pl
index b9a0db7e4..6204ff194 100755
--- a/ikiwiki.pl
+++ b/ikiwiki.pl
@@ -3,7 +3,6 @@ $ENV{PATH}="/usr/local/bin:/usr/bin:/bin";
delete @ENV{qw{IFS CDPATH ENV BASH_ENV}};
package IkiWiki;
-our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
use warnings;
use strict;
@@ -34,6 +33,7 @@ sub getconfig () { #{{{
"no-rcs" => sub { $config{rcs}="" },
"anonok!" => \$config{anonok},
"rss!" => \$config{rss},
+ "atom!" => \$config{atom},
"cgi!" => \$config{cgi},
"discussion!" => \$config{discussion},
"w3mmode!" => \$config{w3mmode},
@@ -73,7 +73,7 @@ sub getconfig () { #{{{
push @{$config{pingurl}}, $_[1];
},
"version" => sub {
- print "ikiwiki version $version\n";
+ print "ikiwiki version $IkiWiki::version\n";
exit;
},
) || usage();
diff --git a/templates/atomitem.tmpl b/templates/atomitem.tmpl
new file mode 100644
index 000000000..e0f7bb4f9
--- /dev/null
+++ b/templates/atomitem.tmpl
@@ -0,0 +1,20 @@
+<entry>
+ <title><TMPL_VAR TITLE ESCAPE=HTML></title>
+ <TMPL_IF NAME="AUTHOR">
+ <author><TMPL_VAR AUTHOR ESCAPE=HTML></author>
+ <TMPL_ELSE>
+ </TMPL_IF>
+ <id><TMPL_VAR URL></id>
+ <link href="<TMPL_VAR PERMALINK>"/>
+ <TMPL_IF NAME="CATEGORIES">
+ <TMPL_LOOP NAME="CATEGORIES">
+ <category><TMPL_VAR CATEGORY></category>
+ </TMPL_LOOP>
+ </TMPL_IF>
+ <updated><TMPL_VAR DATE_3339></updated>
+ <content type="xhtml" xml:lang="en">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ ![CDATA[<TMPL_VAR CONTENT>]]
+ </div>
+ </content>
+</entry>
diff --git a/templates/atompage.tmpl b/templates/atompage.tmpl
new file mode 100644
index 000000000..1c672f484
--- /dev/null
+++ b/templates/atompage.tmpl
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<feed xmlns="http://www.w3.org/2005/Atom">
+<title><TMPL_VAR TITLE ESCAPE=HTML></title>
+<link href="<TMPL_VAR PAGEURL>"/>
+<link href="<TMPL_VAR FEEDURL>" rel="self"/>
+<author>
+<name><TMPL_VAR WIKINAME></name>
+</author>
+<id><TMPL_VAR PAGEURL></id>
+<subtitle type="html"><TMPL_VAR FEEDDESC ESCAPE=HTML></subtitle>
+<generator uri="http://ikiwiki.kitenet.net/" version="<TMPL_VAR VERSION>">ikiwiki</generator>
+<updated><TMPL_VAR FEEDDATE></updated>
+<TMPL_VAR CONTENT>
+</feed>
diff --git a/templates/blogpost.tmpl b/templates/blogpost.tmpl
index 1b93adc14..9fbf9a769 100644
--- a/templates/blogpost.tmpl
+++ b/templates/blogpost.tmpl
@@ -1,7 +1,10 @@
<form action="<TMPL_VAR CGIURL>" method="get">
<div id="blogform">
<TMPL_IF NAME="RSSURL">
-<a class="rssbutton" type="application/rss+xml" href="<TMPL_VAR NAME=RSSURL>">RSS</a>
+<a class="feedbutton" type="application/rss+xml" href="<TMPL_VAR NAME=RSSURL>">RSS</a>
+</TMPL_IF>
+<TMPL_IF NAME="ATOMURL">
+<a class="feedbutton" type="application/atom+xml" href="<TMPL_VAR NAME=ATOMURL>">Atom</a>
</TMPL_IF>
<input type="hidden" name="do" value="blog" />
<input type="hidden" name="from" value="<TMPL_VAR ROOTPAGE>" />
diff --git a/templates/feedlink.tmpl b/templates/feedlink.tmpl
new file mode 100644
index 000000000..2963156c1
--- /dev/null
+++ b/templates/feedlink.tmpl
@@ -0,0 +1,8 @@
+<div id="feedlink">
+<TMPL_IF NAME="RSSURL">
+<a class="feedbutton" type="application/rss+xml" href="<TMPL_VAR NAME=RSSURL>">RSS</a>
+</TMPL_IF>
+<TMPL_IF NAME="ATOMURL">
+<a class="feedbutton" type="application/atom+xml" href="<TMPL_VAR NAME=ATOMURL>">Atom</a>
+</TMPL_IF>
+</div>
diff --git a/templates/page.tmpl b/templates/page.tmpl
index e1a55be4a..305e7793b 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -9,7 +9,7 @@
<TMPL_IF NAME="FAVICON">
<link rel="icon" href="<TMPL_VAR BASEURL><TMPL_VAR FAVICON>" type="image/x-icon" />
</TMPL_IF>
-<TMPL_IF NAME="RSSLINK"><TMPL_VAR RSSLINK></TMPL_IF>
+<TMPL_IF NAME="FEEDLINKS"><TMPL_VAR FEEDLINKS></TMPL_IF>
<TMPL_IF NAME="META"><TMPL_VAR META></TMPL_IF>
</head>
<body>
diff --git a/templates/rssitem.tmpl b/templates/rssitem.tmpl
index c7e587e1c..bfd38ec31 100644
--- a/templates/rssitem.tmpl
+++ b/templates/rssitem.tmpl
@@ -12,6 +12,6 @@
<category><TMPL_VAR CATEGORY></category>
</TMPL_LOOP>
</TMPL_IF>
- <pubDate><TMPL_VAR PUBDATE></pubDate>
+ <pubDate><TMPL_VAR DATE_822></pubDate>
<description><![CDATA[<TMPL_VAR CONTENT>]]></description>
</item>
diff --git a/templates/rsslink.tmpl b/templates/rsslink.tmpl
deleted file mode 100644
index f70c959d6..000000000
--- a/templates/rsslink.tmpl
+++ /dev/null
@@ -1,5 +0,0 @@
-<div id="rsslink">
-<TMPL_IF NAME="RSSURL">
-<a class="rssbutton" type="application/rss+xml" href="<TMPL_VAR NAME=RSSURL>">RSS</a>
-</TMPL_IF>
-</div>
diff --git a/templates/rsspage.tmpl b/templates/rsspage.tmpl
index 4ec143903..38f9b16b3 100644
--- a/templates/rsspage.tmpl
+++ b/templates/rsspage.tmpl
@@ -1,10 +1,9 @@
<?xml version="1.0"?>
-<rss version="2.0"
- xmlns:dc="http://purl.org/dc/elements/1.1/">
+<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title><TMPL_VAR TITLE ESCAPE=HTML></title>
<link><TMPL_VAR PAGEURL></link>
-<description><TMPL_VAR RSSDESC ESCAPE=HTML></description>
+<description><TMPL_VAR FEEDDESC ESCAPE=HTML></description>
<TMPL_VAR CONTENT>
</channel>
</rss>