Template:PageRef/doc: Difference between revisions

From Deadlock Wiki
Jump to navigation Jump to search
Sur (talk | contribs)
m added an example to showcase how the icon is not used when it doesnt exist yet
Gammaton32 (talk | contribs)
No edit summary
Line 36: Line 36:
<templatedata>
<templatedata>
{
{
    "params": {
"params": {
        "name": {
"name": {
            "label": "Name",
"label": "Name",
            "description": "The localized name of the page to link to, also used to determine the icon.",
"description": "The localized name of the page to link to, also used to determine the icon.",
            "type": "string",
"type": "string",
            "required": true,
"required": true,
            "example": "Lash"
"example": "Lash",
        },
"aliases": [
        "alt_name": {
"1"
            "label": "Alternate Name",
]
            "description": "An optional display name to show instead of the page name in the link.",
},
            "type": "string",
"alt_name": {
            "required": false,
"label": "Alternate Name",
            "example": "Jacob"
"description": "An optional display name to show instead of the page name in the link.",
        },
"type": "string",
        "alt_link": {
"required": false,
            "label": "Alternate Link",
"example": "Jacob"
            "description": "An optional link to link to instead of the 1st parameter (name).",
},
            "type": "string",
"alt_link": {
            "required": false,
"label": "Alternate Link",
            "example": "Death Slam"
"description": "An optional link to link to instead of the 1st parameter (name).",
        },
"type": "string",
        "alt_file_name": {
"required": false,
            "label": "Alternate File Name",
"example": "Death Slam"
            "description": "An optional way to designate which file to include. Not needed if <first parameter> (name) is the same as the file name. File extension not needed, as it will try to prioritize the .svg first, otherwise use the .png.",
},
            "type": "string",
"alt_file_name": {
            "required": false,
"label": "Alternate File Name",
            "example": "Amber Hand.png"
"description": "An optional way to designate which file to include. Not needed if <first parameter> (name) is the same as the file name. File extension not needed, as it will try to prioritize the .svg first, otherwise use the .png.",
        },
"type": "string",
        "size": {
"required": false,
            "label": "Size",
"example": "Amber Hand.png"
            "description": "Size of the icon link, defaulted to '15'px",
},
            "type": "number",
"size": {
            "required": false,
"label": "Size",
            "example": "50"
"description": "Size of the icon link, defaulted to '15'px",
        }
"type": "number",
    },
"required": false,
    "format": "inline"
"example": "50"
}
},
"format": "inline"
}
}
</templatedata>
</templatedata>

Revision as of 18:25, 28 November 2024

Overview

Outputs an icon in svg and a link to the given localized page with an optional alternate display name.

Output will be:
<icon> <pagename>

  • Both icon and page name will be hyperlinked to first parameter as the pagename
  • Icon should be
    [[File:<pagename>.svg]]
    if the svg file exists, otherwise the .png.
    • The .svg should be both light and dark theme compatible (WIP)
      • It's possible CSS may be used to automatically invert colors, precluding the need for the icon to be theme-compatible
    • The .png should at least be default theme compatible (light)
    • If neither the .svg nor the .png exist, the icon will not be added
  • If the first parameter (name) is a hero name in english, it will automatically use the <hero>_MM.png file
    • Otherwise, if the file name is different to the page name (do not use this in excess), the alt_file_name parameter will need to be used


Examples

In its simplest form: {{PageRef|Lash}} Lash

Example where the icon doesn't exist: {{PageRef|Amber Hand}} Amber Hand

Using alt_name: {{PageRef|Lash|alt_name=Jacob}} Jacob

Using alt_link (hover the link to see): {{PageRef|Lash|alt_link=Cold Front}} Lash

Using alt_file_name: {{PageRef|Lash|alt_file_name=Cold Front}} Lash

Using them all together, note that the first parameter is no longer used and therefore not needed: {{PageRef|alt_name=Cold Front|alt_link=Cold Front|alt_file_name=Cold Front}} Cold Front

Note: Instead of repeated use of alt_file_name, it is recommended to create a redirect at [[<first_parameter>.png]] to [[<alt_file_name>.png]], allowing the use of the simplest form of PageRef, making it much easier to reference in the future.

Parameters

No description.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Namename 1

The localized name of the page to link to, also used to determine the icon.

Example
Lash
Stringrequired
Alternate Namealt_name

An optional display name to show instead of the page name in the link.

Example
Jacob
Stringoptional
Alternate Linkalt_link

An optional link to link to instead of the 1st parameter (name).

Example
Death Slam
Stringoptional
Alternate File Namealt_file_name

An optional way to designate which file to include. Not needed if <first parameter> (name) is the same as the file name. File extension not needed, as it will try to prioritize the .svg first, otherwise use the .png.

Example
Amber Hand.png
Stringoptional
Sizesize

Size of the icon link, defaulted to '15'px

Example
50
Numberoptional