X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/9ae54f904af35f0c499180f27cab00d24093e62b..e4ccc4f3b09aaaa4f64bdba1d6ffff24e924fd20:/IkiWiki/Plugin/aggregate.pm diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index c42884851..98e534366 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -70,7 +70,7 @@ sub preprocess (@) { #{{{ $feed->{name}=$name; $feed->{sourcepage}=$params{page}; $feed->{url}=$params{url}; - my $dir=exists $params{dir} ? $params{dir} : IkiWiki::titlepage($params{name}); + my $dir=exists $params{dir} ? $params{dir} : "feed/".IkiWiki::titlepage($params{name}); $dir=~s/^\/+//; ($dir)=$dir=~/$IkiWiki::config{wiki_file_regexp}/; $feed->{dir}=$dir; @@ -188,7 +188,8 @@ sub aggregate () { #{{{ die $@ if $@; foreach my $feed (values %feeds) { - next unless time - $feed->{lastupdate} >= $feed->{updateinterval}; + next unless $IkiWiki::config{rebuild} || + time - $feed->{lastupdate} >= $feed->{updateinterval}; $feed->{lastupdate}=time; $feed->{newposts}=0; $IkiWiki::forcerebuild{$feed->{sourcepage}}=1; @@ -252,7 +253,9 @@ sub add_page (@) { #{{{ $feed->{newposts}++; # assign it an unused page - my $page=$feed->{dir}."/".IkiWiki::titlepage($params{title}); + my $page=IkiWiki::titlepage($params{title}); + $page=~s!([/])!"__".ord($1)."__"!eg; # escape slashes in title + $page=$feed->{dir}."/".$page; $page=lc($page); ($page)=$page=~/$IkiWiki::config{wiki_file_regexp}/; if (! defined $page || ! length $page) { @@ -275,7 +278,7 @@ sub add_page (@) { #{{{ eval q{use Digest::MD5 'md5_hex'}; require Encode; my $digest=md5_hex(Encode::encode_utf8($params{content})); - return unless ! exists $guid->{md5} || $guid->{md5} ne $digest; + return unless ! exists $guid->{md5} || $guid->{md5} ne $digest || $IkiWiki::config{rebuild}; $guid->{md5}=$digest; # Create the page. @@ -283,6 +286,8 @@ sub add_page (@) { #{{{ my $content=$params{content}; $params{content}=~s/(?param(title => $params{title}) + if defined $params{title} && length($params{title}); $template->param(content => $params{content}); $template->param(url => $feed->{url}); $template->param(name => $feed->{name});