Sponsored Links
-->

Thursday, December 7, 2017

Social Skills CD - Circle of Education
src: circleofeducation.com

Magic words (including parser functions, variables and behavior switches) are features of wiki markup that give instructions to Wikipedia's underlying MediaWiki software. For example, magic words can suppress or position the table of contents, disable indexing by external search engines, and produce output dynamically based on the current page or on user-defined conditional logic. Some of these features are especially useful for templates.

This page is a quick reference for magic words. For more information, refer to the main MediaWiki documentation:

  • mw:Help:Magic words: All standard magic words, including the "standard" parser functions.
  • mw:Help:Extension:ParserFunctions: Additional parser functions, including conditional expressions.


Video Help:Magic words



General information

In general, there are three types of magic words

  1. Behavior switches: often appear in double underscores, all uppercase, e.g., __NOTOC__. They will change the behavior of a page, rather than return a value.
  2. Parser functions: all in lowercase. A parser function will be followed by colon and pipe-separated parameters, e.g., {{#ifexpr:Y|Yes|No}}, wrapped in double braces. They will take a value and return a value.
  3. Variables: these are all uppercase, e.g., {{PAGENAME}}. A variable will be wrapped in double braces and will return a value in its place.

The software generally interprets magic words in the following way.

  • Magic words are case sensitive.
  • White space is generously allowed for readability. It will be stripped from the start and end of their keywords and parameters (as is also done inside templates).
  • They can be transcluded, even variables "about the current page". This is ensured by the parsing order.
  • Instead of magically transforming into HTML instructions, <nowiki> tags remove this magic so a magic word can itself be displayed (documented).

{{Magic}} words compared to {{template}}:

  • As with templates, magic words can be transcluded and substituted.
  • The names of {{magic words}} are purposely chosen to be unlike the names of {{templates}}, and vice versa. Many parser function names will begin with the # sign, but template names will not start with a # sign, and probably not end in a : colon character, or be all-uppercase.
  • The first parameter's syntax differs. In {{#magic: p1| p2 | p3}}, the name is #magic and it will be followed by an unspaced : colon and a required input parameter, p1. The first |p1= of a template is optional but would be preceded by a | pipe instead of a : colon.

Maps Help:Magic words



Behavior switches


DWC - Dating 411 TV - Dating with Confidence
src: datingwithconfidencecoaching.com


Variables

Note: The magic words above can also take a parameter, in order to parse values on a page other than the current page. A colon ( : ) is used to pass the parameter, rather than a pipe ( | ) that is used in templates, like {{MAGICWORD:value}}. For example, {{TALKPAGENAME:Wikipedia:MOS}} returns Wikipedia talk:MOS on any page. See meta:Help:Page name for more details of parser functions.

Note: In the "Category" and "Category talk" namespaces, to wikilink (some) page name variables may require prefixing a colon to avoid unwanted categorization.

Other variables by type

a {{REVISIONID}} cannot be substituted and does not function in preview.
b English Wikipedia.
c This shows the last user to edit the page. There is no way to show the user viewing the page due to technical issues.

How to Use Power Words to Create Real Magic - YouTube
src: i.ytimg.com


Parser functions

Metadata

To output numbers without comma separators (for example, as "123456789" rather than "123,456,789"), append the parameter |R.

Formatting

Paths

Conditional

If, in these conditional functions, empty unnamed parameters are to be parsed as empty rather than as text (i.e. as empty rather than as the text "{{{1}}}", "{{{2}}}", etc.), they will require trailing pipes (i.e. {{{1|}}}, {{{2|}}}, etc., rather than {{{1}}}, {{{2}}}, etc.).

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

Other


5 Easy And Effective Ways To Ease Kids' Stress | Activities, Child ...
src: s-media-cache-ak0.pinimg.com


See also

  • Help:Magic links - for ISBN, PMID and RFC
  • mw:Localisation
  • mw:Manual:Extending wiki markup
  • CoreParserFunctions.php
  • wikEd, a MediaWiki editor with syntax highlighting for templates and parser functions
  • Preferences -> Gadgets -> Editing -> Syntax highlighter
  • Preferences -> Beta features -> Wiki syntax highlighting
  • Special:Version, at the bottom of the page, all the {{magic words}} on this page are listed there as Parser function hooks

Source of article : Wikipedia