From be55f6fd7cf1a251c3977f857a44ee2769e39d8b Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 8 Oct 2006 23:57:37 +0000 Subject: * 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. --- IkiWiki.pm | 10 ++- IkiWiki/CGI.pm | 2 +- IkiWiki/Plugin/inline.pm | 78 ++++++++++++----- basewiki/blog.mdwn | 4 - basewiki/style.css | 6 +- debian/changelog | 10 ++- doc/features.mdwn | 4 +- doc/ikiwiki.setup | 4 +- doc/patchqueue/atomfeed.mdwn | 203 ------------------------------------------- doc/plugins/inline.mdwn | 10 ++- doc/plugins/tag.mdwn | 3 +- doc/plugins/write.mdwn | 3 + doc/templates.mdwn | 6 +- doc/usage.mdwn | 7 +- doc/w3mmode/ikiwiki.setup | 1 + ikiwiki.pl | 4 +- templates/atomitem.tmpl | 20 +++++ templates/atompage.tmpl | 15 ++++ templates/blogpost.tmpl | 5 +- templates/feedlink.tmpl | 8 ++ templates/page.tmpl | 2 +- templates/rssitem.tmpl | 2 +- templates/rsslink.tmpl | 5 -- templates/rsspage.tmpl | 5 +- 24 files changed, 156 insertions(+), 261 deletions(-) delete mode 100644 doc/patchqueue/atomfeed.mdwn create mode 100644 templates/atomitem.tmpl create mode 100644 templates/atompage.tmpl create mode 100644 templates/feedlink.tmpl delete mode 100644 templates/rsslink.tmpl 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{}; + } + 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{}; + $feedlinks{$params{destpage}}=qq{}; } 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 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 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{}; - } -+ 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{}; -+ } - - 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 @@ -+ -+ <TMPL_VAR TITLE ESCAPE=HTML> -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+
-+ ![CDATA[]] -+
-+
-+
-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 @@ -+ -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 @@ -+ -+ -+ -+ <TMPL_VAR TITLE ESCAPE=HTML> -+ -+ -+ -+ John Doe -+ -+ -+ -+ ikiwiki -+ -+ -+ 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 @@ + + <TMPL_VAR TITLE ESCAPE=HTML> + + + + + + + + + + + + + +
+ ![CDATA[]] +
+
+
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 @@ + + + +<TMPL_VAR TITLE ESCAPE=HTML> + + + + + + + +ikiwiki + + + 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 @@
-RSS +RSS + + +Atom 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 @@ + 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 @@ - + 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 @@ - + ]]> 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 @@ - 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 @@ - + <TMPL_VAR TITLE ESCAPE=HTML> - + -- cgit v1.2.3