Template:NavParser

From ATLauncher Wiki
Jump to: navigation, search
Template documentation (for the above template, sometimes hidden or invisible)
Lua Logo.svg This template is written in Lua. The full source code can be found at Module:NavParser.

This template is used to list items in a navbox. Navboxes are constructed out of the {{Navbox}} template and typically also several {{Navbox subgroup}} templates. The {{|tNavParser}} template serves to list links to pages in navboxes, typically being pages of in-game items, for which an image is displayed in the navbox with the item.

Parameters[edit]

Unlike most templates, this template parses a list of semicolon separated items, which is given as the first and only unnamed parameter. Furthermore there is an optional sprites parameter used to link a sprite sheet to the parser.

List parameters[edit]

Each semicolon separated item in the list is by itself a comma separated list of key-value pairs, with the exception of the first and only mandatory value, which is the name of the target page. The optional values have the following keys:

  • text: The text to display, which will override the name of the page given as the first value.
  • img: The name of the file, which is used to display as the image instead of the grid image associated with the page given as the first value. Additionally, the value / can be used to display no image.
  • link: The page to link to, which will override the link of the page given as the first value. Additionally, the value / can be used to display text without a link to a page or an image.
  • sprite: The number of the sprite that should be used as an image for the item, in case a sprite sheet is linked to the parser. This will override any image set using the img key. Alternatively the img key can also be used in conjunction with a number to display a sprite, but this functionality is deprecated.

Examples[edit]

Basic[edit]

Code[edit]

{{NavParser|
  Iron Ingot;
  Gold Ingot, img:Grid Diamond.png, link:Iron Sword;
  No link, link:/;
  Wool, text: Alternate text;
}}

Output[edit]

Iron Ingot Iron Ingot • Gold Ingot Gold Ingot • No link • Alternate text Alternate text

Sprites[edit]

Code[edit]

{{NavParser|sprites=NavSprites MineFactory Reloaded.png|
  Iron Ingot, sprite:1;
  Gold Ingot, sprite:2;
}}

Output[edit]

Iron Ingot Iron Ingot • Gold Ingot Gold Ingot

Visit Template:NavParser/doc to change this text! (How does this work?)

Done making changes? Refresh this text! (Why?)