if $@ || ! defined $sub;
my @candidates;
- if (exists $params{limit}) {
- @candidates=grep { $params{limit}->($_) } keys %pagesources;
+ if (exists $params{filter}) {
+ @candidates=grep { ! $params{filter}->($_) } keys %pagesources;
}
else {
@candidates=keys %pagesources;
# clear params, remainder is passed to pagespec
my $num=$params{num};
- delete @params{qw{num deptype reverse sort limit}};
+ delete @params{qw{num deptype reverse sort filter}};
my @matches;
my $firstfail;
@list = pagespec_match_list($params{page}, $params{pages},
deptype => deptype($quick ? "presence" : "content"),
- limit => sub { $_[0] ne $params{page} },
+ filter => sub { $_[0] eq $params{page} },
sort => exists $params{sort} ? $params{sort} : "age",
reverse => yesno($params{reverse}),
num => $num,
my @orphans=pagespec_match_list($params{page}, $params{pages},
# update when orphans are added/removed
deptype => deptype("presence"),
- limit => sub {
+ filter => sub {
my $page=shift;
# Filter out pages that other pages link to.
- return 0 if IkiWiki::backlink_pages($page);
+ return 1 if IkiWiki::backlink_pages($page);
# Toplevel index is assumed to never be orphaned.
- return 0 if $page eq 'index';
+ return 1 if $page eq 'index';
# If the page has a link to some other page, it's
# indirectly linked via that page's backlinks.
- return 0 if grep {
+ return 1 if grep {
length $_ &&
($_ !~ /\/\Q$config{discussionpage}\E$/i || ! $config{discussion}) &&
bestlink($page, $_) !~ /^(\Q$page\E|)$/
} @{$links{$page}};
- return 1;
+ return 0;
},
);
my @list=sort { $params{timehash}->{$b} <=> $params{timehash}->{$a} }
pagespec_match_list($params{page}, $params{pages},
deptype => $deptype,
- limit => sub { $_[0] ne $params{page} },
+ filter => sub { $_[0] eq $params{page} },
);
my @data=eval qq{IkiWiki::Plugin::postsparkline::formula::$formula(\\\%params, \@list)};
* `deptype` optionally specifies the type of dependency to add. Use the
`deptype` function to generate a dependency type.
-* `limit` is a reference to a function, that is called and passed a page,
- and must return true for the page to be included.
+* `filter` is a reference to a function, that is called and passed a page,
+ and returns true if the page should be filtered out of the list.
* `sort` specifies a sort order for the list. See
[[ikiwiki/PageSpec/sorting]] for the avilable sort methods.
* `reverse` if true, sorts in reverse.