Merge commit 'remotes/smcv/ready/inline-pagenames' into staging
commit
f1a70921e3
|
@ -151,7 +151,7 @@ my %feedlinks;
|
||||||
sub preprocess_inline (@) {
|
sub preprocess_inline (@) {
|
||||||
my %params=@_;
|
my %params=@_;
|
||||||
|
|
||||||
if (! exists $params{pages}) {
|
if (! exists $params{pages} && ! exists $params{pagenames}) {
|
||||||
error gettext("missing pages parameter");
|
error gettext("missing pages parameter");
|
||||||
}
|
}
|
||||||
my $raw=yesno($params{raw});
|
my $raw=yesno($params{raw});
|
||||||
|
@ -183,28 +183,47 @@ sub preprocess_inline (@) {
|
||||||
$params{template} = $archive ? "archivepage" : "inlinepage";
|
$params{template} = $archive ? "archivepage" : "inlinepage";
|
||||||
}
|
}
|
||||||
|
|
||||||
my @list=pagespec_match_list(
|
my @list;
|
||||||
[ grep { $_ ne $params{page} } keys %pagesources ],
|
|
||||||
$params{pages}, location => $params{page});
|
|
||||||
|
|
||||||
if (exists $params{sort} && $params{sort} eq 'title') {
|
if (exists $params{pagenames}) {
|
||||||
@list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;
|
|
||||||
}
|
foreach my $p (qw(sort pages)) {
|
||||||
elsif (exists $params{sort} && $params{sort} eq 'title_natural') {
|
if (exists $params{$p}) {
|
||||||
eval q{use Sort::Naturally};
|
error sprintf(gettext("the %s and %s parameters cannot be used together"),
|
||||||
if ($@) {
|
"pagenames", $p);
|
||||||
error(gettext("Sort::Naturally needed for title_natural sort"));
|
}
|
||||||
}
|
}
|
||||||
@list=sort { Sort::Naturally::ncmp(pagetitle(basename($a)), pagetitle(basename($b))) } @list;
|
|
||||||
}
|
@list = split ' ', $params{pagenames};
|
||||||
elsif (exists $params{sort} && $params{sort} eq 'mtime') {
|
my $_;
|
||||||
@list=sort { $pagemtime{$b} <=> $pagemtime{$a} } @list;
|
@list = map { bestlink($params{page}, $_) } @list;
|
||||||
}
|
|
||||||
elsif (! exists $params{sort} || $params{sort} eq 'age') {
|
$params{pages} = join(" or ", @list);
|
||||||
@list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
|
|
||||||
}
|
}
|
||||||
else {
|
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})) {
|
if (yesno($params{reverse})) {
|
||||||
|
|
|
@ -113,6 +113,11 @@ Here are some less often needed parameters:
|
||||||
For example, set "feedfile=feed" to cause it to generate `page/feed.atom`
|
For example, set "feedfile=feed" to cause it to generate `page/feed.atom`
|
||||||
and/or `page/feed.rss`. This option is not supported if the wiki is
|
and/or `page/feed.rss`. This option is not supported if the wiki is
|
||||||
configured not to use `usedirs`.
|
configured not to use `usedirs`.
|
||||||
|
* `pagenames` - If given instead of `pages`, this is interpreted as a
|
||||||
|
space-separated list of links to pages (with the same
|
||||||
|
[[SubPage/LinkingRules]] as in a [[ikiwiki/WikiLink]]), and they are inlined
|
||||||
|
in exactly the order given: the `sort` and `pages` parameters cannot be used
|
||||||
|
in conjunction with this one.
|
||||||
|
|
||||||
[[!meta robots="noindex, follow"]]
|
[[!meta robots="noindex, follow"]]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue