]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/inline.pm
call initLanguage after initTheme
[git.ikiwiki.info.git] / IkiWiki / Plugin / inline.pm
index a89e827c1c7ff2ecf2a877c7dd48d11e2105fbcd..27ea1c4a64bf8ebca3be99755c86a08a2192cb65 100644 (file)
@@ -183,19 +183,18 @@ sub preprocess_inline (@) {
                $params{template} = $archive ? "archivepage" : "inlinepage";
        }
 
                $params{template} = $archive ? "archivepage" : "inlinepage";
        }
 
-       my @list;
-       foreach my $page (keys %pagesources) {
-               next if $page eq $params{page};
-               if (pagespec_match($page, $params{pages}, location => $params{page})) {
-                       push @list, $page;
-               }
-       }
+       my @list=pagespec_match_list(
+               [ grep { $_ ne $params{page} } keys %pagesources ],
+               $params{pages}, location => $params{page});
 
        if (exists $params{sort} && $params{sort} eq 'title') {
                @list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;
        }
        elsif (exists $params{sort} && $params{sort} eq 'title_natural') {
 
        if (exists $params{sort} && $params{sort} eq 'title') {
                @list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;
        }
        elsif (exists $params{sort} && $params{sort} eq 'title_natural') {
-               require Sort::Naturally;
+               eval q{use Sort::Naturally};
+               if ($@) {
+                       error(gettext("Sort::Naturally needed for title_natural sort"));
+               }
                @list=sort { Sort::Naturally::ncmp(pagetitle(basename($a)), pagetitle(basename($b))) } @list;
        }
        elsif (exists $params{sort} && $params{sort} eq 'mtime') {
                @list=sort { Sort::Naturally::ncmp(pagetitle(basename($a)), pagetitle(basename($b))) } @list;
        }
        elsif (exists $params{sort} && $params{sort} eq 'mtime') {
@@ -278,8 +277,8 @@ sub preprocess_inline (@) {
                }
        }
 
                }
        }
 
-       my $rssurl=basename($feedbase."rss".$feednum) if $feeds && $rss;
-       my $atomurl=basename($feedbase."atom".$feednum) if $feeds && $atom;
+       my $rssurl=abs2rel($feedbase."rss".$feednum, dirname(htmlpage($params{destpage}))) if $feeds && $rss;
+       my $atomurl=abs2rel($feedbase."atom".$feednum, dirname(htmlpage($params{destpage}))) if $feeds && $atom;
 
        my $ret="";
 
 
        my $ret="";
 
@@ -343,7 +342,7 @@ sub preprocess_inline (@) {
                                        my $content=get_inline_content($page, $params{destpage});
                                        $template->param(content => $content);
                                }
                                        my $content=get_inline_content($page, $params{destpage});
                                        $template->param(content => $content);
                                }
-                               $template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage}));
+                               $template->param(pageurl => urlto($page, $params{destpage}));
                                $template->param(inlinepage => $page);
                                $template->param(title => pagetitle(basename($page)));
                                $template->param(ctime => displaytime($pagectime{$page}, $params{timeformat}));
                                $template->param(inlinepage => $page);
                                $template->param(title => pagetitle(basename($page)));
                                $template->param(ctime => displaytime($pagectime{$page}, $params{timeformat}));