1 It seems that the [[ikiwiki/directive/inline]] directive doesn't generate wikilinks to the pages it includes. For example I would expect the following to inline all bugs inside this bug report:
3 \[[!inline pages="bugs/* and !*/discussion and backlink(bugs)" feeds=no postform=no archive=yes show="10"]]
7 [[!inline pages="bugs/* and !*/discussion and backlink(bugs)" feeds=no postform=no archive=yes show="10"]]
9 and note that it only included the 'normal' wikilinks (and also note that this page is not marked done even though the done page is inlined).
10 One might also wonder if inline would make this page link to any internal links on those inlined pages too, but I think
11 that would be overkill.
13 I'm not even really sure if this is a bug or defined behaviour, but I thought it might work and it didn't. Regardless,
14 the correct behaviour, whichever is decided, should be documented. -- [[Will]]
16 It appears that [[ikiwiki/directive/map]] also doesn't wikilink to the pages it links. Perhaps in each of these
17 cases there should be another parameter to the directive that allows linking to switched on. Just switching
18 it on universally at this point might break a number of people's pagespecs. -- [[Will]]
20 > There's a simple reason why these directives don't generate a record of a
21 > wikilink between them and the pages they include: Semantically, inlining
22 > a page is not the same as writing a link to it. Nor is generating a map that
23 > lists a page the same as linking to it. I don't think this is a bug.
26 >> Fair enough. I guess we can mark this as [[done]] then.
28 >> Just a bit of background on where I was going here... I was looking for
29 >> a simpler way of attacking [[todo/tracking_bugs_with_dependencies]].
30 >> In particular, rather than introducing changes to the pagespec definition,
31 >> I wondered if you could use wiki pages as the defined pagespec and
32 >> introduce a 'match_mutual' function which matches whenever two pages
33 >> link to the same third page, then you don't need to alter the pagespec
36 >> But that requires being able use use a pagespec to decide what pages
37 >> are linked to. e.g. I want to make an 'openbugs' page that links to all
38 >> open bugs. Then I could make a 'readybugs' page that links to
39 >> `backlink(openbugs) and !mutualLink(openbugs)`. That is, all bugs
40 >> that are open and do not themselves link to an open bug.
42 >> The problem with all this is that it introduces an ordering dependency,
43 >> as I noted below. I think the original proposal is better, because it
44 >> handles that ordering dependency in the definition of the pagespecs.
47 Here is a patch to make map link to its linked pages (when passed `link="yes"`). It is a bit problematic in that it uses a pagespec
48 to decide what to link to (which is why I wanted it). However, at the time the pagespec is used the links
49 for each page haven't finished being calculated (we're using the pagespec to figure out those links,
50 remember). This means that some pagespec match functions may not work correctly. Sigh.
51 It would be nice to find a topological ordering of the pages and scan them in that order
52 so that everything we need is found before we need it, but this patch doesn't do that (it would be
55 If you just use simple pagespecs you'll be fine. Unfortunately I really wanted this for more complex
56 pagespecs. -- [[Will]]
58 diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm
59 index 3284931..57c0a7a 100644
60 --- a/IkiWiki/Plugin/map.pm
61 +++ b/IkiWiki/Plugin/map.pm
62 @@ -13,7 +13,7 @@ use IkiWiki 3.00;
65 hook(type => "getsetup", id => "map", call => \&getsetup);
66 - hook(type => "preprocess", id => "map", call => \&preprocess);
67 + hook(type => "preprocess", id => "map", call => \&preprocess, scan => 1);
71 @@ -27,7 +27,9 @@ sub getsetup () {
74 $params{pages}="*" unless defined $params{pages};
77 + return if (!defined wantarray && !IkiWiki::yesno($params{link}));
81 # Get all the items to map.
82 @@ -42,6 +44,9 @@ sub preprocess (@) {
86 + if (!defined wantarray && IkiWiki::yesno($params{link})) {
87 + push @{$links{$params{page}}}, $page;
89 # Check for a common prefix.
90 if (! defined $common_prefix) {
92 @@ -62,6 +67,8 @@ sub preprocess (@) {
96 + return if ! defined wantarray;
98 # Common prefix should not be a page in the map.
99 while (defined $common_prefix && length $common_prefix &&
100 exists $mapitems{$common_prefix}) {