aboutsummaryrefslogtreecommitdiff
path: root/doc/patchqueue
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 /doc/patchqueue
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.
Diffstat (limited to 'doc/patchqueue')
-rw-r--r--doc/patchqueue/atomfeed.mdwn203
1 files changed, 0 insertions, 203 deletions
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>