* Atom feed support based on a patch by Clint Adams.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 8 Oct 2006 23:57:37 +0000 (23:57 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 8 Oct 2006 23:57:37 +0000 (23:57 +0000)
* 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.

24 files changed:
IkiWiki.pm
IkiWiki/CGI.pm
IkiWiki/Plugin/inline.pm
basewiki/blog.mdwn
basewiki/style.css
debian/changelog
doc/features.mdwn
doc/ikiwiki.setup
doc/patchqueue/atomfeed.mdwn [deleted file]
doc/plugins/inline.mdwn
doc/plugins/tag.mdwn
doc/plugins/write.mdwn
doc/templates.mdwn
doc/usage.mdwn
doc/w3mmode/ikiwiki.setup
ikiwiki.pl
templates/atomitem.tmpl [new file with mode: 0644]
templates/atompage.tmpl [new file with mode: 0644]
templates/blogpost.tmpl
templates/feedlink.tmpl [new file with mode: 0644]
templates/page.tmpl
templates/rssitem.tmpl
templates/rsslink.tmpl [deleted file]
templates/rsspage.tmpl

index 6c0bc1f60eb5a4e8eabf0a5d3a72fae492abb054..168d800ba596523c9e9a598a0df3e09d69a1e205 100644 (file)
@@ -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);
                  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;
 
 # Optimisation.
 use Memoize;
@@ -24,9 +24,10 @@ memoize("abs2rel");
 memoize("pagespec_translate");
 
 my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
 memoize("pagespec_translate");
 
 my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
+our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
 
 sub defaultconfig () { #{{{
 
 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,
        wiki_link_regexp => qr/\[\[(?:([^\]\|]+)\|)?([^\s\]]+)\]\]/,
        wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/,
        verbose => 0,
@@ -42,6 +43,7 @@ sub defaultconfig () { #{{{
        diffurl => '',
        anonok => 0,
        rss => 0,
        diffurl => '',
        anonok => 0,
        rss => 0,
+       atom => 0,
        discussion => 1,
        rebuild => 0,
        refresh => 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{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"
        }
        
        $config{wikistatedir}="$config{srcdir}/.ikiwiki"
index b424892101fbf1fdba85ea6235b1c2f3b0a32de0..53eda2158ad0958c97c3fad511ef9b1a60380a23 100644 (file)
@@ -462,7 +462,7 @@ sub cgi_editpage ($$) { #{{{
                                value => $content, force => 1);
                $form->field(name => "comments",
                                value => $comments, force => 1);
                                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, "",
                $form->tmpl_param("page_preview",
                        htmlize($page, $type,
                        linkify($page, "",
index c7cafee12e2e5330e859af78b8e3f29a7f33958a..1ee79180c52fccc8f336c7f1dc7a6fdc02a2d919 100644 (file)
@@ -25,7 +25,7 @@ sub import { #{{{
 package IkiWiki;
 
 my %toping;
 package IkiWiki;
 
 my %toping;
-my %rsslinks;
+my %feedlinks;
 
 sub yesno ($) { #{{{
        my $val=shift;
 
 sub yesno ($) { #{{{
        my $val=shift;
@@ -40,7 +40,9 @@ sub preprocess_inline (@) { #{{{
        }
        my $raw=yesno($params{raw});
        my $archive=yesno($params{archive});
        }
        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;
        }
        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}));
        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}) {
        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});
                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;
        }
                $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;
        }
        
                $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},
                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};
                $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;
        }
        
        return $ret;
