inline: add pagenames parameter
If given instead of pages, this is interpreted as a space-separated list of links to pages (with the same LinkingRules as in a WikiLink), and they are inlined in exactly the order given. The sort and pages parameters cannot be used in conjunction with this one.master
parent
e94289e9e4
commit
e877013174
|
@ -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,7 +183,25 @@ sub preprocess_inline (@) {
|
|||
$params{template} = $archive ? "archivepage" : "inlinepage";
|
||||
}
|
||||
|
||||
my @list=pagespec_match_list(
|
||||
my @list;
|
||||
|
||||
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 = split ' ', $params{pagenames};
|
||||
my $_;
|
||||
@list = map { bestlink($params{page}, $_) } @list;
|
||||
|
||||
$params{pages} = join(" or ", @list);
|
||||
}
|
||||
else {
|
||||
@list = pagespec_match_list(
|
||||
[ grep { $_ ne $params{page} } keys %pagesources ],
|
||||
$params{pages}, location => $params{page});
|
||||
|
||||
|
@ -206,6 +224,7 @@ sub preprocess_inline (@) {
|
|||
else {
|
||||
error sprintf(gettext("unknown sort type %s"), $params{sort});
|
||||
}
|
||||
}
|
||||
|
||||
if (yesno($params{reverse})) {
|
||||
@list=reverse(@list);
|
||||
|
|
|
@ -113,6 +113,11 @@ Here are some less often needed parameters:
|
|||
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
|
||||
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"]]
|
||||
|
||||
|
|
Loading…
Reference in New Issue