Si vous ne parvenez pas à modifier le wiki après avoir ouvert votre session, vous devrez en demander les droits d'édition en utilisant ce formulaire. Vous serez averti lorsque les droits d'édition seront accordés.

Aide:Mots magiques

De FamilySearch Wiki
Sauter à la navigation Sauter à la recherche


aide à la traduction Mots magiques dans wikipedia

Help-content.png Cet Article Aide vous guidera pour l'édition dans Wiki. Voir Aide contributeur pour participer davantage aux articles.
Visitez le Forum Aide Wiki si vous avez des questions.


La plupart des informations de cette page expliquent les options données aux utilisateurs qui souhaitent créer des modèles avec des fonctions avancées. La plupart des utilisateurs ne seront intéressés que par certains des commutateurs de comportement énumérés ci-dessous.


Les Mots magiques (ce qui inclut les fonctions Parser, les variables et les commutateurs de comportement) sont spécifiques au wikitext qui permettent aux différentes instructions d'être transmises au logiciel MediaWiki (par exemple, de supprimer ou de positionner la table des matières), ou bien servir à produire une sortie variable, comme il est souvent nécessaire dans les modèles.

A quick reference for magic words can be found on this page. For more complete and updated documentation, refer to following pages on the MediaWiki site:

  • Modèle:Mw for all standard magic words, including the "standard" parser functions
  • Modèle:Mw for some additional parser functions, including conditional expressions

Informations générales[modifier | modifier le wikicode]

Il existe trois types de mots magiques:

