UESPWiki:NSInfo

The UESPWiki – Your source for The Elder Scrolls since 1995
(Redirected from UESPWiki:Namespace Info)
Jump to: navigation, search

NSInfo splits out the namespace and pseudo-namespace functions from the older UespCustomCode extension, as well as adding a couple of new functions. The general concept is to provide a centralized data-repository for information about each namespace—in particular, game-related namespaces, or gamespaces as we often call them. Thus, {{NS_MAINPAGE:Skyrim}} will always return the main page for Skyrim, and if we change where that is, we only have to update the information in one place. In addition, the mod allows a single page and its subpages to be treated like a namespace. This allows a smaller mod to benefit from all the functions this extension provides without having to create a whole new namespace for it.

  • The definitions of the namespaces are provided by MediaWiki:Nsinfo-namespacelist, and can include both true namespaces and mods documented in subpages of the mod's main page (e.g., Beyond Skyrim: Cyrodiil). The page can be updated by all admins, along with anyone else who has interface editor permissions. Please be sparing in your edits and check them closely before saving this page, as each edit can cause large numbers of pages to be queued for updating (close to 100,000 on UESP).
  • The functions are designed so that mods listed on the namespacelist page can be treated as if they were true namespaces, in particular within templates. Most often, these are called pseudo-spaces (shortened from pseudo-namespaces), but are also sometimes referred to as mod namespaces or sub-spaces.
  • There are three possible ways that these magic words can identify the requested namespace:
    1. Unless otherwise noted, any of the magic words can be called with an argument ("arg" in the following examples) which specifies the desired namespace, overriding any other method of identifying namespaces. The argument can be:
      • the basic name of the namespace or pseudo-space ({{NS_BASE:}}),
      • the short ID of the namespace or pseudo-space ({{NS_ID:}}),
      • for real namespaces only, the numeric ID ({{NAMESPACENUMBER}}),
      • for real namespaces only, any of its shortcut names,
      • a full page name. (Note: in the event of a conflict between a namespace identifier and a page in main space, such as Morrowind on this wiki, the namespace wins out. To force something to be identified as a page name, put a colon in front of it.)
    2. If the function is called with an empty argument, then the code checks to see whether the template variables ns_base or ns_id have been set (the variables must be all lowercase; ns_base takes precedence over ns_id). If so, these variables are used to determine the namespace. Despite their names, either variable can take any of the namespace identifiers mentioned above, including page names.
    3. If neither of the above conditions is met, then the default behavior is to automatically identify the namespace (or mod) from the article title, and return values appropriate for that namespace. Within a given namespace, the longest possible matching name wins, thus Beyond Skyrim:Cyrodiil/Example will always be identified as Beyond Skyrim: Cyrodiil, not Beyond Skyrim. For talk page articles, the corresponding SUBJECTSPACE is always used, instead of the talk namespace.
  • For backwards compatibility, variables with the same names as the functions are also supported (i.e., {{NS_BASE}} instead of {{NS_BASE:}}), but deprecated. Due to changes in MediaWiki's design, variables can become unreliable under certain circumstances from MW 1.39 onwards, and will generate warnings for a few versions before then. In short, don't use them. Any accidental or older uses of them will be tracked in Uses Deprecated Namespace Variable and should be converted by simply adding the missing colon.

Namespace Functions[edit]

All of the following functions must typed in upper case.

