remove the blog_list sub, only used one place and simplifies code to do
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 2 Jul 2006 19:44:42 +0000 (19:44 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 2 Jul 2006 19:44:42 +0000 (19:44 +0000)
away with it

IkiWiki/Plugin/inline.pm

index afff96cee6a7801c56780ac98719f816ff4d4dda..fc9d5f01cc0044a0b728159fb68e0fb841d25734 100644 (file)
@@ -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;