Template:Versions2

From Wowpedia
Jump to: navigation, search

Versions2 enables some background magic (via the UsingData extension) to show and switch between alternate versions of items or spells (Raid Finder versus Normal versus Heroic, or ranks of spells) in a way that falls back sanely for readers without javascript enabled.


Note Note: You probably do not want to use this template directly:

  • For common raid items, use {{Versions/Item}}, which automatically includes Heroic, Raid Finder, Flexible, Thunderforged, Elite, Warforged, and other similar versions as appropriate.
  • For items with Alliance/Horde versions, use {{Versions/AH}}

Example

For a fully-fledged, live example, see Regail's Crackling Dagger. A simplified example is described and implemented here.

There are three versions of an item: Blandsauce, Awesomesauce, and Weaksauce. Define the normal ("blandsauce") version first, followed by the others:

{{#data:itemtip
|name=Example item
|ilvl=200
|quality=Epic
|slot=Trinket
}}{{#data:#Weaksauce
|name=Example item
|tag=Weaksauce
|ilvl=1
|quality=Poor
|slot=Trinket
}}{{#data:#Awesomesauce
|name=Example item
|tag=Awesomesauce
|ilvl=400
|quality=Legendary
|slot=Trinket
}}

Note that subsequent calls to {{#data: do not include the display template ({{itemtip}} in this case). This way they are not displayed at the top of the page, but they are defined. They do, however, define a data fragment (with the name of the fragment specified after the second #). Any additional content such as source, description, screenshots, etc. should follow the data definitions. Near the end of the page, but before the "Patches and hotfixes" or "External links" section, add a second-level "Other versions" section, followed by a call to this template:

==Other versions==
{{Versions2|Weaksauce|Awesomesauce|basename=Blandsauce|basepos=1|tpl=itemtip}}

Finally, add any closing content, such as notes about patch changes, external links to other sites, and any categorization required.

Explanation of parameters

Versions2 takes up to eleven non-named parameters, which, including the base version of the item/spell, can display up to twelve different versions of a tooltip on the page. The parameters must be listed in the order in which they are to be displayed, and must match a data fragment provided by the page. Empty parameters are ignored, and may appear before non-empty parameters, so {{versions2|||Heroic||}} and {{versions2|Heroic}} are equivalent.

The base version of an item can have its name redefined (if "Base" is inappropriate), and its position among the other versions can be changed. Traditionally, multiple versions of an item are ordered by item level in ascending order, so the "Normal" version of an item would be listed after the "Raid Finder" version. This is accomplished with |basename=Normal|basepos=1. |basename= redefines the name from "Base" to "Normal", and assigns it the 1st position in a 0-based list.

Finally, a display template must be specified. Most uses of Versions2 are for items, so use |tpl=itemtip.

Version2 also enables a fallback mode, displaying the alternate versions of the tooltip as third-level (===Weaksauce===) sections near the end of the page for readers with javascript disabled. This is normally hidden by sitewide javascript and instead displayed/selected via the tabs added to the top of the page. To manually suppress this alternate-version hiding javascript for testing purposes, add "#!noversions" to the URL and open it in a new tab. (e.g. https://wow.gamepedia.com/Template:Versions2/doc#!noversions)

Other versions