]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/inline.pm
Allow the openid plugin to be loaded but disabled, for its side-effect of defining...
[git.ikiwiki.info.git] / IkiWiki / Plugin / inline.pm
index e1e57e43e056d8d0238514c52a30e337def848c3..9d5ebc34daaeb6aa942f41b1424ece4ba00c9036 100644 (file)
@@ -5,7 +5,7 @@ package IkiWiki::Plugin::inline;
 use warnings;
 use strict;
 use Encode;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
 use URI;
 
 my %knownfeeds;
@@ -183,17 +183,20 @@ sub preprocess_inline (@) {
                $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') {
+               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 { $pagemtime{$b} <=> $pagemtime{$a} } @list;
        }
@@ -274,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="";
 
@@ -339,7 +342,7 @@ sub preprocess_inline (@) {
                                        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}));
@@ -351,7 +354,7 @@ sub preprocess_inline (@) {
                                        my $file = $pagesources{$page};
                                        my $type = pagetype($file);
                                        if ($config{discussion}) {
-                                               my $discussionlink=gettext("discussion");
+                                               my $discussionlink=lc(gettext("Discussion"));
                                                if ($page !~ /.*\/\Q$discussionlink\E$/ &&
                                                    (length $config{cgiurl} ||
                                                     exists $links{$page."/".$discussionlink})) {
@@ -519,9 +522,15 @@ sub genfeed ($$$$$@) {
                        mdate_3339 => date_3339($pagemtime{$p}),
                );
 
-               if (exists $pagestate{$p} &&
-                   exists $pagestate{$p}{meta}{guid}) {
-                       $itemtemplate->param(guid => $pagestate{$p}{meta}{guid});
+               if (exists $pagestate{$p}) {
+                       if (exists $pagestate{$p}{meta}{guid}) {
+                               $itemtemplate->param(guid => $pagestate{$p}{meta}{guid});
+                       }
+
+                       if (exists $pagestate{$p}{meta}{updated}) {
+                               $itemtemplate->param(mdate_822 => date_822($pagestate{$p}{meta}{updated}));
+                               $itemtemplate->param(mdate_3339 => date_3339($pagestate{$p}{meta}{updated}));
+                       }
                }
 
                if ($itemtemplate->query(name => "enclosure")) {