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. --- 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 + 9 files changed, 28 insertions(+), 213 deletions(-) delete mode 100644 doc/patchqueue/atomfeed.mdwn (limited to 'doc') 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, } -- cgit v1.2.3