diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-07-02 19:44:42 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-07-02 19:44:42 +0000 |
commit | e71ca35ac620d9cdd331c3b60971f8d67d7c1044 (patch) | |
tree | 063e06c3c2d37fa0b3ba0a29fb522a09804ccea3 /IkiWiki/Plugin | |
parent | 93351f1275d577aece40ac3fa6608047d4cbcca9 (diff) |
remove the blog_list sub, only used one place and simplifies code to do
away with it
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index afff96cee..fc9d5f01c 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -34,6 +34,19 @@ sub preprocess_inline (@) { #{{{ if (! exists $params{show} && $params{archive} eq "no") { $params{show}=10; } + + my @list; + foreach my $page (keys %pagesources) { + next if $page eq $params{page}; + if (globlist_match($page, $params{pages})) { + push @list, $page; + } + } + @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list; + if ($params{show} && @list > $params{show}) { + @list=@list[0..$params{show} - 1]; + } + add_depends($params{page}, $params{pages}); my $ret=""; @@ -62,10 +75,7 @@ sub preprocess_inline (@) { #{{{ blind_cache => 1, ); - my @pages; - foreach my $page (blog_list($params{pages}, $params{show})) { - next if $page eq $params{page}; - push @pages, $page; + foreach my $page (@list) { $template->param(pagelink => htmllink($params{page}, $params{page}, $page)); $template->param(content => get_inline_content($params{page}, $page)) if $params{archive} eq "no"; @@ -78,29 +88,13 @@ sub preprocess_inline (@) { #{{{ # only supports listing one file per page. if ($config{rss}) { writefile(rsspage($params{page}), $config{destdir}, - genrss($params{page}, @pages)); + genrss($params{page}, @list)); $toping{$params{page}}=1; } return $ret; } #}}} -sub blog_list ($$) { #{{{ - my $globlist=shift; - my $maxitems=shift; - - my @list; - foreach my $page (keys %pagesources) { - if (globlist_match($page, $globlist)) { - push @list, $page; - } - } - - @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list; - return @list if ! $maxitems || @list <= $maxitems; - return @list[0..$maxitems - 1]; -} #}}} - sub get_inline_content ($$) { #{{{ my $parentpage=shift; my $page=shift; |