Template:PageRef: Difference between revisions
SerpentofSet (talk | contribs) testing new PageRef template |
SerpentofSet (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
<onlyinclude> | <onlyinclude> | ||
[[{{#invoke:PageRef|getFilename|{{{target}}}|{{{type|}}}}}|link={{{alttarget|{{{target}}}}}}|{{{size|15px}}}]] [[{{{alttarget|{{{target}}}}}}|{{{altname|}}}]] | [[{{#invoke:PageRef|getFilename|{{{target}}}|{{{type|}}}}}|link={{{alttarget|{{{target}}}}}}|{{{size|15px}}}]] [[{{{alttarget|{{{target}}}}}}|{{{altname|{{{target}}}}}}]] | ||
</onlyinclude> | </onlyinclude> | ||
{{Documentation}} | {{Documentation}} | ||
[[Category:Icon templates]] | [[Category:Icon templates]] |
Revision as of 15:10, 17 October 2024
[[Script error: The function "getFilename" does not exist.|link={{{target}}}|15px]] [[{{{target}}}|{{{target}}}]]
Overview
Outputs an icon in svg and a link to the given localized page with an optional alternate display name.
Output should be:
<icon> <pagename>
- Both icon and page name should 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
- 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)
Examples
[[Script error: The function "getFilename" does not exist.|link={{{target}}}|15px]] [[{{{target}}}|{{{target}}}]]
[[Script error: The function "getFilename" does not exist.|link={{{target}}}|15px]] [[{{{target}}}|{{{target}}}]]
[[Script error: The function "getFilename" does not exist.|link={{{target}}}|15px]] [[{{{target}}}|{{{target}}}]]
not yet working
[[Script error: The function "getFilename" does not exist.|link={{{target}}}|15px]] [[{{{target}}}|{{{target}}}]]
[[Script error: The function "getFilename" does not exist.|link={{{target}}}|50]] [[{{{target}}}|{{{target}}}]]
[[Script error: The function "getFilename" does not exist.|link={{{target}}}|15px]] [[{{{target}}}|{{{target}}}]]
[[Script error: The function "getFilename" does not exist.|link={{{target}}}|15px]] [[{{{target}}}|{{{target}}}]]
[[Script error: The function "getFilename" does not exist.|link={{{target}}}|100]] [[{{{target}}}|{{{target}}}]]
Below is a fake example. Ideally, the template is called like:
{{PageRef|Lash|alt_name=Jacob}}
In wikitext it would look be outputted as:
[[File:Lash.svg|class=dark_or_light|link=Lash|size=15]] [[Lash|Jacob]]
Which would appear in visual as
No description.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Name | name | The localized name of the page to link to, also used to determine the icon.
| String | required |
Alternate Name | alt_name | An optional display name to show instead of the page name in the link.
| String | optional |
Alternate Link | alt_link | An optional link to link to instead of the 1st parameter (name).
| String | optional |
Size | size | Size of the icon link, defaulted to '15'px
| Number | optional |