[Bast-commits] r6045 - in ironman/plagger: assets/plugins/Publish-PagedPlanet assets/plugins/Publish-PagedPlanet/default/template lib/Plagger/Plugin lib/Plagger/Plugin/Bundle lib/Plagger/Plugin/Publish

castaway at dev.catalyst.perl.org castaway at dev.catalyst.perl.org
Thu Apr 30 13:31:10 GMT 2009


Author: castaway
Date: 2009-04-30 14:31:09 +0100 (Thu, 30 Apr 2009)
New Revision: 6045

Added:
   ironman/plagger/assets/plugins/Publish-PagedPlanet/nav.tt
   ironman/plagger/lib/Plagger/Plugin/Bundle/
   ironman/plagger/lib/Plagger/Plugin/Bundle/PagedPlanet.pm
Removed:
   ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/nav.tt
Modified:
   ironman/plagger/lib/Plagger/Plugin/Publish/PagedPlanet.pm
Log:
Paged Planet: Add Bundle, move/update nav.tt


Deleted: ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/nav.tt
===================================================================
--- ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/nav.tt	2009-04-30 12:42:50 UTC (rev 6044)
+++ ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/nav.tt	2009-04-30 13:31:09 UTC (rev 6045)
@@ -1,6 +0,0 @@
-[%- MACRO link(text,num) BLOCK %]<a href="index[% IF (num > 1) %]_[% num %][% END %].html">[% text %]</a>[% END -%]
-<div class="nav">
-[% IF (thispage == 1) %]|&lt; &lt;-[% ELSE; link('|&lt;',1) %] [% link('&lt;-',thispage - 1); END -%]
-[%- FOREACH page IN [1..pagecount]; IF (page == thispage); %] [% page; ELSE; %] [% link(page,page); END; END -%]
-[%- IF (thispage == pagecount) %] -&gt; &gt;|[% ELSE %] [% link('-&gt;',thispage + 1) %] [% link('&gt;|',pagecount); END -%]
-</div>

Copied: ironman/plagger/assets/plugins/Publish-PagedPlanet/nav.tt (from rev 6044, ironman/plagger/assets/plugins/Publish-PagedPlanet/default/template/nav.tt)
===================================================================
--- ironman/plagger/assets/plugins/Publish-PagedPlanet/nav.tt	                        (rev 0)
+++ ironman/plagger/assets/plugins/Publish-PagedPlanet/nav.tt	2009-04-30 13:31:09 UTC (rev 6045)
@@ -0,0 +1,6 @@
+[%- MACRO link(text,num) BLOCK %]<a href="index[% IF (num > 1) %]_[% num %][% END %].html">[% text %]</a>[% END -%]
+<div class="nav">
+[% IF (thispage == 1); prevpage = thispage - 1 %]|&lt; &lt;-[% ELSE; link('|&lt;',1) %] [% link('&lt;-',prevpage); END -%]
+[%- FOREACH page IN [1..pagecount]; IF (page == thispage); %] [% page; ELSE; %] [% link(page,page); END; END -%]
+[%- IF (thispage == pagecount); nextpage = thispage + 1 %] -&gt; &gt;|[% ELSE %] [% link('-&gt;',nextpage) %] [% link('&gt;|',pagecount); END -%]
+</div>


