summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/aggregate.pm14
-rw-r--r--doc/plugins/aggregate.mdwn5
-rw-r--r--templates/aggregatepost.tmpl2
3 files changed, 12 insertions, 9 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);
diff --git a/doc/plugins/aggregate.mdwn b/doc/plugins/aggregate.mdwn
index 690904f73..95c8534b0 100644
--- a/doc/plugins/aggregate.mdwn
+++ b/doc/plugins/aggregate.mdwn
@@ -1,7 +1,7 @@
This plugin allows content from other blogs to be aggregated into the wiki.
Aggregate a blog as follows:
- \[[aggregate name="example blog" feedurl="http://example.com/index.rss" url="http://example.com/" updateinterval="15" dir="example"]
+ \[[aggregate name="example blog" feedurl="http://example.com/index.rss" url="http://example.com/" updateinterval="15"]
That example aggregates posts from the expecified RSS feed, updating no
more frequently than once every 15 minutes, and puts a page per post under
@@ -30,7 +30,8 @@ directive:
Required.
* `url` - The url to the web page for the blog that's being aggregated.
Required.
-* `dir` - The directory in the wiki where pages should be saved. Required.
+* `dir` - The directory in the wiki where pages should be saved. Optional,
+ if not specified, the directory is based on the name of the feed.
* `feedurl` - The url to the feed. Optional, if it's not specified ikiwiki
will look for feeds on the `blogurl`. RSS and atom feeds are supported.
* `updateinterval` - How often to check for new posts, in minutes. Default
diff --git a/templates/aggregatepost.tmpl b/templates/aggregatepost.tmpl
index 4dfedf53d..ef7a5f1ae 100644
--- a/templates/aggregatepost.tmpl
+++ b/templates/aggregatepost.tmpl
@@ -9,5 +9,5 @@ From <a href="<TMPL_VAR URL>"><TMPL_VAR NAME></a>
</i>
</p>
<TMPL_LOOP NAME="TAGS">
-[[<TMPL_VAR TAG>]]
+[[tag <TMPL_VAR TAG>]]
</TMPL_LOOP>