Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Character Label: Difference between revisions

Template page
dustloop:Template:Character Label>TarkusLee
Undo revision 448063 by PrivateTarkus (talk)
dustloop:Template:Character Label>Kaiokek
Updated with a more robust version
Line 1: Line 1:
<!--
<!-- If "game" is not provided, fall back to the root page name
If one arg is given:
-->{{#vardefine:LabelGame|{{{game|{{#if:{{{chara|}}}|{{{1|}}}|{{#if:{{{2|}}}|{{{1|}}}|{{ROOTPAGENAME}}}}}}}}}}}<!--
  {{{1}}} is character name
    If "chara" is not provided, fall back to the second segment of the page title
If two args are given:
-->{{#vardefine:CharaCheckEmpty|{{{chara|{{{2|{{{1|{{#titleparts:{{PAGENAME}}|1|2}}}}}}}}}}}}}<!--
  {{{1}}} is game name
-->{{#vardefine:LabelChara|{{#if:{{#var:CharaCheckEmpty}}|{{#var:CharaCheckEmpty}}|Goku}}}}<!--
  {{{2}}} is character name
    If "link" is not provided, fall back to this link: game/chara. Disabled if set to none
--><includeonly><span style="white-space: nowrap;"><span class="charaLabel"><!--
-->{{#vardefine:LabelLink|{{#switch:{{{linkOverride|{{{link|auto}}}}}}
-->{{#vardefine:characterName | {{#if: {{{2|}}} | {{{2|}}} | {{{icon| {{{1| {{#titleparts: {{PAGENAME}} | 1 | 2}} }}} }}} }} }}<!--
| none | =
-->{{#vardefine:gameName  | {{#if: {{{2|}}} | {{{1|}}} | {{ROOTPAGENAME}} }}}}<!--
| auto = {{#var:LabelGame}}/{{#var:LabelChara}}
-->[[File:{{#var:gameName}}_{{#var:characterName}}_Icon.png{{#if:{{{L|}}}||{{!}}link={{{linkOverride|{{#var:gameName}}/{{#var:characterName}} }}} }}|x{{{size|24px}}}|alt=]]<!--
| {{{linkOverride|{{{link|}}}}}}
--></span>{{#if:{{{P|}}}||&nbsp;{{#switch: {{{format}}}
}}}}<!--
| none  = {{#if: {{{L|}}}|{{{label|}}}|[[{{{linkOverride|{{#var:gameName}}/{{#var:characterName}} }}}|{{{label|{{#var:characterName}}}}}]]}}
    Icon. Empty alt= is so when copying a paragraph using Character Label, the icon's name won't be copied (ex: Guilty_Gear_Sol_Badguy_Icon.png)
| italic = {{#if: {{{L|}}}|''{{{label|}}}''|[[{{{linkOverride|{{#var:gameName}}/{{#var:characterName}} }}}|''{{{label|{{#var:characterName}}}}}'']]}}
-->{{#vardefine:LabelIcon|[[File:{{{icon|{{#var:LabelGame}}_{{#var:LabelChara}}_Icon.png}}}|link={{#var:LabelLink}}|x{{{size|24px}}}|alt={{#switch:{{{label|auto}}}
| bold  | {{#if: {{{L|}}}|'''{{{label|}}}'''|[[{{{linkOverride|{{#var:gameName}}/{{#var:characterName}} }}}|'''{{{label|{{#var:characterName}}}}}''']]}}}} }}<!--
| none | = {{#var:LabelChara}}
--></span></includeonly><!--
| #default =
--><noinclude>{{clear}}{{doc}}</noinclude>
}}]]
}}<!--
    Text
-->{{#vardefine:PreformattedText|{{#if: {{#var:LabelLink}}|[[{{#var:LabelLink}}|{{{label|{{#var:LabelChara}}}}}]]|{{{label|{{#var:LabelChara}}}}}}}}}<!--
    Formatted text
-->{{#vardefine:LabelText|{{#switch: {{{format|auto}}}
| none | = {{#var:PreformattedText}}
| italic = ''{{#var:PreformattedText}}''
| italicbold | bolditalic = '''''{{#var:PreformattedText}}'''''
| '''{{#var:PreformattedText}}'''}}}}<!--
    Template start. To avoid line breaks between Icon and the first word of Text, the entire template is wrapped in white-space: nowrap, then Text is wrapped in white-space: normal. The invisible space character won't be copied
--><includeonly>{{#switch:{{{label|auto}}}
| none | = <span class="charaLabel">{{#var:LabelIcon}}</span>
| #default= <span style="white-space: nowrap;"><span class="charaLabel">{{#var:LabelIcon}}</span><span style="visibility:hidden;"> </span><span style="white-space: normal;">{{#var:LabelText}}</span></span>}}</includeonly><!--
--><noinclude>{{clear}}{{doc}}

Revision as of 19:53, 1 May 2024

Arguments

1st arg / game = Game code. Default: Current page's game
2nd arg / chara = Character name. Default: Current page's character
size = Icon size. Default: 24px in height
icon = Override icon's image
label = Override the text. Leave blank or input "none" to disable label display
link = Override the link. Leave blank or input "none" to disable link
format = none/italic/bold/italicbold/bolditalic. Default: bold

Usage

  • Can be called in 4 ways:
{{Character Label}} (assumes current game and character)
{{Character Label|Venom}} (assumes current game)
{{Character Label|GGACR|Venom}}
{{Character Label|game=GGACR|chara=Venom}}
  • Does not work within section headers.
   ===={{Character Label|GGACR|Venom}}====

Full Args

{{Character Label|GGACR|Venom|size=120px|icon=OverrideIconToUse.png|label=OverrideNameToShow|link=OverrideLink|format=TextFormat}}
  • Can also be used with CLabel shorthand.
   {{CLabel|GGACR|Ky Kiske}}

Examples

File:GGACR Venom Icon.png Venom Lorem ipsum dolor sit amet, consectetur adipiscing elit.
File:GGST Goldlewis Dickinson Icon.png Goldlewis Dickinson Maecenas quis felis volutpat, cursus dolor vel, bibendum urna.
File:GGACR Testament Icon.png Testament Duis dignissim posuere justo, vitae sodales felis aliquam sit amet.
File:GGST Happy Chaos Icon.png Happy Chaos Donec efficitur ante ac dolor convallis volutpat.

Example without size value

File:GGACR Venom Icon.png Venom

Example with size value

File:GGACR Ky Kiske Icon.png Ky Kiske

Example with size, and name override values

This links to Ky's page

File:GGACR Ky Kiske Icon.png JOHNNY ARCSYS

Desired Behaviors

Line break

The Icon should stick to the first word of the Label, while the rest of the Label can break into new lines.

File:GGACR Venom Icon.png Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas pulvinar facilisis condimentum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum facilisis sit amet mi non ornare. File:GGACR Sol Badguy Icon.png Morbi eget efficitur ipsum. Quisque viverra arcu venenatis, bibendum libero nec, pretium lectus. Nullam laoreet dictum auctor.

Copy paste compatibility

These examples can be copy pasted while still producing the same text:

It's me, {{Character Label|DBFZ|Goku}} from DBFZ!
It's me, {{Character Label|DBFZ|Goku|link=none}} from DBFZ!
It's me, {{Character Label|DBFZ|Goku|label=}} from DBFZ!
It's me, {{Character Label|DBFZ|Goku|link=|label=none|icon=DBFZ_SS_Goku_Icon.png}} from DBFZ!
It's me, File:DBFZ Goku Icon.png Goku from DBFZ!
It's me, File:DBFZ Goku Icon.png Goku from DBFZ!
It's me, Goku from DBFZ!
It's me, Goku from DBFZ!

It's me, Goku from DBFZ!

MediaWiki Appliance - Powered by TurnKey Linux