]> sipb.mit.edu Git - ikiwiki.git/commitdiff
`template` option for aggregate.pm.
authorBernd Zeimetz <bernd@bzed.de>
Sat, 21 Jun 2008 19:51:04 +0000 (21:51 +0200)
committerJoey Hess <joey@kodama.kitenet.net>
Sat, 21 Jun 2008 20:23:39 +0000 (16:23 -0400)
Allows to specify the template file which is used to
create the html pages.

IkiWiki/Plugin/aggregate.pm
doc/plugins/aggregate.mdwn

index e44c26f747b66397fd52838be45ad1853641ab46..b5354a823482e243e3c7d9fdd9ec4a2db6e010eb 100644 (file)
@@ -154,6 +154,13 @@ sub preprocess (@) { #{{{
        $feed->{updateinterval}=defined $params{updateinterval} ? $params{updateinterval} * 60 : 15 * 60;
        $feed->{expireage}=defined $params{expireage} ? $params{expireage} : 0;
        $feed->{expirecount}=defined $params{expirecount} ? $params{expirecount} : 0;
        $feed->{updateinterval}=defined $params{updateinterval} ? $params{updateinterval} * 60 : 15 * 60;
        $feed->{expireage}=defined $params{expireage} ? $params{expireage} : 0;
        $feed->{expirecount}=defined $params{expirecount} ? $params{expirecount} : 0;
+        if (exists $params{template}) {
+                $params{template}=~s/[^-_a-zA-Z0-9]+//g;
+        }
+        else {
+                $params{template} = "aggregatepost"
+        }
+       $feed->{template}=$params{template} . ".tmpl";
        delete $feed->{unseen};
        $feed->{lastupdate}=0 unless defined $feed->{lastupdate};
        $feed->{numposts}=0 unless defined $feed->{numposts};
        delete $feed->{unseen};
        $feed->{lastupdate}=0 unless defined $feed->{lastupdate};
        $feed->{numposts}=0 unless defined $feed->{numposts};
@@ -507,7 +514,7 @@ sub add_page (@) { #{{{
        $guid->{md5}=$digest;
 
        # Create the page.
        $guid->{md5}=$digest;
 
        # Create the page.
-       my $template=template("aggregatepost.tmpl", blind_cache => 1);
+       my $template=template($feed->{template}, blind_cache => 1);
        $template->param(title => $params{title})
                if defined $params{title} && length($params{title});
        $template->param(content => htmlescape(htmlabs($params{content}, $feed->{feedurl})));
        $template->param(title => $params{title})
                if defined $params{title} && length($params{title});
        $template->param(content => htmlescape(htmlabs($params{content}, $feed->{feedurl})));
index aab5f079a79c54f9b67acea5e60f8a9fd3f1e64d..574c8b125e9486e3433a89711eddd4ebbab03fb0 100644 (file)
@@ -59,6 +59,8 @@ directive:
 * `tag` - A tag to tag each post from the feed with. A good tag to use is
   the name of the feed. Can be repeated multiple times. The [[tag]] plugin
   must be enabled for this to work.
 * `tag` - A tag to tag each post from the feed with. A good tag to use is
   the name of the feed. Can be repeated multiple times. The [[tag]] plugin
   must be enabled for this to work.
+* `template` - Template to use for creating the html pages. Defaults to
+  aggregatepost.
 
 Note that even if you are using subversion or another revision control
 system, pages created by aggregation will *not* be checked into revision
 
 Note that even if you are using subversion or another revision control
 system, pages created by aggregation will *not* be checked into revision