aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2012-04-08 16:02:03 -0400
committerJoey Hess <joey@kitenet.net>2012-04-08 16:02:03 -0400
commitfc5c938b195bacd8db2be7a435cb88bfbd050af8 (patch)
tree9f648f8cc74fe7340b40d80ba244bb7fbc800238 /IkiWiki
parent29157c9cd1b3ad81bb76de5c99b21d27c25867d8 (diff)
parent258ee1bc3b9c43807064c771ebcb9ce2840d4264 (diff)
downloadikiwiki-fc5c938b195bacd8db2be7a435cb88bfbd050af8.tar
ikiwiki-fc5c938b195bacd8db2be7a435cb88bfbd050af8.tar.gz
Merge remote-tracking branch 'smcv/ready/literal-pagenames'
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/inline.pm6
-rw-r--r--IkiWiki/Plugin/trail.pm23
2 files changed, 22 insertions, 7 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index a50c4b7b7..8eb033951 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -211,9 +211,7 @@ sub preprocess_inline (@) {
}
}
- @list = grep { $_ ne '' }
- map { bestlink($params{page}, $_) }
- split ' ', $params{pagenames};
+ @list = split ' ', $params{pagenames};
if (yesno($params{reverse})) {
@list=reverse(@list);
@@ -222,6 +220,8 @@ sub preprocess_inline (@) {
foreach my $p (@list) {
add_depends($params{page}, $p, deptype($quick ? "presence" : "content"));
}
+
+ @list = grep { exists $pagesources{$_} } @list;
}
else {
my $num=0;
diff --git a/IkiWiki/Plugin/trail.pm b/IkiWiki/Plugin/trail.pm
index 330d2a31d..34a2ca5b6 100644
--- a/IkiWiki/Plugin/trail.pm
+++ b/IkiWiki/Plugin/trail.pm
@@ -26,10 +26,12 @@ sub import {
#
# * $pagestate{$T}{trail}{contents}
# Reference to an array of lists each containing either:
-# - [link, "link"]
+# - [pagenames => "page1", "page2"]
+# Those literal pages
+# - [link => "link"]
# A link specification, pointing to the same page that [[link]]
# would select
-# - [pagespec, "posts/*", "age", 0]
+# - [pagespec => "posts/*", "age", 0]
# A match by pagespec; the third array element is the sort order
# and the fourth is whether to reverse sorting
#
@@ -148,8 +150,8 @@ sub preprocess_trailitems (@) {
}
if (exists $params{pagenames}) {
- my @list = map { [link => $_] } split ' ', $params{pagenames};
- push @{$pagestate{$params{page}}{trail}{contents}}, @list;
+ push @{$pagestate{$params{page}}{trail}{contents}},
+ [pagenames => (split ' ', $params{pagenames})];
}
return "";
@@ -271,6 +273,19 @@ sub prerender {
$c->[1], sort => $c->[2],
reverse => $c->[3]);
}
+ elsif ($c->[0] eq 'pagenames') {
+ my @pagenames = @$c;
+ shift @pagenames;
+ foreach my $page (@pagenames) {
+ if (exists $pagesources{$page}) {
+ push @$members, $page;
+ }
+ else {
+ # rebuild trail if it turns up
+ add_depends($trail, $page, deptype("presence"));
+ }
+ }
+ }
elsif ($c->[0] eq 'link') {
my $best = bestlink($trail, $c->[1]);
push @$members, $best if length $best;