aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2015-11-30 20:55:34 +0000
committerSimon McVittie <smcv@debian.org>2015-11-30 20:55:34 +0000
commitb199349ffddce2b8afd89567882e182f7ef9bff1 (patch)
tree41f7f91ddd28dd43a60b44e4715e97cd5806d68c /IkiWiki
parent67906ded049f5c52a541b1c7364829ea4ce7b58b (diff)
parentab768a62c66335a96a5791c444e54b8ae3b078b1 (diff)
downloadikiwiki-b199349ffddce2b8afd89567882e182f7ef9bff1.tar
ikiwiki-b199349ffddce2b8afd89567882e182f7ef9bff1.tar.gz
Merge remote-tracking branch 'smcv/ready/limit'
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/inline.pm37
-rw-r--r--IkiWiki/Plugin/pagestats.pm12
2 files changed, 33 insertions, 16 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 416df1e28..d68723dff 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -181,11 +181,22 @@ sub preprocess_inline (@) {
my $feeds=exists $params{feeds} ? yesno($params{feeds}) : !$quick && ! $raw;
my $emptyfeeds=exists $params{emptyfeeds} ? yesno($params{emptyfeeds}) : 1;
my $feedonly=yesno($params{feedonly});
- if (! exists $params{show} && ! $archive) {
- $params{show}=10;
+
+ # Backwards compatibility
+ if (defined $params{show} && $params{show} =~ m/^\d+$/) {
+ $params{limit} = $params{show};
+ delete $params{show};
+ }
+ if (defined $params{feedshow} && $params{feedshow} =~ m/^\d+$/) {
+ $params{feedlimit} = $params{feedshow};
+ delete $params{feedshow};
+ }
+
+ if (! exists $params{limit} && ! $archive) {
+ $params{limit}=10;
}
- if (! exists $params{feedshow} && exists $params{show}) {
- $params{feedshow}=$params{show};
+ if (! exists $params{feedlimit} && exists $params{limit}) {
+ $params{feedlimit}=$params{limit};
}
my $title;
if (exists $params{title}) {
@@ -233,11 +244,11 @@ sub preprocess_inline (@) {
}
else {
my $num=0;
- if ($params{show}) {
- $num=$params{show};
+ if ($params{limit}) {
+ $num=$params{limit};
}
- if ($params{feedshow} && $num < $params{feedshow} && $num > 0) {
- $num=$params{feedshow};
+ if ($params{feedlimit} && $num < $params{feedlimit} && $num > 0) {
+ $num=$params{feedlimit};
}
if ($params{skip} && $num) {
$num+=$params{skip};
@@ -258,17 +269,17 @@ sub preprocess_inline (@) {
my @feedlist;
if ($feeds) {
- if (exists $params{feedshow} &&
- $params{feedshow} && @list > $params{feedshow}) {
- @feedlist=@list[0..$params{feedshow} - 1];
+ if (exists $params{feedlimit} &&
+ $params{feedlimit} && @list > $params{feedlimit}) {
+ @feedlist=@list[0..$params{feedlimit} - 1];
}
else {
@feedlist=@list;
}
}
- if ($params{show} && @list > $params{show}) {
- @list=@list[0..$params{show} - 1];
+ if ($params{limit} && @list > $params{limit}) {
+ @list=@list[0..$params{limit} - 1];
}
if ($feeds && exists $params{feedpages}) {
diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm
index 17b26f7ba..460a5969a 100644
--- a/IkiWiki/Plugin/pagestats.pm
+++ b/IkiWiki/Plugin/pagestats.pm
@@ -35,7 +35,13 @@ sub preprocess (@) {
my %params=@_;
$params{pages}="*" unless defined $params{pages};
my $style = ($params{style} or 'cloud');
-
+
+ # Backwards compatibility
+ if (defined $params{show} && $params{show} =~ m/^\d+$/) {
+ $params{limit} = $params{show};
+ delete $params{show};
+ }
+
my %counts;
my $max = 0;
foreach my $page (pagespec_match_list($params{page}, $params{pages},
@@ -64,11 +70,11 @@ sub preprocess (@) {
$max = $counts{$page} if $counts{$page} > $max;
}
- if (exists $params{show}) {
+ if (exists $params{limit}) {
my $i=0;
my %show;
foreach my $key (sort { $counts{$b} <=> $counts{$a} } keys %counts) {
- last if ++$i > $params{show};
+ last if ++$i > $params{limit};
$show{$key}=$counts{$key};
}
%counts=%show;