Property changes on: ironman/plagger/assets/plugins/Publish-PagedPlanet/nav.tt
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: ironman/plagger/lib/Plagger/Plugin/Bundle/PagedPlanet.pm
===================================================================
--- ironman/plagger/lib/Plagger/Plugin/Bundle/PagedPlanet.pm	                        (rev 0)
+++ ironman/plagger/lib/Plagger/Plugin/Bundle/PagedPlanet.pm	2009-04-30 13:31:09 UTC (rev 6045)
@@ -0,0 +1,220 @@
+package Plagger::Plugin::Bundle::PagedPlanet;
+use strict;
+use base qw( Plagger::Plugin );
+
+use File::Spec;
+
+sub register {
+    my($self, $context) = @_;
+
+    # check required configs
+    for my $directive (qw( title dir url )) {
+        unless ($self->conf->{$directive}) {
+            $context->error("Bundle::Planet: config '$directive' is missing");
+        }
+    }
+
+    $context->load_plugin({
+        module => 'Filter::StripTagsFromTitle',
+    });
+
+    eval { require HTML::Tidy };
+    unless ($@) {
+        $context->load_plugin({
+            module => 'Filter::HTMLTidy',
+        });
+    }
+
+    $context->load_plugin({
+        module => 'Filter::HTMLScrubber',
+        config => $self->conf->{scrubber} || {},
+    });
+
+    $context->load_plugin({
+        module => 'Filter::GuessTimeZoneByDomain',
+    });
+
+    my @rules;
+    my $duration = defined $self->conf->{duration}
+        ? $self->conf->{duration} : "7 days";
+    if ($duration ne '0') {
+        push @rules, {
+            module   => 'Fresh',
+            duration => $duration,
+        };
+    }
+
+    if (my $rule = $self->conf->{extra_rule}) {
+        push @rules, (ref $rule eq 'ARRAY' ? @{$rule} : ($rule));
+    }
+
+    $context->load_plugin({
+        module => 'SmartFeed::All',
+        rule => \@rules,
+        config => {
+            title => $self->conf->{title},
+            link  => $self->conf->{url},
+            description => $self->conf->{description},
+        },
+    });
+
+    my $rule = {
+        expression => q{ $args->{feed}->id eq 'smartfeed:all' },
+    };
+
+    $context->load_plugin({
+        module => 'Publish::PagedPlanet',
+        rule   => $rule,
+        config => {
+            dir  => $self->conf->{dir},
+            skin => $self->conf->{theme},
+            template => {
+                style_url => $self->conf->{stylesheet},
+                url => {
+                    base => $self->conf->{url},
+                    atom => $self->conf->{url} . "atom.xml",
+                    rss  => $self->conf->{url} . "rss.xml",
+                    opml => $self->conf->{url} . "subscriptions.opml",
+                    foaf => $self->conf->{url} . "foafroll.xml",
+                },
+            },
+        },
+    });
+
+    $context->load_plugin({
+        module => 'Publish::Feed',
+        rule   => $rule,
+        config => {
+            dir => $self->conf->{dir},
+            filename => 'atom.xml',
+            format => 'Atom',
+            taguri_base => URI->new($self->conf->{url})->host,
+        },
+    });
+
+    $context->load_plugin({
+        module => 'Publish::Feed',
+        rule   => $rule,
+        config => {
+            dir => $self->conf->{dir},
+            filename => 'rss.xml',
+            format => 'RSS',
+        },
+    });
+
+    $context->load_plugin({
+        module => 'Publish::OPML',
+        config => {
+            filename => File::Spec->catfile($self->conf->{dir}, 'subscriptions.opml'),
+            title => $self->conf->{title},
+        },
+    });
+
+    $context->load_plugin({
+        module => 'Publish::FOAFRoll',
+        config => {
+            filename => File::Spec->catfile($self->conf->{dir}, 'foafroll.xml'),
+            link => $self->conf->{url},
+            url  => $self->conf->{url} . "foafroll.xml",
+            title => $self->conf->{title},
+        },
+    });
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Plagger::Plugin::Bundle::Planet - Bundle package to create Planet site
+
+=head1 SYNOPSIS
+
+  - module: Bundle::Planet
+    config:
+      title: Planet Foobar
+      dir: /path/to/planet
+      url: http://example.org/planet
+      theme: sixapart-std
+      stylesheet: foo.css
+      duration: 7 days
+      description: Everything about Foobar from the Web
+
+=head1 DESCRIPTION
+
+This plugin is a I<Bundle> plugin to load bunch of required modules to
+create Planet site with a single Plugin setup. Using this plugin will
+load following plugins and automatically sets up necessary
+configurations.
+
+=over 4
+
+=item Filter::StripTagsFromTitle
+
+=item Filter::HTMLTidy (if HTML::Tidy is available)
+
+=item Filter::HTMLScrubber
+
+=item Filter::GuessTimeZoneByDomain
+
+=item SmartFeed::All
+
+=item Publish::Planet
+
+=item Publish::Feed
+
+=item Publish::OPML
+
+=item Publish::FOAFRoll
+
+=back
+
+=head1 CONFIGS
+
+=over 4
+
+=item title
+
+Title of Planet site. Required.
+
+=item dir
+
+Directory to create HTML, Feed and CSS files in. Required.
+
+=item url
+
+Public URL to access the Planet site, which is used to construct Feed and CSS URLs with. Required.
+
+=item theme
+
+Name of I<theme> to use with Publish::Planet. Defaults to I<default>.
+
+=item stylesheet
+
+URL(s) of stylesheet (CSS) to use with I<sixapart-std> theme. Optional.
+
+=item duration
+
+Duration of feed entries to display. When you pass I<0> as a value, the Planet plugin displays
+all the entries aggregated. Defaults to I<7 days>.
+
+=item extra_rule
+
+Additional rule to add to filter entries using SmartFeed::All. Optional and defaults to nothing.
+
+=item description
+
+Description to use in XHTML tagline and Atom/RSS feeds. Optional.
+
+=back
+
+=head1 AUTHOR
+
+Tatsuhiko Miyagawa
+
+=head1 SEE ALSO
+
+L<Plagger>, L<Plagger::Plugin::Publish::Feed>, L<Plagger::Plugin::Publish::Planet>
+
+=cut

Modified: ironman/plagger/lib/Plagger/Plugin/Publish/PagedPlanet.pm
===================================================================
--- ironman/plagger/lib/Plagger/Plugin/Publish/PagedPlanet.pm	2009-04-30 12:42:50 UTC (rev 6044)
+++ ironman/plagger/lib/Plagger/Plugin/Publish/PagedPlanet.pm	2009-04-30 13:31:09 UTC (rev 6045)
@@ -55,4 +55,4 @@
         $page++;
         $start += $pagesize;
     }
-}
\ No newline at end of file
+}




More information about the Bast-commits mailing list