1 A couple of suggestions for improving the usefulness of pagespecs:
3 * @ to match [^/]* (i.e. all pages exactly one level below this one)
4 * initial ./ to mean "from the page the pagespec is running from".
5 This would require some architectural changes and a change to the
6 interface for pagespec_match. What do you think? I have
7 lots of pages a/b/c.mdwn that inline "a/b/c/*".
11 > I want this too, so that the [[examples]] can use pagespecs that don't
12 > have to be changed when the pages are moved around. I don't know how I
13 > feel about the "@" thing, but "./" seems good. I take it you've looked at
14 > how to implement it?
16 > It's worth mentioning that there's a bit of an inconsistency; wikilinks
17 > match relative by default and absolute if prefixed with a "/", while
18 > pagespecs match absolute by default. It would be nice to clear up that
19 > inconsistency somehow, it's on my little list of things in ikiwiki that
20 > arn't ideal. :-) --[[Joey]]
22 I've looked at how to implement "./", yes, and I was a little hesitant
23 to disturb the elegant implementation of pagespecs as it is now. That's
24 why I wrote this todo item rather than just a patch. :) As I see it,
25 the simplest thing to do is check globs when building the pagespec
26 expression and translate "./foo" to "$from.'/foo'" in the resulting
27 expression, and then add the $from paramater to pagespec_match. This does
28 require an API change for all plugins which use pagespecs but hopefully
29 it should be minor. I will work on a patch tomorrow.
31 My use case for "@" (which is kind of a crummy symbol, but whatever) is
32 my [projects page](http://www.betacantrips.com/projects/). I want to inline
33 "summary" or "introduction" pages that are exactly one level below the
34 inlining page, but not tarballs or other junk that might be in
35 subdirectories. (The issue is confounded here because of my index.mdwn
36 patch, but the principle is the same.) I chose "@" because it's similar in
37 physical shape to "*" but enclosed, suggesting limitations. I also thought
38 it would be useful in simplifying hacks like in [[plugins/map]] but I see
39 now that I was mistaken.. "four or fewer levels deep" would be
40 "@ or @/@ or @/@/@ or @/@/@/@". Well, I think it has a certain appeal but
41 I can see why it might not be much of an improvement. :) --Ethan
43 > OK, I took a shot at implementing the changes. I was thinking about making
44 > pagespecs relative by default but I couldn't decide whether page
45 > `foo/bar` inlining `*` should match `foo/bar/*` or `foo/*`.
46 > So I punted and left things as absolute, with `./*` matching
47 > `foo/bar/*`, which I think is pretty clear.
48 > The patch is at [ikidev](http://ikidev.betacantrips.com/patches/pagespec_enhancements.patch)
49 > and you can see it work at
50 > [this page](http://ikidev.betacantrips.com/one/two/three/index.html) or
51 > [this page](http://ikidev.betacantrips.com/one/two/three/princess.html) --Ethan