Toggle menu
517
2.5K
889
23.2K
Deadlock Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:PageRef/doc: Difference between revisions

Template page
Sur (talk | contribs)
m type param removed
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Overview=
=Overview=
Outputs an icon in svg and a link to the given page with an optional alternate display name.
Outputs an icon in svg and a link to the given localized page with an optional alternate display name.


Output should be:<br>
Output will be:<br>
<icon> <pagename>
<icon> <pagename>


* Both icon and page name should be hyperlinked to first parameter as the pagename
* Both icon and page name will be hyperlinked to first parameter as the pagename
* Icon should be <pre style="width: fit-content>[[File:<pagename>.svg]]</pre> if the svg file exists, otherwise the .png.  
* Icon should be <pre style="width: fit-content>[[File:<pagename>.svg]]</pre> if the svg file exists, otherwise the .png.  
* The .svg should be both light and dark theme compatible
** 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
***It's possible CSS may be used to automatically invert colors, precluding the need for the icon to be theme-compatible
* The .png should be default theme compatible (light)
** 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 <i>alt_file_name</i> parameter will need to be used
 


=Examples=
=Examples=
In its simplest form: <code><nowiki>{{PageRef|Lash}}</nowiki></code> {{PageRef|Lash}}


{{PageRef|Lash|altname=Jacob}}
Example where the icon doesn't exist: <code><nowiki>{{PageRef|Shopkeeper}}</nowiki></code> {{PageRef|Shopkeeper}}
{{PageRef|Bullet Lifesteal|alttarget=Bullet Lifesteal (item)}}
{{PageRef|Siphon Life|alttarget=Abrams#(1) Siphon Life}}
 
==not yet working==
 
{{PageRef|Lash|alt=Jacob}}
 
{{PageRef|Siphon Life|size=50}}
 
{{PageRef|AttributeIconTechDuration}}
 
{{PageRef|Basic Magazine}}


{{PageRef|The Curiosity Shop|alt=Shop|size=100}}
Using alt_name: <code><nowiki>{{PageRef|Lash|alt_name=Jacob}}</nowiki></code> {{PageRef|Lash|alt_name=Jacob}}


Using alt_link (hover the link to see): <code><nowiki>{{PageRef|Lash|alt_link=Cold Front}}</nowiki></code> {{PageRef|Lash|alt_link=Cold Front}}


Below is a fake example. Ideally, the template is called like:
Using alt_file_name: <code><nowiki>{{PageRef|Lash|alt_file_name=Cold Front}}</nowiki></code> {{PageRef|Lash|alt_file_name=Cold Front}}


<pre style="width: fit-content">{{PageRef|Lash|alt=Jacob}}</pre>
Using them all together, note that the first parameter is no longer used and therefore not needed:
<code><nowiki>{{PageRef|alt_name=Cold Front|alt_link=Cold Front|alt_file_name=Cold Front}}</nowiki></code>
{{PageRef|alt_name=Cold Front|alt_link=Cold Front|alt_file_name=Cold Front}}


In wikitext it would look be outputted as:
Note: Instead of repeated use of <i>alt_file_name</i>, it is recommended to create a redirect at <nowiki>[[<first_parameter>.png]]</nowiki> to <nowiki>[[<alt_file_name>.png]]</nowiki>, allowing the use of the simplest form of PageRef, making it much easier to reference in the future.
<pre style="width: fit-content">[[File:Lash.svg|class=dark_or_light|link=Lash|size=15]] [[Lash|Jacob]]</pre>


Which would appear in visual as
If a file does not exist, it will look like
{{PageRef|My cool page}}


{{HeroIcon|Lash|Jacob}}
To not use the file, use:
<code><nowiki>{{PageRef|My cool page|no_file=true}}</nowiki></code>
{{PageRef|My cool page|no_file=true}}


=Parameters=
<templatedata>
<templatedata>
{
{
    "params": {
"params": {
        "name": {
"name": {
            "label": "Name",
"label": "Name",
            "description": "The 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",
"required": true,
            "required": true,
"example": "Lash",
            "example": "Lash"
"aliases": [
        },
"1"
         "alt": {
],
             "label": "Alternate Name",
"type": "string"
             "description": "An optional display name to show instead of the page name in the link.",
},
            "type": "string",
         "no_file": {
             "label": "Do not use file",
             "description": "Do not use any file; also use this parameter when a file doesn't exist. Note that passing 'false' does not make it use a file, the parameter must then be omitted. This is for code efficiency",
             "required": false,
             "required": false,
             "example": "Jacob"
             "example": "true",
            "type": "string"
         },
         },
        "size": {
"alt_name": {
            "label": "Size",
"label": "Alternate Name",
            "description": "Size of the icon link, defaulted to '15'px",
"description": "An optional display name to show instead of the page name in the link.",
            "type": "number",
"type": "string",
            "required": false,
"required": false,
            "example": "50"
"example": "Jacob"
        }
},
    },
"alt_link": {
    "format": "inline"
"label": "Alternate Link",
"description": "An optional link to link to instead of the 1st parameter (name).",
"type": "string",
"required": false,
"example": "Death Slam"
},
"alt_file_name": {
"label": "Alternate File Name",
"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",
"required": false,
"example": "Amber Hand.png"
},
"size": {
"label": "Size",
"description": "Size of the icon link, defaulted to '15'px",
"type": "number",
"required": false,
"example": "50"
}
},
"format": "inline"
}
}
</templatedata>
</templatedata>