@@ -170,8 +180,8 @@ sub pagetemplate_inline (@) { #{{{
        my $page=$params{page};
        my $template=$params{template};
 
        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 ($$) { #{{{
 } #}}}
 
 sub get_inline_content ($$) { #{{{
@@ -203,6 +213,17 @@ sub date_822 ($) { #{{{
        return $ret;
 } #}}}
 
        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;
 sub absolute_urls ($$) { #{{{
        # sucky sub because rss sucks
        my $content=shift;
@@ -221,15 +242,24 @@ sub rsspage ($) { #{{{
        return $page.".rss";
 } #}}}
 
        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 $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 $content="";
+       my $lasttime = 0;
        foreach my $p (@pages) {
                my $u=URI->new(encode_utf8($config{url}."/".htmlpage($p)));
 
        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,
                        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 {
                        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;
 
                $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,
        $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,
        );
        run_hooks(pagetemplate => sub {
                shift->(page => $page, destpage => $page,
index 4b4e376b13bdfaf1269d9b290f7fef14bc516e1b..b1c2b9b338e70856811efb604f0bd44ea9391ae3 100644 (file)
@@ -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.
 
 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:
 
 If you want your blog to have an archive page listing every post ever made
 to it, you can accomplish that like this:
 
index 6ec6f8950c4cdf547505c2e894ee0ac571faac90..2947851f498cd502dd7fc797e3e78444138587af 100644 (file)
@@ -113,8 +113,8 @@ td.changelog {
        font-weight: bold;
 }
 
        font-weight: bold;
 }
 
-/* RSS button. */
-.rssbutton {
+/* Orange feed button. */
+.feedbutton {
        background: #ff6600;
        color: white !important;
        border-left: 1px solid #cc9966;
        background: #ff6600;
        color: white !important;
        border-left: 1px solid #cc9966;
@@ -128,7 +128,7 @@ td.changelog {
        text-decoration: none;
        margin-top: 1em;
 }
        text-decoration: none;
        margin-top: 1em;
 }
-.rssbutton:hover {
+.feedbutton:hover {
        color: white !important;
        background: #ff9900;
 }
        color: white !important;
        background: #ff9900;
 }
index 29bccaf1194a7c0e25eb812d45b4a566a061faba..81324d440bfe955da0d8647b21937f4b989f097f 100644 (file)
@@ -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.
     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
 
 
 ikiwiki (1.28) unstable; urgency=low
 
index 3890bc5dc64bc00d72bb674aba6dc612228cd84c..5eafcbfbdbe61f34990f0082498f9840250b4071 100644 (file)
@@ -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
 
 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.
 
 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
 
 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]]
 
 
 ### [[SubPages|SubPage]]
 
index 18c413e6fd8bc74c203f1f455328923ece2d51fb..8534c7adc0619ce987de46fc3a3b4211e51701ea 100644 (file)
@@ -71,8 +71,10 @@ use IkiWiki::Setup::Standard {
        
        # Can anonymous web users edit pages?
        #anonok => 1,
        
        # Can anonymous web users edit pages?
        #anonok => 1,
-       # Generate rss feeds for pages?
+       # Generate rss feeds for blogs?
        rss => 1,
        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?
        # 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 (file)
index 4569e30..0000000
+++ /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>
index ef08d2cb23c5079d72ee6bb6c463cef164aaf895..807b7f79a26bbb817216f41eee3589e226522155 100644 (file)
@@ -6,7 +6,7 @@ inside another. For example:
 
        \[[inline pages="blog/*"]]
 
 
        \[[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
 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.
 * `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.
 * `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.
index 499d6f273707df6ba99d8c6d32a24f0d6afe020e..1bc38e6fb788f51dd60ed78d1e10ab4f544fd266 100644 (file)
@@ -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
 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
 
 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
index 8145a35627581c2b4def8017e54d5685896efbb2..18aa34dca7b304f9028c6d3b5a98583aa91e75a1 100644 (file)
@@ -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.
 
   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(@)`
 ### Library functions
 
 #### `hook(@)`
index a0a7f44c7284621c58ca7cf52762472d54a0bab0..05fdc4426b6d4a1d4380c73b3af431595d4357c4 100644 (file)
@@ -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.
   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
 * `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.
 * `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
 * `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
index aa352736c44285acf70740d8df3d972c4ac07a27..9e260adc29ceeec7a06a8ce957b1bb2c506e598b 100644 (file)
@@ -159,7 +159,12 @@ configuration options of their own.
 
 * --rss, --norss
 
 
 * --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
   a [[blog]].
 
 * --pingurl url
index bda5117471b0aa11cd0b7951234fa0854d358550..216e066c8ec431e7b8e2fc800184b76fa48e6f78 100644 (file)
@@ -28,5 +28,6 @@ use IkiWiki::Setup::Standard {
        
        anonok => 1,
        rss => 1,
        
        anonok => 1,
        rss => 1,
+       atom => 1,
        discussion => 1,
 }
        discussion => 1,
 }
index b9a0db7e4a35daadf28e2b829153e1958390af4c..6204ff194a0bc9392597f1f5429aa7abbaf5c420 100755 (executable)
@@ -3,7 +3,6 @@ $ENV{PATH}="/usr/local/bin:/usr/bin:/bin";
 delete @ENV{qw{IFS CDPATH ENV BASH_ENV}};
 
 package IkiWiki;
 delete @ENV{qw{IFS CDPATH ENV BASH_ENV}};
 
 package IkiWiki;
-our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
@@ -34,6 +33,7 @@ sub getconfig () { #{{{
                        "no-rcs" => sub { $config{rcs}="" },
                        "anonok!" => \$config{anonok},
                        "rss!" => \$config{rss},
                        "no-rcs" => sub { $config{rcs}="" },
                        "anonok!" => \$config{anonok},
                        "rss!" => \$config{rss},
+                       "atom!" => \$config{atom},
                        "cgi!" => \$config{cgi},
                        "discussion!" => \$config{discussion},
                        "w3mmode!" => \$config{w3mmode},
                        "cgi!" => \$config{cgi},
                        "discussion!" => \$config{discussion},
                        "w3mmode!" => \$config{w3mmode},
@@ -73,7 +73,7 @@ sub getconfig () { #{{{
                                push @{$config{pingurl}}, $_[1];
                        },
                        "version" => sub {
                                push @{$config{pingurl}}, $_[1];
                        },
                        "version" => sub {
-                               print "ikiwiki version $version\n";
+                               print "ikiwiki version $IkiWiki::version\n";
                                exit;
                        },
                ) || usage();
                                exit;
                        },
                ) || usage();
diff --git a/templates/atomitem.tmpl b/templates/atomitem.tmpl
new file mode 100644 (file)
index 0000000..e0f7bb4
--- /dev/null
@@ -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 (file)
index 0000000..1c672f4
--- /dev/null
@@ -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>
index 1b93adc14c69f1fb6c3e29830a0b30e4a3ed958e..9fbf9a769d287e9bf3c433bd740aba49342d68b2 100644 (file)
@@ -1,7 +1,10 @@
 <form action="<TMPL_VAR CGIURL>" method="get">
 <div id="blogform">
 <TMPL_IF NAME="RSSURL">
 <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>" />
 </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 (file)
index 0000000..2963156
--- /dev/null
@@ -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>
index e1a55be4a5520faf23e1137d5e119d682c9b6626..305e7793b482ed7729b94424bdaef3acefb9465c 100644 (file)
@@ -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="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>
 <TMPL_IF NAME="META"><TMPL_VAR META></TMPL_IF>
 </head>
 <body>
index c7e587e1c7d6121f2474019d7f649c50f68b7fe7..bfd38ec3154fb53ccb87126c6a334082b4ee7086 100644 (file)
@@ -12,6 +12,6 @@
        <category><TMPL_VAR CATEGORY></category>
        </TMPL_LOOP>
        </TMPL_IF>
        <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>
        <description><![CDATA[<TMPL_VAR CONTENT>]]></description>
 </item>
diff --git a/templates/rsslink.tmpl b/templates/rsslink.tmpl
deleted file mode 100644 (file)
index f70c959..0000000
+++ /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>
index 4ec143903987a3b086a728518b386f55d3671521..38f9b16b3b77a5275282bb7313348ff43bfedd64 100644 (file)
@@ -1,10 +1,9 @@
 <?xml version="1.0"?>
 <?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>
 <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>
 <TMPL_VAR CONTENT>
 </channel>
 </rss>