summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-30 05:14:35 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-30 05:14:35 +0000
commitc5b02885e934e5a1f8c5a8753ed47eaf4cce8b9f (patch)
treebf3b39bc990ab61ebdc1b4f50340dfce64d2f200 /IkiWiki
parente49ff966a39d1037ccbf168b8dbd12618cf1b41e (diff)
fixes, and make dir optional
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/aggregate.pm14
1 files changed, 8 insertions, 6 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 5c8151b58..898854641 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -53,7 +53,7 @@ sub filter (@) { #{{{
sub preprocess (@) { #{{{
my %params=@_;
- foreach my $required (qw{name url dir}) {
+ foreach my $required (qw{name url}) {
if (! exists $params{$required}) {
return "[[aggregate plugin missing $required parameter]]";
}
@@ -70,10 +70,12 @@ sub preprocess (@) { #{{{
$feed->{name}=$name;
$feed->{sourcepage}=$params{page};
$feed->{url}=$params{url};
- ($feed->{dir})=$params{dir}=~/$IkiWiki::config{wiki_file_regexp}/;
- $feed->{dir}=~s/^\/+//;
+ my $dir=exists $params{dir} ? $params{dir} : IkiWiki::titlepage($params{name});
+ $dir=~s/^\/+//;
+ ($dir)=$dir=~/$IkiWiki::config{wiki_file_regexp}/;
+ $feed->{dir}=$dir;
$feed->{feedurl}=defined $params{feedurl} ? $params{feedurl} : $params{url};
- $feed->{updateinterval}=defined $params{updateinterval} ? $params{updateinterval} : 15;
+ $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;
delete $feed->{remove};
@@ -179,7 +181,7 @@ sub aggregate () { #{{{
die $@ if $@;
FEED: foreach my $feed (values %feeds) {
- # TODO: check updateinterval
+ next unless time - $feed->{lastupdate} >= $feed->{updateinterval};
$feed->{lastupdate}=time;
$feed->{newposts}=0;
$IkiWiki::forcerebuild{$feed->{sourcepage}}=1;
@@ -269,7 +271,7 @@ sub add_page (@) { #{{{
$template->param(name => $feed->{name});
$template->param(link => $params{link}) if defined $params{link};
if (ref $feed->{tags}) {
- $template->param(tags => map { tag => $_ }, @{$feed->{tags}});
+ $template->param(tags => [map { tag => $_ }, @{$feed->{tags}}]);
}
IkiWiki::writefile($guid->{page}.".html", $IkiWiki::config{srcdir},
$template->output);