Help:Magic words/da

Magiske ord er tekststrenge, som MediaWiki forbinder med en returværdi eller funktion, såsom tid, hjemmeside-detaljer, eller side-navne. Denne side omhandler brug af standard magiske ord. Se for teknisk reference på dansk.

Der er tre almindelige typer af magiske ord:


 * Behavior switches: these are uppercase words surrounded by double underscores, e.g. __FOO__.


 * Variables: these are uppercase words surrounded by double braces, e.g.  . As such, they look a lot like templates.


 * Parser functions: these take parameters and are either of the form   or  . See also.

Side-afhængige magiske ord vil påvirke eller returnere data om den aktuelle side (som standard), selv hvis ordet er tilføjet gennem en indsat skabelon eller medtaget systemmeddelelse.

Adfærds-omskiftere
En adfærds-omskifter styrer udseendet eller sidens opførsel og kan ofte bruges til at angive de ønskede udeladelser og tilføjelser i indholdet.

Variabler
Variabler returnerer information om den aktuelle side, wiki eller dato. Deres syntaks ligner skabeloner. Variabler markeret som " [expensive] " spores af softwaren, og antallet, der kan medtages på en side, er begrænset.

Hvis en skabelon navnekonflikter med en variabel, vil variablen blive brugt (så for at indsætte skabelonen    :PAGENAME er det nødvendigt at skrive  ). I nogle tilfælde vil tilføjelse af parametre tvinge parseren, til at aktivere en skabelon, for eksempel så  indsætter     :CURRENTDAYNAME, og ikke variablen.

Dato og tid
Følgende variabler returnerer den aktuelle dato og tid i UTC.

På grund af MediaWiki og browser mellemlagring, viser disse variabler oftest hvornår siden var lagret, snarere end det aktuelle klokkeslæt.

Dato og klokkeslæt magiske ord er formateret i wiki indholds-sproget. Siden afhænger de af sidens indholdssprog.

De følgende variabler gør det samme som ovenstående, men benytter webstedets serverkonfiguration eller $wgLocaltimezone.

For mere grundig tids-formatering, kan du installere ParserFunctions-udvidelsen for at bruge #tids parser funktionen.

Teknisk metadata
Bemærk: Revisions-variabler returnerer data om den nyeste redigering af den aktuelle side, selv ved visning af en ældre version af siden.

Statistik
Numbers returned by these variables normally contain separators (commas or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example,  &rarr;  and   &rarr; ).

Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example  and , or   and  ). Also applicable to  hereinbefore.

The number magic words are formatted in the wiki content language. Since, it depends on the page content language.

Page names
The  and   magic words only work in namespaces that have subpages enabled. See for information on enabling subpages.

As of, these can all take a parameter, allowing specification of the page to be operated on, instead of just the current page:
 * &rarr; 

For example, if page name is "L'Aquila", the following code will produce the string "Numeric char encoding":

URL encoded page names
The following are equivalents encoded for use in MediaWiki URLs (i.e. spaces replaced with underscores and some characters HTML escaped using numeric character encoding):



Note that,   and   have distinct implementations. See Manual:PAGENAMEE encoding for details.

Namespaces
The following are equivalents encoded for use in MediaWiki URLs (spaces replaced with underscores and some characters percent-encoded):



As of, these can take a full-page-name parameter and will return the requested namespace associated with that page, instead of with the current page:

Parameter must not be a namespace name:
 * &rarr; 
 * &rarr; 
 * &rarr; 
 * &rarr;   (Empty)

Parser functions
Parser functions are very similar to variables, but take one or more parameters (technically, any magic word that takes a parameter is a parser function), and the name is sometimes prefixed with a hash to distinguish them from templates.

This page only describes parser functions that are integral to the MediaWiki software. Other parser functions may be added by MediaWiki extensions such as the. For those see Help:Extension:ParserFunctions.

Namespaces
returns the current localized name for the namespace with that index, canonical name, or local alias. Thus,  , and   (an old name for the File namespace) all return "    ". On a wiki where the content language is French,  is also valid, but   (the localisation of "File" in German) is not.

is the equivalent encoded for MediaWiki URLs. It does the same, but it replaces spaces with underscores, making it usable in external links.

Don't confuse localised namespaces with custom namespaces.

Formatting
See also: Extension:StringFunctions.

Localization
Here are the magic words which are used as main localisation tools. Other magic words will often depend on the wiki's locale and configuration or on the chosen language: see in particular #Date and time, #Formatting, #Miscellaneous. More magic words are added by the Translate extension.

The usage of these magic words can be very complex, and the documentation is currently incomplete; there's some more info on PLURAL, GRAMMAR, GENDER.