]> sipb.mit.edu Git - ikiwiki.git/blobdiff - doc/ikiwiki/pagespec/discussion.mdwn
(no commit message)
[ikiwiki.git] / doc / ikiwiki / pagespec / discussion.mdwn
index 2b2008001792c51f81f0a9c8448bdc863e914570..2857a98ba8f13b1aadb1a69bc68b0039c891545f 100644 (file)
@@ -127,3 +127,44 @@ I'd like to create a collapsable tree with a map, eg
 but I can't work out how to specify "all items at this level, and all directories at ../ and all the other directories to the root
 
 any ideas?
+
+> I don't think pagespecs currently support that. How would such a made-up
+> pagespec look? I can imagine it supporting something like `glob(../*) and not
+> glob(../*/*)` to match all "directories" of the parent page, and so on up
+> to the root. --[[Joey]] 
+
+>> I don't know, perhaps some way of nesting pagespecs 
+>>> glob(../* unless $_ eq 'second level item'{ glob 'second level item'/*}) 
+
+>> but that could get messy, perhaps a new cmd 'pagetree' or something 
+>> might be better? --Colin
+
+>>> You could probably do a lot worse than stealing terminology from 
+>>> [XPath Axes](http://www.w3.org/TR/xpath/#axes),
+>>> passing the "argument" through `bestlink` if there is one, and
+>>> treating an empty argument as "this page", something like:
+>>>
+>>> * `ancestor(/plugins/contrib/album)` matches `plugins` or
+>>>   `plugins/contrib`
+>>>   but not `plugins/map` or `plugins/contrib/album`
+>>>   (does it match `index`? answers on a postcard)
+>>> * `descendant(/plugins)` is basically `plugins/*`
+>>> * `child(/plugins)` is basically `plugins/* and !plugins/*/*`
+>>> * `self(/plugins)` is just `plugins` but without interpreting
+>>>   globs
+>>> * `ancestor-or-self(/plugins)`, `descendant-or-self(/plugins)`
+>>>   are syntactic sugar for e.g. `ancestor(/plugins) or self(/plugins)`
+>>> * `self()` always matches the current page (not destpage)
+>>> * `ancestor-or-self()` always matches the current pages and all
+>>>   pages that would go in its [[plugins/parentlinks]]
+>>>
+>>> XPath has `following-sibling` and `preceding-sibling` axes for
+>>> siblings, but pagespecs are unordered, so we'd probably want
+>>> to invent `sibling()` - so `sibling(/plugins/map)` matches
+>>> `plugins/inline` but not `plugins/map` or `plugins/contrib/album`.
+>>>
+>>> Then, the requested functionality would be `sibling() or ancestor()`,
+>>> or possibly `sibling() or ancestor() or self()`?
+>>> --[[smcv]]
+
+>>>> I like that idea! --[[KathrynAndersen]]