Commutateurs de comportement - les mots en majuscules entourées par des traits de soulignement doubles, e.g. __NOTOC__, ou les mots clés utilisant la syntaxe de la fonction Parser
Variables - uppercase words surrounded by double braces, e.g. {{PAGENAME}} (thus resembling templates)
Fonctions Parser - keywords (some beginning #) in double braces with parameters after a colon, e.g. {{#expr:2+2}}


Quelques mots magiques sont insensible à la casse, mais pas tous. Whitespace is stripped from the start and end of keywords and parameters, as in template syntax. Page-dependent magic words will affect or return data about the current page, even if the word is added through a transcluded template or included system message. It is possible to substitute parser functions and variables in the same way that templates are substituted (using the subst: keyword). This causes their current value (as evaluated at the time of substitution) to be written into the wikitext.

Commutateurs de comportement[modifier | modifier le wikicode]

For documentation, refer to the Modèle:Mw section of the MediaWiki page.

Libellé Description
__TOC__ (places a table of contents at the word's position)
__NOTOC__ (can appear anywhere in the wikitext; suppresses the table of contents)
__FORCETOC__ (can appear anywhere in the wikitext; makes a table of contents appear in its normal position above the first header)
__NOEDITSECTION__ (hides the section edit links beside headings)
__NEWSECTIONLINK__ (adds a "+" link for adding a new section on a non-"Talk" page)
__NONEWSECTIONLINK__ (removes the "+" link on "Talk" pages)
__NORICHEDITOR__ (prevents the FCK editor from being used to edit a page)
__NOGALLERY__ (on a category page, replaces thumbnails with normal links)
__HIDDENCAT__ (on a category page, makes it a hidden category)
__INDEX__ (tells search engines to index the page)
__NOINDEX__ (tells search engines not to index the page)
{{DISPLAYTITLE:title}} (changes the displayed form of the page title)
{{DEFAULTSORT:sortkey}} (sets a default category sort key)

Variables[modifier | modifier le wikicode]

For documentation, refer to the Modèle:Mw section of the MediaWiki page.

Variable Résultat Description
{{FULLPAGENAME}} Aide:Mots magiques (page title including namespace)
{{PAGENAME}} Mots magiques (page title excluding namespace)
{{BASEPAGENAME}} Mots magiques (page title excluding subpage and namespace)
{{SUBPAGENAME}} Mots magiques (subpage part of title)
{{SUBJECTPAGENAME}} Aide:Mots magiques (associated non-talk page)
{{TALKPAGENAME}} Discussion aide:Mots magiques (associated talk page)
{{NAMESPACE}} Aide (namespace of current page)
{{SUBJECTSPACE}}, {{ARTICLESPACE}} Aide
Aide
(associated non-talk namespace)
{{TALKSPACE}} Discussion aide (associated talk namespace)
{{FULLPAGENAMEE}}, {{NAMESPACEE}} Aide:Mots magiques,
Aide
etc. (URL-encoded equivalents)

The above can all take a parameter, to operate on a page other than the current page.

Variable Résultat Description
{{SITENAME}} FamilySearch Wiki Site name
{{SERVER}} https://paas-loadb-dhtaff8ujtdt-1826058300.us-east-1.elb.amazonaws.com Server
{{SERVERNAME}} paas-loadb-dhtaff8ujtdt-1826058300.us-east-1.elb.amazonaws.com Server name
{{SCRIPTPATH}} /wiki/fr Script path
{{CURRENTVERSION}} 1.32.6 (5807cdf) (current MediaWiki version)
{{REVISIONID}} 13300 (latest revision to current page)
{{REVISIONDAY}}, {{REVISIONDAY2}}, {{REVISIONMONTH}}, {{REVISIONYEAR}}, {{REVISIONTIMESTAMP}}, {{REVISIONUSER}} 25, 25,
11, 2014,
20141125173157, Mtpichon
(date, time, editor at last edit)
{{CURRENTYEAR}}, {{CURRENTMONTH}}, {{CURRENTMONTHNAME}}, {{CURRENTMONTHABBREV}}, {{CURRENTDAY}}, {{CURRENTDAY2}}, {{CURRENTDOW}}, {{CURRENTDAYNAME}}, {{CURRENTTIME}}, {{CURRENTHOUR}}, {{CURRENTWEEK}}, {{CURRENTTIMESTAMP}} 2020, 09
septembre
sept., 26
26, 6
samedi, 04:55
04, 39
20200926045520
(current date/time variables)
{{LOCALYEAR}} 2020 etc. (as above, based on site's local time)
{{NUMBEROFPAGES}}, {{NUMBEROFARTICLES}}, {{NUMBEROFFILES}}, {{NUMBEROFEDITS}}, {{NUMBEROFVIEWS}}, {{NUMBEROFUSERS}}, {{NUMBEROFADMINS}}, {{NUMBEROFACTIVEUSERS}} 3 537, 831
710, 28 518
Modèle:NUMBEROFVIEWS, 12 060
25
2
(statistics on FamilySearch Wiki; add :R to return numbers without commas)
{{CURRENTMONTHNAMEGEN}} septembre See notes below.



Espace de noms[modifier | modifier le wikicode]

Variable Résultat
{{ns:1}} Discussion
{{ns:2}} Utilisateur
{{ns:3}} Discussion utilisateur
{{ns:4}} FamilySearch Wiki
{{ns:5}} Discussion FamilySearch Wiki
{{ns:6}} Fichier
{{ns:7}} Discussion fichier
{{ns:8}} MediaWiki
{{ns:9}} Discussion MediaWiki
{{ns:10}} Modèle
{{ns:11}} Discussion modèle
{{ns:12}} Aide
{{ns:13}} Discussion aide
{{ns:14}} Catégorie
{{ns:15}} Discussion catégorie

Fonctions Parser[modifier | modifier le wikicode]

These are documented at the Modèle:Mw unless otherwise stated.

Méta-données[modifier | modifier le wikicode]

Parser function Description
{{PAGESIZE:page name}} (size of page in bytes)
{{PROTECTIONLEVEL:action}} (protection level for given action on the current page)
{{PAGESINCATEGORY:categoryname}} (number of pages in the given category)
{{NUMBERINGROUP:groupname}} (number of users in a specific group)

Add |R to return numbers without commas.

Mise en forme[modifier | modifier le wikicode]

Parser function Description
{{lc:string}} (convert to lower case)
{{lcfirst:string}} (convert first character to lower case)
{{uc:string}} (convert to upper case)
{{ucfirst:string}} (convert first character to upper case)
{{formatnum:unformatted num}} (format a number with comma separators; add |R to unformat a number)
{{#formatdate:date}} (formats a date according to user preferences; a default can be given as a second parameter for users without date preference); however, please note that the community voted against the concept of date-autoformatting in the Modèle:Wpd, and that there is considerable opposition to the use of this parser function.
{{padleft:xyz|stringlength}}, {{padright:xyz|stringlength}} (pad with zeros to the right or left; an alternative padding string can be given as a third parameter)
{{plural:n|is|are}} (produces alternative text according to whether n is greater than 1)
{{#time: format string | date/time object }} (for date/time formatting; also #timel for local time. Covered at the Modèle:Mw.)

Paths (chemins ou pistes)[modifier | modifier le wikicode]

Parser function Description
{{localurl:page name}}, {{localurl:page name|query string}} (relative path to the title)
{{fullurl:page name}}, {{fullurl:page name|query_string}} (absolute path to the title)
{{filepath:file name}} (absolute URL to a media file)
{{urlencode:string}} (input encoded for use in URLs)
{{anchorencode:string}} (input encoded for use in URL section anchors)
{{ns:n}} (name for the namespace with index n; use {{nse:}} for URL-encoded equivalent)
{{#rel2abs: path }} (converts a relative file path to absolute; see the Modèle:Mw)
{{#titleparts: pagename | number of segments to return | first segment to return }} (splits title into parts; see the Modèle:Mw)

Expressions conditionnelles[modifier | modifier le wikicode]

These are covered at the Modèle:Mw. Some parameters are optional.

Parser function Description
{{#expr: expression }} (evaluates the given expression; see Aide:Calculation)
{{#if: test string | value if non-empty | value if empty }} (selects one of two values based on whether the test string is empty)
{{#ifeq: string 1 | string 2 | value if equal | value if unequal }} (selects one of two values based on whether the test strings are equal – numerically if applicable)
{{#iferror: test string | value if error | value if correct }} (selects value based on whether the test string generates a parser error)
{{#ifexpr: expression | value if true | value if false }} (selects value based on evaluation of expression)
{{#ifexist: page title | value if exists | value if doesn't exist }} (selects value depending on whether a page title exists)
{{#switch: test | case1 = value for case 1 | ... | default }} (provides alternatives based on the value of the test string)

For the use of these functions in tables, see Conditional tables.

Voir aussi[modifier | modifier le wikicode]

Help-content.png Des questions?
Visitez le Get Help pour obtenir de l'aide à la contribution Wiki.
Modèle:Editing help

__NORICHEDITOR__