Extension:CategoryTests/fr

This page is a translated version of the page Extension:CategoryTests and the translation is 13% complete.
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 (Skizzerzdiscussion)
Dernière version 1.6.0 (2017-10-28)
MediaWiki 1.32+
PHP 5.3+
Licence Licence publique générale GNU v2.0 ou supérieur
Téléchargement
Téléchargements trimestriels 4 (Ranked 134th)
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

  • Téléchargez et placez le(s) fichier(s) dans un répertoire appelé CategoryTests dans votre dossier extensions/.
    Les développeurs et les contributeurs au code doivent à la place installer l'extension à partir de Git en utilisant:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTests
  • Ajoutez le code suivant à la fin de votre fichier LocalSettings.php  :
    wfLoadExtension( 'CategoryTests' );
    
  • Yes Fait – Accédez à Special:Version sur votre wiki pour vérifier que l'extension a bien été installée.

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