]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/conditional_preprocess_during_scan.mdwn
bug responses
[ikiwiki.git] / doc / bugs / conditional_preprocess_during_scan.mdwn
1 [[!template id=gitbranch branch=GiuseppeBilotta/scanif author="Giuseppe Bilotta"]]
2
3 When a directive that should be run during scan preprocessing is inside
4 an if directive, it doesn't get called because the if preprocessing does
5 not run during scan.
6
7 I've written a simple [[patch]] to fix the issue, currently hosted on the
8 scanif branch of my repository. The patch also passes the preview option
9 back to the Ikiwiki::preprocess call, making sure that whatever is being
10 reprocessed is done so in the same conditions as the original call.
11
12 > One problem with this is that it has the same dependency-ordering problems
13 > as inline-based or pagespec-based trails with my [[plugins/contrib/trail]]
14 > plugin: `if` takes a pagespec, but pagespecs aren't guaranteed to match
15 > correctly until everything has been scanned (for instance, `link()` might
16 > give the wrong results because a page that added or deleted a link hasn't
17 > been scanned yet). If you have a clever idea for how to fix this, I'd love
18 > to hear it - being able to specify a [[plugins/contrib/trail]] in terms
19 > of a sorted pagespec would be useful. --[[smcv]]
20
21 >> I have a solution to the dependency-ordering problem in a different
22 >> branch of my repository, with a post_scan hook mechanism which I use to
23 >> be able to sort outer inline pages according to the last modification
24 >> date of their nested inline pages. The way I implemented it currently,
25 >> though, doesn't use the existing hooks mechanism of ikiwiki (because
26 >> it's something which I believe to be more efficiently done the way I
27 >> implemented it) so I don't know how likely it is to be included
28 >> upstream.
29
30 >> For what it's worth, I think that my post_scan hook mechanism would work
31 >> rather fine with your trail plugin. However, the case of the if
32 >> directive is considerably more complicated, because the conditional
33 >> can introduce a much stronger feedback effect in the pre/post scanning
34 >> dependency. In fact, it's probably possible to build a couple of pages
35 >> with vicious conditional dependency circles that would break/unbreak
36 >> depending on which pass we are in. And I believe this is an intrinsic
37 >> limitation of the system, which cannot be solved at all.