From 58141a0ebcdf3313a83af712b83f8acd1c08aa3b Mon Sep 17 00:00:00 2001 From: joey Date: Tue, 6 Feb 2007 21:17:25 +0000 Subject: * Patch based on a patch from Ethan to support relative matching in PageSpecs, by using "./". pagespec_match() has grown a new third parameter to support this. --- doc/examples/blog/index.mdwn | 6 +++--- doc/examples/blog/posts.mdwn | 2 +- doc/examples/blog/sidebar.mdwn | 2 +- doc/examples/blog/tags.mdwn | 2 +- doc/examples/blog/tags/life.mdwn | 2 +- doc/examples/softwaresite/news.mdwn | 2 +- doc/plugins/write.mdwn | 8 +++++--- doc/todo/pagespec_expansions.mdwn | 37 ++++++++++++++++++++++++++++--------- 8 files changed, 41 insertions(+), 20 deletions(-) (limited to 'doc') diff --git a/doc/examples/blog/index.mdwn b/doc/examples/blog/index.mdwn index 201abed20..0a4eb7307 100644 --- a/doc/examples/blog/index.mdwn +++ b/doc/examples/blog/index.mdwn @@ -1,10 +1,10 @@ [[meta title="example blog"]] -[[pagestats pages="*blog/tags/*"]] +[[pagestats pages="./tags/*"]] Welcome to my blog. Have a look at the most recent posts below, or browse the tag cloud on the right. An archive of all [[posts]] is also available. -[[inline pages="*blog/posts/* and !*/Discussion" show="10" -actions=yes rootpage="*blog/posts"]] +[[inline pages="./posts/* and !*/Discussion" show="10" +actions=yes rootpage="./posts"]] diff --git a/doc/examples/blog/posts.mdwn b/doc/examples/blog/posts.mdwn index f5b128df0..71eb9f1b1 100644 --- a/doc/examples/blog/posts.mdwn +++ b/doc/examples/blog/posts.mdwn @@ -1,3 +1,3 @@ Here is a full list of posts to my [[blog|index]]. -[[inline pages="*blog/posts/* and !*/Discussion" archive=yes feedshow=10 quick=yes]] +[[inline pages="./posts/* and !*/Discussion" archive=yes feedshow=10 quick=yes]] diff --git a/doc/examples/blog/sidebar.mdwn b/doc/examples/blog/sidebar.mdwn index 203d2e0c6..e9a76c19b 100644 --- a/doc/examples/blog/sidebar.mdwn +++ b/doc/examples/blog/sidebar.mdwn @@ -1,4 +1,4 @@ Example sidebar Categories: -[[map pages="*blog/tags/* and !*/Discussion"]] +[[map pages="./tags/* and !*/Discussion"]] diff --git a/doc/examples/blog/tags.mdwn b/doc/examples/blog/tags.mdwn index 08e7e5c57..daf77549a 100644 --- a/doc/examples/blog/tags.mdwn +++ b/doc/examples/blog/tags.mdwn @@ -1,3 +1,3 @@ -[[pagestats pages="*blog/tags/*"]] +[[pagestats pages="./tags/*"]] On the right you can see the tag cloud for this blog. diff --git a/doc/examples/blog/tags/life.mdwn b/doc/examples/blog/tags/life.mdwn index b6cf801e1..2f7a57379 100644 --- a/doc/examples/blog/tags/life.mdwn +++ b/doc/examples/blog/tags/life.mdwn @@ -1,4 +1,4 @@ This feed contains pages in the "life" category. -[[inline pages="link(tags/life) and *blog/posts/* and !*/Discussion" +[[inline pages="link(tags/life) and ./posts/* and !*/Discussion" show="10" actions=yes]] diff --git a/doc/examples/softwaresite/news.mdwn b/doc/examples/softwaresite/news.mdwn index cdee4fa59..20642c203 100644 --- a/doc/examples/softwaresite/news.mdwn +++ b/doc/examples/softwaresite/news.mdwn @@ -2,4 +2,4 @@ This is where annoucements of new releases, features, and other news is posted. FooBar users are recommended to subscribe to this page's RSS feed. -[[inline pages="*softwaresite/news/* and !*/Discussion" rootpage="news" show="30"]] +[[inline pages="./news/* and !*/Discussion" rootpage="news" show="30"]] diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index d0f256ca2..d822408c2 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -312,10 +312,12 @@ page created from it. (Ie, it appends ".html".) Makes the specified page depend on the specified [[PageSpec]]. -#### `pagespec_match($$)` +#### `pagespec_match($$;$)` -Passed a page name, and a [[PageSpec]], returns true if the [[PageSpec]] -matches the page. +Passed a page name, a [[PageSpec]], and the location the glob should be +matched against, returns true if the [[PageSpec]] matches the page. (If the +third parameter is not passed, relative PageSpecs will match relative to +the top of the wiki.) #### `bestlink($$)` diff --git a/doc/todo/pagespec_expansions.mdwn b/doc/todo/pagespec_expansions.mdwn index 74fe9c13c..111217948 100644 --- a/doc/todo/pagespec_expansions.mdwn +++ b/doc/todo/pagespec_expansions.mdwn @@ -40,12 +40,31 @@ now that I was mistaken.. "four or fewer levels deep" would be "@ or @/@ or @/@/@ or @/@/@/@". Well, I think it has a certain appeal but I can see why it might not be much of an improvement. :) --Ethan -> OK, I took a shot at implementing the changes. I was thinking about making -> pagespecs relative by default but I couldn't decide whether page -> `foo/bar` inlining `*` should match `foo/bar/*` or `foo/*`. -> So I punted and left things as absolute, with `./*` matching -> `foo/bar/*`, which I think is pretty clear. -> The patch is at [ikidev](http://ikidev.betacantrips.com/patches/pagespec_enhancements.patch) -> and you can see it work at -> [this page](http://ikidev.betacantrips.com/one/two/three/index.html) or -> [this page](http://ikidev.betacantrips.com/one/two/three/princess.html) --Ethan \ No newline at end of file +> Seems to me that ".." would be the natural thing to use, not "@". --[[Joey]] + +OK, I took a shot at implementing the changes. I was thinking about making +pagespecs relative by default but I couldn't decide whether page +`foo/bar` inlining `*` should match `foo/bar/*` or `foo/*`. +So I punted and left things as absolute, with `./*` matching +`foo/bar/*`, which I think is pretty clear. +The patch is at [ikidev](http://ikidev.betacantrips.com/patches/pagespec_enhancements.patch) +and you can see it work at +[this page](http://ikidev.betacantrips.com/one/two/three/index.html) or +[this page](http://ikidev.betacantrips.com/one/two/three/princess.html) --Ethan + +> Nice patch, though I see the following problems with it: +> * The sole pagespec_match in IkiWiki::Render probably should have `$p` +> as its third parameter. This will allow add_depends to add a +> dependency on a pagespec that matches relative to the page. I made this +> changes and it seems to work, new pages are noticed in updates. +> * `! $from` fails to match pages named "0" :-) +> * '/./ matches any letter, not just "." :-) :-) +> * One other major problem. If you look at the doc/examples/blog/index.mdwn +> I changed it to use relative globs like "./posts/*", but they didn't work, +> because it looked for examples/blog/indexposts/* instead of +> examples/blog/index/posts/*. And, of course, what I really expected it to +> look for was examples/blog/posts/*. I think you may have made the wrong +> choice about that, so I changed it to go the other way. What do you think? +> +> I've committed support for ./ to ikiwiki now, based on your patch. +> --[[Joey]] -- cgit v1.2.3