]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/aggregate.pm
Merge branch 'bugs'
[ikiwiki.git] / IkiWiki / Plugin / aggregate.pm
index e44c26f747b66397fd52838be45ad1853641ab46..4fbcde390d59fd232f9fbfaf63f358259f74b423 100644 (file)
@@ -30,7 +30,10 @@ sub getopt () { #{{{
         eval q{use Getopt::Long};
        error($@) if $@;
         Getopt::Long::Configure('pass_through');
-        GetOptions("aggregate" => \$config{aggregate});
+        GetOptions(
+               "aggregate" => \$config{aggregate},
+               "aggregateinternal!" => \$config{aggregateinternal},
+       );
 } #}}}
 
 sub checkconfig () { #{{{
@@ -154,6 +157,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;
+        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};
@@ -507,7 +517,7 @@ sub add_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})));
@@ -588,7 +598,7 @@ sub pagefile ($) { #{{{
 } #}}}
 
 sub htmlfn ($) { #{{{
-       return shift().".".$config{htmlext};
+       return shift().".".($config{aggregateinternal} ? "_" : "").$config{htmlext};
 } #}}}
 
 my $aggregatelock;