[Bast-commits] r6040 - in ironman/plagger: . assets/plugins
assets/plugins/Publish-PagedPlanet
assets/plugins/Publish-PagedPlanet/default
assets/plugins/Publish-PagedPlanet/default/template deps lib
lib/Plagger lib/Plagger/Plugin lib/Plagger/Plugin/Publish
penfold at dev.catalyst.perl.org
penfold at dev.catalyst.perl.org
Thu Apr 30 08:57:43 GMT 2009
Author: penfold
Date: 2009-04-30 09:57:43 +0100 (Thu, 30 Apr 2009)
New Revision: 6040
Added:
ironman/plagger/assets/plugins/Publish-PagedPlanet/
ironman/plagger/assets/plugins/Publish-PagedPlanet/default/
ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/
ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/index.tt
ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/nav.tt
ironman/plagger/deps/
ironman/plagger/deps/Bundle-PagedPlanet.yaml
ironman/plagger/lib/
ironman/plagger/lib/Plagger/
ironman/plagger/lib/Plagger/Plugin/
ironman/plagger/lib/Plagger/Plugin/Publish/
ironman/plagger/lib/Plagger/Plugin/Publish/PagedPlanet.pm
Modified:
ironman/plagger/ironman.yaml
Log:
Check in PagedPlanet plugin + support
Added: ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/index.tt
===================================================================
--- ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/index.tt (rev 0)
+++ ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/index.tt 2009-04-30 08:57:43 UTC (rev 6040)
@@ -0,0 +1,76 @@
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta name="generator" contnet="Plagger [% context.VERSION %]" />
+ <link rel="alternate" type="application/atom+xml" title="Atom: [% feed.title | html %]" href="[% url.atom %]" />
+ <link rel="alternate" type="application/rss+xml" title="RSS: [% feed.title | html %]" href="[% url.rss %]" />
+[% IF url.opml -%]
+ <link rel="subscriptions" type="text/x-opml" title="Subscriptions" ref="[% url.opml %]" />
+[% END -%]
+[% IF url.foaf -%]
+ <link rel="meta" type="application/rdf+xml" title="foafroll" href="[% url.foaf %]" />
+[% END -%]
+ <link rel="stylesheet" type="text/css" href="css/screen.css" />
+ <link rel="stylesheet" type="text/css" href="css/print.css" media="print" />
+ <link rel="stylesheet" type="text/css" href="css/handheld.css" media="handheld" />
+ <link rel="stylesheet" type="text/css" href="css/screen-members-list.css" />
+ <title>[% feed.title %]</title>
+ </head>
+ <body>
+ <div id="feed-title">[% feed.title %]</div>
+ [%- INCLUDE 'nav.tt' -%]
+ <ul id="members-list">
+ [% FOREACH member = members %]
+ <li class="member">
+ <a class="member-link" href="[% member.link | html %]">[% member.title | html %]</a>
+ </li>
+ [% END %]
+ </ul>
+
+ [% FOREACH entry = entries %]
+ <div class="entry">
+ <div class="entry-header">
+ <div class="entry-title">
+ [% IF entry.source.title %]
+ <a class="entry-source-link" href="[% entry.source.link | html %]">[% entry.source.title | html %]</a>:
+ [% END %]
+ <a class="entry-link" href="[% (entry.permalink || entry.id) | html %]">[% entry.title | html %]</a>
+ </div>
+ [% IF entry.author %]
+ <span class="entry-by-line">
+ by <span class="entry-author">[% entry.author | html %]</span>
+ </span>
+ [% END %]
+ [% IF entry.tags.size %]
+ <span class="entry-tags">
+ on
+ <span class="entry-tag">
+ [% entry.tags.join('</span>, <span class="entry-tag">') %]
+ </span>
+ [% END %]
+ </div>
+ [% IF entry.body %]
+ <div class="entry-body">
+ [% entry.body %]
+ </div>
+ [% END %]
+ <div class="entry-footer">
+ [% IF entry.date %]
+ <span class="entry-posted">
+ Posted on
+ <span class="entry-post-date">[% entry.date.format('Mail') %]</span>
+ </span>
+ [% END %]
+ <a class="entry-permalink" href="[% entry.permalink | html %]">permalink</a>
+ [% FOREACH widget = entry.widgets %]
+ <span class="entry-widget">[% widget.html(entry) %]</span>
+ [% END %]
+ </div>
+ </div>
+ [% END %]
+ [%- INCLUDE 'nav.tt' -%]
+ </body>
+</html>
Added: ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/nav.tt
===================================================================
--- ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/nav.tt (rev 0)
+++ ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/nav.tt 2009-04-30 08:57:43 UTC (rev 6040)
@@ -0,0 +1,22 @@
+[% MACRO link(text,num) BLOCK %]
+<a href="index[% IF (num > 1) %]_[% num %][% END %].html">[% text %]</a>
+[% END %]
+<div class="nav">
+[% IF (thispage == 1) %]
+|< <-
+[% ELSE %]
+ [% link('|<',1) %] [% link('<-',thispage - 1) %]
+[% END %]
+[%- FOREACH page IN [1..pagecount] -%]
+ [%- IF (page == thispage) -%]
+ [%- page -%]
+ [%- ELSE -%]
+ [%- link(page,page) -%]
+ [%- END -%]
+[%- END -%]
+[%- IF (thispage == pagecount) -%]
+-> >|
+[%- ELSE -%]
+ [%- link('->',thispage+1) %] [% link('>|',pagecount) -%]
+[%- END -%]
+</div>
\ No newline at end of file
Added: ironman/plagger/deps/Bundle-PagedPlanet.yaml
===================================================================
--- ironman/plagger/deps/Bundle-PagedPlanet.yaml (rev 0)
+++ ironman/plagger/deps/Bundle-PagedPlanet.yaml 2009-04-30 08:57:43 UTC (rev 6040)
@@ -0,0 +1,11 @@
+name: Bundle::PagedPlanet
+author: Mike Whitaker
+default: 1
+bundles:
+ - Filter::StripTagsFromTitle
+ - Filter::HTMLScrubber
+ - Rule::Fresh
+ - Publish::PagedPlanet
+ - Publish::Feed
+ - Publish::OPML
+ - Publish::FOAFRoll
Modified: ironman/plagger/ironman.yaml
===================================================================
--- ironman/plagger/ironman.yaml 2009-04-30 08:56:15 UTC (rev 6039)
+++ ironman/plagger/ironman.yaml 2009-04-30 08:57:43 UTC (rev 6040)
@@ -264,7 +264,7 @@
## has full_content => 0 for both outgoing feeds
# Load 'Bundle' planet plugins
- - module: Bundle::Planet
+ - module: Bundle::PagedPlanet
config:
extra_rule:
expression: grep $args->{entry}->body_text =~ /\b$_\b/i || $args->{entry}->has_tag($_), qw/perl cpan/
@@ -275,3 +275,4 @@
url: http://ironman.enlightenedperl.org/
theme: default
stylesheet: http://bulknews.typepad.com/blog/styles.css
+ pagesize: 20
\ No newline at end of file
Added: ironman/plagger/lib/Plagger/Plugin/Publish/PagedPlanet.pm
===================================================================
--- ironman/plagger/lib/Plagger/Plugin/Publish/PagedPlanet.pm (rev 0)
+++ ironman/plagger/lib/Plagger/Plugin/Publish/PagedPlanet.pm 2009-04-30 08:57:43 UTC (rev 6040)
@@ -0,0 +1,58 @@
+package Plagger::Plugin::Publish::PagedPlanet;
+use strict;
+use base qw( Plagger::Plugin::Publish::Planet );
+
+use File::Spec;
+use URI;
+
+our $VERSION = '0.01';
+
+sub add_feed {
+ my($self, $context, $args) = @_;
+
+ my $feed = $args->{feed};
+ if ($feed->id ne 'smartfeed:all') {
+ $context->error("Publish::Planet requires SmartFeed::All to run.");
+ }
+
+ my $theme = $self->conf->{theme} || $self->conf->{skin} || 'default'; # 'skin' as backward compatible
+ my $file = File::Spec->catfile($theme, 'template', 'index.tt');
+
+ my $pagesize = $self->conf->{pagesize};
+ my $entries = [ grep is_http($_->link), $feed->entries ];
+ my $pagecount = int((@$entries - 1) / $pagesize) + 1;
+ my $stash = $self->build_stash;
+
+ my $vars = {
+ %$stash,
+ feed => $feed,
+ members => [ $context->subscription->feeds ],
+ };
+
+ my $start = 0;
+ my $page = 1;
+ while ($start < scalar @entries) {
+ my $end = $start + $pagesize - 1;
+ my @entries = @{$entries->[$start..$end]};
+ my $filename = ($page == 1) ? 'index.html' : "index_$page.html";
+
+ # passing these into template is enough to allow us to build |<- <- 1 2 3 4 5 -> ->| style nav
+ $vars->{thispage} = $page;
+ $vars->{pagecount} = $pagecount;
+
+ $vars->{entries} = \@entries;
+ $self->_write_index(
+ $context,
+ $self->templatize($file, $vars),
+ File::Spec->catfile($self->conf->{dir}, $filename),
+ );
+
+ $self->_apply_theme(
+ $context,
+ $theme,
+ $self->conf->{dir},
+ );
+ $page++;
+ $start += $pagesize;
+ }
+}
\ No newline at end of file
More information about the Bast-commits
mailing list