Extension:PageInCat

What can this extension do?
This extension adds a parser function that is similar to the function from extension:ParserFunctions. It works as follows (Page is a member of category Foo only if it is not a member of category Foo) is generally a bad idea (duh!). This could cause the page to alternate being in and not in the category. More generally, putting any sort of category link inside a  may cause unexpected behaviour since the extension can't tell if its in the category until after parsing the entire page. In general, for the purposes of, we consider the categories present the first time parsing the page as the categories the page is in.

If this sort of situation is detected during a preview, the following warning is presented at the top of the page:

Warning: The category Some category was detected incorrectly by, and as a result this preview may be incorrect. This can be caused by including categories inside of statements, and may result in inconsistent display.

Installation
Download thingy, put it in appropriate place in extensions directory, add line  to bottom of LocalSettings.php

Note, this will probably work for MediaWiki versions before 1.19 (provided its not super ancient), eventhough the download link only has a version for MediaWiki 1.19. If in doubt, try it out and see if it works with your version.

Configuration parameters

 * $wgPageInCatUseAccuratePreview
 * Defaults to true. Controls if to use more accurate previews (aka use the categories that are in the wiki-text you are previewing instead of the last saved revision). May cause previews to take twice as much time as they normally would (This includes previewing things not using  functions). If this is set to false, previews will often have   being evaluated incorrectly, but once the page is saved, they will be evaluated correctly.


 * $wgExpensiveParserFunctionLimit
 * Not directly a configuration parameter of this extension, but limits the number of times you can use  (and other expensive parser functions) in a page (Doing #incat twice for the same category only counts as one usage). This defaults to 100, which should be more than enough.