Extension:CategoryTests/fr

From Linux Web Expert

Manuel des extensions MediaWiki
Category Tests
État de la version : stable
Implémentation Fonction d'analyseur
Description Fournit un ensemble de contrôles des fonctions d'analyse syntaxique pour les catégories
Auteur(s) Ryan Schmidt (Skizzerztalk)
Dernière version 1.6.0 (2017-10-28)
MediaWiki 1.32+
PHP 5.3+
Licence Aucune licence spécifiée
Téléchargement
Téléchargements trimestriels Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Utilisé par les wikis publics Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Traduire l’extension CategoryTests sur translatewiki.net si elle y est disponible

The CategoryTests extension provides a set of dynamic parser functions that check for categories.

Usage

Actuellement trois fonctions d'analyse sont disponibles pour tester les catégories.

  • {{#ifcategory:category|then|else|page}}
Tests if the given page is in the category given, then displays "then" or "else" (or current page if no page is given).
  • {{#ifnocategories:then|else|page}}
Tests if the given page does not belong in any categories, then displays "then" or "else" (or current page if no page is given).
  • {{#switchcategory:category1=result1|category2=result2|...|default}}
Operates like the ParserFunctions #switch , but doesn't take an initial parameter (it just starts cycling through right away) and tests if the page is in those categories instead of comparing it to a value. You can specify to test other pages using #page=pagename, where it would then test that page instead of the current page until the next #page definition, in which case it will test that page now instead. Making #page empty resets it to the current page. If your default case needs an equals sign, you may use #default to declare it.

Installation

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/CategoryTests/fr</tvar>|Download]] and move the extracted <tvar name=name>CategoryTests/fr</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTests%2Ffr
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'CategoryTests/fr' );
    
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

See also

  • ParserFunctions - For more general conditional constructs
  • PageInCat - The main difference seems to be that PageInCat will always try to use categories from the current revision, while CategoryTests may sometimes use the categories from the previous revision, which could result in unexpected page content