aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-07-31 10:25:43 +0200
committerJoey Hess <joey@gnu.kitenet.net>2009-07-31 10:25:43 +0200
commitf1a70921e3bfc0496b5564582a5a1463b7a98c09 (patch)
tree5b4ece1ed99a2825b057edc9815e0f36bb7a7d11 /IkiWiki
parent0bbb3d201e9d3f27c537e415be4284877fd8eac7 (diff)
parente8770131740c83b21197d8a260db20c1c3f48020 (diff)
downloadikiwiki-f1a70921e3bfc0496b5564582a5a1463b7a98c09.tar
ikiwiki-f1a70921e3bfc0496b5564582a5a1463b7a98c09.tar.gz
Merge commit 'remotes/smcv/ready/inline-pagenames' into staging
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/inline.pm57
1 files changed, 38 insertions, 19 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 9d5ebc34d..e7d6f250e 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -151,7 +151,7 @@ my %feedlinks;
sub preprocess_inline (@) {
my %params=@_;
- if (! exists $params{pages}) {
+ if (! exists $params{pages} && ! exists $params{pagenames}) {
error gettext("missing pages parameter");
}
my $raw=yesno($params{raw});
@@ -183,28 +183,47 @@ sub preprocess_inline (@) {
$params{template} = $archive ? "archivepage" : "inlinepage";
}
- my @list=pagespec_match_list(
- [ grep { $_ ne $params{page} } keys %pagesources ],
- $params{pages}, location => $params{page});
+ my @list;
- 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"));
+ if (exists $params{pagenames}) {
+
+ foreach my $p (qw(sort pages)) {
+ if (exists $params{$p}) {
+ error sprintf(gettext("the %s and %s parameters cannot be used together"),
+ "pagenames", $p);
+ }
}
- @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;
- }
- elsif (! exists $params{sort} || $params{sort} eq 'age') {
- @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
+
+ @list = split ' ', $params{pagenames};
+ my $_;
+ @list = map { bestlink($params{page}, $_) } @list;
+
+ $params{pages} = join(" or ", @list);
}
else {
- error sprintf(gettext("unknown sort type %s"), $params{sort});
+ @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;
+ }
+ elsif (! exists $params{sort} || $params{sort} eq 'age') {
+ @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
+ }
+ else {
+ error sprintf(gettext("unknown sort type %s"), $params{sort});
+ }
}
if (yesno($params{reverse})) {