Skip to content
This repository has been archived by the owner on Oct 11, 2021. It is now read-only.

Commit

Permalink
limit attribute for MTOrder tag, allows you to limit the number of Or…
Browse files Browse the repository at this point in the history
…deredItems *after* they have been ordered/sorted
  • Loading branch information
Arvind Satyanarayan committed Aug 15, 2008
1 parent 947dee6 commit e357232
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/Order/lib/Order/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ sub tag_order {
;
@objs = map { $_->[1] } @objs;
@objs = reverse @objs if $order eq 'descend';

if (my $limit = ($args->{lastn} || $args->{limit})) {
if (scalar @objs > $limit) {
@objs = @objs[0..$limit-1];
}
}

return join q{}, @objs;
}

Expand Down

0 comments on commit e357232

Please sign in to comment.