]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/entirely_negated_pagespec_matches_internal_pages.mdwn
-bug
[ikiwiki.git] / doc / bugs / entirely_negated_pagespec_matches_internal_pages.mdwn
1 A [[PageSpec]] that is entirely negated terminals, such as "!foo and !bar"
2 matches all other pages, including all internal pages. This can lead to
3 unexpected results, since it will match a bunch of recentchanges pages,
4 etc.
5
6 Recall that internal-use pages are not matched by a glob. So "\*" doesn't
7 match them. So if the pagespec is "\* and !foo and !bar", it won't match
8 them. This is the much more common style.
9
10 There's an odd inconsistency with entirely negated pagespecs. If "!foo"
11 matches page bar, shouldn't "" also match bar? But, the empty pagespec is
12 actually special-cased to not match anything.
13
14 Indeed, it seems what would be best would be for "!foo" to not match any
15 pages, unless it's combined with a terminal that positively matches pages
16 ("* and !foo"). Although this would be a behavior change, with transition
17 issues.
18
19 Another approach would be to try to detect the case of an entirely negated
20 pagespec, and implicitly add "and !internal()" to it.
21
22 Either approach would require fully parsing the pagespec. And consider cases
23 like "!(foo and !bar)". Doesn't seem at all easy to solve. --[[Joey]]
24
25 > It occurs to me that at least one place in ikiwiki optimizes by assuming
26 > that pagespecs not mentioning the word "internal" never match internal
27 > pages. I wonder whether this bug could be solved by making that part of
28 > the definition of a pagespec, rather than a risky optimization
29 > like it is now? That seems strange, though - having this special case
30 > would make pagespecs significantly harder to understand. --[[smcv]]