Function Examples
(using SI and BS5C)
Description
{{GAMESPACE:}}
{{GAMESPACE:arg}}
1
1
Returns 1 if the namespace is considered to be a gamespace; otherwise blank. This is intended as a convenience function for template writers, using logic like {{#if:{{GAMESPACE}}|do something|do something else}}.
  • By default, all namespaces with {{NAMESPACENUMBER:arg}} between 100-199 or 3000-4999 are considered to be gamespaces. This corresponds to the designated blocks of custom namespaces according to MediaWiki.
{{MOD_NAME:}}
{{MOD_NAME:arg}}

Cyrodiil
The name of the mod
  • For true namespaces, this variable is blank (an empty string). As such, it can be used to detect if the current namespace is a true namespace or a pseudo-namespace.
  • For mods, it is the article name of the mod's main article.
{{NS_BASE:}}
{{NS_BASE:arg}}
Shivering
Beyond Skyrim:Cyrodiil
Returns the basic name of the subject namespace.
  • For true namespaces, this variable is equivalent to {{SUBJECTSPACE}}.
  • For mods, this variable is equivalent to {{SUBJECTSPACE}}:{{MOD_NAME}}.
  • In templates, this should usually be used in preference to {{NAMESPACE}}, as it allows the actual namespace to be overridden in such cases as sandbox edits or the rare out-of-namespace reference. It can also be used to distinguish the current namespace for comparisons, though {{NS_ID:}} is typically easier.
{{NS_CATEGORY:}}
{{NS_CATEGORY:arg}}
Shivering
Beyond Skyrim-Cyrodiil
The prefix used for this namespace on category pages. By default, this is equivalent to {{NS_BASE:}}, unless a more appropriate value is specified in the namespace's definition.
  • As a rule, this should be used as a prefix for any namespace-specific categories (e.g., [[Category:{{NS_CATEGORY:}}-Pages In Category]]).
{{NS_FULL:}}
{{NS_FULL:arg}}
Shivering:
Beyond Skyrim:Cyrodiil/
Returns the name of the namespace, including whatever punctuation is necessary before appending an article name.
  • For true namespaces, this is equivalent to {{NS_BASE:}}: (a colon is added to {{NS_BASE:}}).
  • For mods, it is equivalent to {{NS_BASE:}}/ (a slash is added to {{NS_BASE:}}).
  • In templates, this should be used as the namespace for any links, since it will adapt to both true namespaces and pseudo-namespaces.
{{NS_ID:}}
{{NS_ID:arg}}
SI
BS5C
Returns the ID used as a shorthand for this namespace. For most games, it is a two-letter ID. The value returned by {{NS_ID:}} is always all uppercase characters, but lowercase IDs will also be recognized as arguments to the namespace variables. (Note that this may not apply to other uses, such as in template parameter names.)
  • In templates, this can be used for short, easy comparisons, though it has the drawback of being slightly less obvious to less-experienced editors. Both {{NS_BASE:}} and {{NS_ID:}} can be used for this purpose, though if pseudo-namespaces need to be checked for specifically, {{NS_ID:}} will be less cumbersome.
{{NS_MAINPAGE:}}
{{NS_MAINPAGE:arg}}
Shivering:Shivering Isles
Beyond Skyrim:Cyrodiil
The location of the namespace's main page. By default, this is equivalent to {{NS_FULL:}}{{NS_NAME:}}, unless a more appropriate value is specified in the namespace's definition.
{{NS_NAME:}}
{{NS_NAME:arg}}
Shivering Isles
Beyond Skyrim: Cyrodiil
The descriptive name for the namespace; the name used for the main article describing the namespace. By default, this is equivalent to {{NS_BASE:}}, unless a more appropriate value is specified in the namespace's definition.
  • In templates, this should only be used in verbose text; it should generally not be used for categories unless descriptive text is specifically desired, and it should never be used for comparisons.
{{NS_PARENT:}}
{{NS_PARENT:arg}}
Oblivion
Skyrim
Returns the basic name of the parent namespace, i.e., the primary game, rather than the game expansion. This is normally the namespace which contains generic documentation, such as information about the game's races and attributes.
  • For standalone games, it is equivalent to {{NS_BASE}}
  • For expansions or mods, it is the standalone game necessary to run the expansion/mod.
{{NS_TRAIL:}}
{{NS_TRAIL:arg}}
Shivering Isles
Mod / Skyrim: Beyond Skyrim: Cyrodiil
The prefix used for this namespace in breadcrumb trails, i.e., a full link to the namespace's main page, plus optionally links to any other relevant articles for the namespace. By default, this is equivalent to [[{{NS_MAINPAGE:}}|{{NS_NAME:}}]], unless a more appropriate value is specified in the namespace's definition.

Other Functions[edit]

Function Description
{{NS_CATLINK:arg ( |sortkey )}} This is a simple synonym for [[Category:{{NS_CATEGORY:}}-arg]] or [[Category:{{NS_CATEGORY:}}-arg|sortkey]] meant for code brevity.