ikiwiki/doc/bugs/entirely_negated_pagespec_m...

31 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2008-09-30 21:16:45 +02:00
A [[PageSpec]] that is entirely negated terminals, such as "!foo and !bar"
matches all other pages, including all internal pages. This can lead to
unexpected results, since it will match a bunch of recentchanges pages,
etc.
2009-01-06 21:40:50 +01:00
Recall that internal-use pages are not matched by a glob. So "\*" doesn't
match them. So if the pagespec is "\* and !foo and !bar", it won't match
2008-09-30 21:16:45 +02:00
them. This is the much more common style.
There's an odd inconsistency with entirely negated pagespecs. If "!foo"
matches page bar, shouldn't "" also match bar? But, the empty pagespec is
actually special-cased to not match anything.
Indeed, it seems what would be best would be for "!foo" to not match any
pages, unless it's combined with a terminal that positively matches pages
("* and !foo"). Although this would be a behavior change, with transition
issues.
Another approach would be to try to detect the case of an entirely negated
pagespec, and implicitly add "and !internal()" to it.
Either approach would require fully parsing the pagespec. And consider cases
like "!(foo and !bar)". Doesn't seem at all easy to solve. --[[Joey]]
> It occurs to me that at least one place in ikiwiki optimizes by assuming
> that pagespecs not mentioning the word "internal" never match internal
> pages. I wonder whether this bug could be solved by making that part of
> the definition of a pagespec, rather than a risky optimization
> like it is now? That seems strange, though - having this special case
> would make pagespecs significantly harder to understand. --[[smcv]]