From 9e7309ec820066f2fed443245d66f79658360e53 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 17 Sep 2006 20:13:51 +0000 Subject: web commit by ClintAdams: playing with patchqueue --- doc/patchqueue/atomfeed.mdwn | 203 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 doc/patchqueue/atomfeed.mdwn (limited to 'doc') diff --git a/doc/patchqueue/atomfeed.mdwn b/doc/patchqueue/atomfeed.mdwn new file mode 100644 index 000000000..4569e30fa --- /dev/null +++ b/doc/patchqueue/atomfeed.mdwn @@ -0,0 +1,203 @@ +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 ++ ++ ++ -- cgit v1.2.3