X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/e04cb5c01362da8f597342fd38167910050bf0cd..2f2a721043a27b3b423f0a0270ea7f125883e0f3:/doc/todo/pagespec_relative_to_a_target.mdwn?ds=sidebyside diff --git a/doc/todo/pagespec_relative_to_a_target.mdwn b/doc/todo/pagespec_relative_to_a_target.mdwn index 638cd40f7..00030cce6 100644 --- a/doc/todo/pagespec_relative_to_a_target.mdwn +++ b/doc/todo/pagespec_relative_to_a_target.mdwn @@ -57,7 +57,7 @@ diff -urNX ignorepats ikiwiki/IkiWiki/Plugin/relative.pm ikidev/IkiWiki/Plugin/r + +package IkiWiki::PageSpec; + -+sub match_relative($$;@) { #{{{ ++sub match_relative($$;@) { + my $parent = shift; + my $spec = shift; + my %params = @_; @@ -69,21 +69,33 @@ diff -urNX ignorepats ikiwiki/IkiWiki/Plugin/relative.pm ikidev/IkiWiki/Plugin/r + } + } + return IkiWiki::FailReason->new("$parent can't match $spec against anything"); -+} #}}} ++} + -+sub match_has_child($$;@) { #{{{ ++sub match_has_child($$;@) { + my $page = shift; + my $childname = shift; + my $spec; -+ if ($childname) { #{{{ ++ if ($childname) { + $spec = "$page/$childname or $page/*/$childname"; -+ } #}}} -+ else { #{{{ ++ } ++ else { + $spec = "$page/*"; -+ } #}}} ++ } + + return match_relative($page, $spec, @_); -+} #}}} ++} + +1 - \ No newline at end of file + + +[[!tag patch]] + +> This looks really interesting. It reminds me of [[!wikipedia XPath]] and its conditionals. +> Those might actually work well adapted to pagespecs. For instance, to write +> "match any page with a child blah", you could just write *[blah] , or if you +> don't want to use relative-by-default in the conditionals, *[./blah]. +> -- [[JoshTriplett]] + +> And it [[!taglink also_reminds_me|pagespec_in_DL_style]] of [[!wikipedia description logics]]: of course, given the relation `subpage` one could write a description-logic-style formula which would define the class of pages that are ("existentially") in a given relation (`subpage` or `inverse(subpage)*subpage`) to a certain other class of pages (e.g., named "blah") ("existentially" means there must exist a page, e.g., named "blah", which is in the given relation to the candidate). + +> Probably the model behind XPath is similar (although I don't know enough to say this definitely).--Ivan Z.