Template:Sandbox/Aurelain/LinkIcon: Difference between revisions
No edit summary |
No edit summary |
||
| (58 intermediate revisions by the same user not shown) | |||
| Line 9: | Line 9: | ||
E.target_id = '{{{id}}}' | E.target_id = '{{{id}}}' | ||
{{#if:{{{type|}}} | AND E.type = '{{{type}}}' }} | {{#if:{{{type|}}} | AND E.type = '{{{type}}}' }} | ||
{{#if:{{{variant|}}} | AND E.variant = '{{{variant}}}' }} | |||
AND E.language = 'en' | AND E.language = 'en' | ||
<!-- foreign language --> | <!-- foreign language --> | ||
{{#if:{{{type|}}} | AND T.type = '{{{type}}}' }} | {{#if:{{{type|}}} | AND T.type = '{{{type}}}' }} | ||
{{#if:{{{variant|}}} | AND T.variant = '{{{variant}}}' }} | |||
{{#if:{{{lang|}}} | AND T.language = '{{{lang}}}' | AND T.language = 'en' }} | {{#if:{{{lang|}}} | AND T.language = '{{{lang}}}' | AND T.language = 'en' }} | ||
|fields = | |fields = | ||
<!-- filename --> | <!-- filename --> | ||
{{#switch: {{{filename|}}} | {{#switch: {{{filename|}}} | ||
|=CONCAT(E.target_id, "{{{suffix|.png | |=CONCAT(E.target_id, "{{#if:{{{suffix|}}}|{{{suffix}}}|.png}}")=filename, <!-- automatic behavior --> | ||
|0=<!-- omitted filename --> | |0=<!-- omitted filename --> | ||
|1=CONCAT(E.name, "{{{suffix|.png | |1=CONCAT(E.name, "{{#if:{{{suffix|}}}|{{{suffix}}}|.png}}")=filename,<!-- forced English filename --> | ||
|#default=CONCAT("{{{filename}}}")=filename, <!-- overridden filename --> | |#default=CONCAT("{{{filename}}}")=filename, <!-- overridden filename --> | ||
}} | }} | ||
<!-- link --> | <!-- link --> | ||
{{#switch: {{{link|}}} | {{#switch: {{{link|}}} | ||
|=E.name | |=<!-- automatic behavior --><!-- | ||
-->{{#switch: {{{id|}}}+{{{type|}}} | |||
<!-- overrides --> | |||
|wasp_upg_alt+unit=CONCAT("Stinger_(unit)") | |||
|bonus_magic_astral_summon_1+spell=CONCAT("Summon_Avatar_(Spell)") | |||
|skill_summoner+<!--fall--> | |||
|skill_summoner+skill_level<!--fall--> | |||
|skill_summoner+skill=CONCAT("Summon_Avatar_(Skill)") | |||
<!-- normal, no link specified: --> | |||
|#default={{#if:{{{link_id|}}} | |||
|CONCAT("{{#invoke:Translation|get|{{{link_id}}}|en}}") | |||
|E.name <!-- normal, use the English name --> | |||
}} | |||
}}=link, | |||
|0=<!-- intentionally empty parameter, omit the link --> | |0=<!-- intentionally empty parameter, omit the link --> | ||
|#default=CONCAT("{{{link}}}")=link, <!-- overridden link --> | |#default=CONCAT("{{{link}}}")=link, <!-- overridden link --> | ||
| Line 33: | Line 48: | ||
|#default=CONCAT("{{{text}}}")=text, <!-- overridden name --> | |#default=CONCAT("{{{text}}}")=text, <!-- overridden name --> | ||
}} | }} | ||
{{#if:{{{size|}}} | CONCAT("{{{size}}}") = size,}} | |||
{{#if:{{{size|}}} | CONCAT("{{{size}}}") = size }} | {{#if:{{{color|}}} | CONCAT("{{{color}}}") = color,}} | ||
{{#if:{{{color|}}} | CONCAT("{{{color}}}") = color }} | {{#if:{{{wrap|}}} | CONCAT("{{{wrap}}}") = wrap,}} | ||
{{#if:{{{wrap|}}} | CONCAT("{{{wrap}}}") = wrap }} | {{#if:{{{width|}}} | CONCAT("{{{width}}}") = width,}} | ||
T.language = lang | |||
|format = | |format = | ||
template | template | ||
| Line 55: | Line 71: | ||
This template is meant to handle the linking of articles in a way that is language-agnostic, meaning that it can be used in language-aware infoboxes and other contexts which need to be able to handle multiple languages. This template only works with concepts which have their translation managed by Cargo. | This template is meant to handle the linking of articles in a way that is language-agnostic, meaning that it can be used in language-aware infoboxes and other contexts which need to be able to handle multiple languages. This template only works with concepts which have their translation managed by Cargo. | ||
The default assumption for the icon's file name is that it is identical to the {{b|id}}, plus the <code>.png</code> extension. This can be further configured with the {{b|suffix}} parameter, or be completely overridden by the {{b|filename | The default assumption for the icon's file name is that it is identical to the {{b|id}}, plus the <code>.png</code> extension. This can be further configured with the {{b|suffix}} parameter, or be completely overridden by the {{b|filename}} parameter. | ||
1. Basic (rarely used, as you usually need to specify {{b|type}} and {{b|suffix}}) | ==1. Basic:== | ||
(rarely used, as you usually need to specify {{b|type}} and {{b|suffix}}) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon}}</nowiki></code> | ||
| Line 65: | Line 81: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon}} | ||
2. With {{b|type}}: | ==2. With {{b|type}}:== | ||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=skill_assault | type=skill}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=skill_assault | type=skill}}</nowiki></code> | ||
| Line 73: | Line 88: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=skill_assault | type=skill}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=skill_assault | type=skill}} | ||
3. With {{b|suffix}} | ==3. With {{b|suffix}}:== | ||
(to override the default <code>.png</code>) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=angel | suffix=_icon.png}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=angel | suffix=_icon.png}}</nowiki></code> | ||
| Line 81: | Line 96: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=angel | suffix=_icon.png}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=angel | suffix=_icon.png}} | ||
4. With {{b|lang}} | ==4. With {{b|lang}}:== | ||
(to override the default <code>en</code>) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon || lang=ja}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon || lang=ja}}</nowiki></code> | ||
| Line 89: | Line 104: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon || lang=ja}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon || lang=ja}} | ||
5. With {{b|size}} | ==5. With {{b|size}}:== | ||
(to override the default <code>32px</code>) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | size=64px}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | size=64px}}</nowiki></code> | ||
| Line 97: | Line 112: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | size=64px}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | size=64px}} | ||
6. With {{b|filename}} | ==6. With {{b|filename}}:== | ||
(to override the automated file path) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=Ister.png}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=Ister.png}}</nowiki></code> | ||
| Line 105: | Line 120: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=Ister.png}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=Ister.png}} | ||
7. With {{b|zero filename}} | ==7. With {{b|zero filename}}:== | ||
(to disable the icon) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | filename=0}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | filename=0}}</nowiki></code> | ||
| Line 113: | Line 128: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | filename=0}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | filename=0}} | ||
8. With {{b|text}} | ==8. With {{b|text}}:== | ||
(to override the automated text) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=Hello}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=Hello}}</nowiki></code> | ||
| Line 121: | Line 136: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=Hello}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=Hello}} | ||
9. With {{b|zero text}} | ==9. With {{b|zero text}}:== | ||
(to disable the text) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=0}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=0}}</nowiki></code> | ||
| Line 129: | Line 144: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=0}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=0}} | ||
10. With {{b|link}} | ==10. With {{b|link}}:== | ||
(to override the automated link) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=Foobar}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=Foobar}}</nowiki></code> | ||
| Line 137: | Line 152: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=Foobar}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=Foobar}} | ||
11. With {{b|zero link}} | ==11. With {{b|zero link}}:== | ||
(to disable the link) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=0}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=0}}</nowiki></code> | ||
| Line 145: | Line 160: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=0}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=0}} | ||
12. With {{b|color}}: | ==12. With {{b|color}}:== | ||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | color=magenta}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | color=magenta}}</nowiki></code> | ||
| Line 153: | Line 167: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | color=magenta}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | color=magenta}} | ||
13. With {{b| | ==13. With {{b|stack{{=}}1}}:== | ||
(to switch to a vertical layout) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | stack=1}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=magic_demon | stack=1}}</nowiki></code> | ||
| Line 161: | Line 175: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | stack=1}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=magic_demon | stack=1}} | ||
14. With {{b| | ==14. With {{b|wrap{{=}}1}}:== | ||
(to allow the resulting link to wrap; useful if used without icons) | |||
{{Color|yellow|Input:}} | {{Color|yellow|Input:}} | ||
| Line 170: | Line 184: | ||
|style="width:100px;"|{{Sandbox/Aurelain/LinkIcon|id=might_undead|suffix=_icon.png|wrap=1}} | |style="width:100px;"|{{Sandbox/Aurelain/LinkIcon|id=might_undead|suffix=_icon.png|wrap=1}} | ||
|} | |} | ||
</nowiki></pre> | |||
{{Color|lime|Output:}} | {{Color|lime|Output:}} | ||
| Line 177: | Line 191: | ||
|} | |} | ||
15. With {{b| | ==15. With {{b|filename{{=}}1}}:== | ||
(to use the English name as filename) | |||
{{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=1}}</nowiki></code> | {{Color|yellow|Input:}} <code><nowiki>{{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=1}}</nowiki></code> | ||
| Line 185: | Line 199: | ||
{{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=1}} | {{Color|lime|Output:}} {{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=1}} | ||
==16. {{b|Stinger}} conflict:== | |||
{{Color|yellow|Input:}} | |||
<pre><nowiki> | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = wasp_upg_alt | |||
| type = unit | |||
| filename = 1 | |||
| suffix = _icon.png | |||
}} | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = dungeon_hero_3 | |||
| type = hero | |||
| filename = 1 | |||
}} | |||
</nowiki></pre> | |||
{{Color|lime|Output:}} | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = wasp_upg_alt | |||
| type = unit | |||
| filename = 1 | |||
| suffix = _icon.png | |||
}} | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = dungeon_hero_3 | |||
| type = hero | |||
| filename = 1 | |||
}} | |||
==17. {{b|Summon Avatar}} conflict:== | |||
{{Color|yellow|Input:}} | |||
<pre><nowiki> | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = bonus_magic_astral_summon_1 | |||
| type = spell | |||
}} | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = skill_summoner | |||
| type = skill | |||
}} | |||
</nowiki></pre> | |||
{{Color|lime|Output:}} | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = bonus_magic_astral_summon_1 | |||
| type = spell | |||
}} | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = skill_summoner | |||
| type = skill | |||
}} | |||
==18. Proper linking of Skill levels:== | |||
{{Color|yellow|Input:}} | |||
<pre><nowiki> | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = skill_assault | |||
| type = skill_level | |||
| variant = 3 | |||
}} | |||
</nowiki></pre> | |||
{{Color|lime|Output:}} | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = skill_assault | |||
| type = skill_level | |||
| variant = 3 | |||
}} | |||
==19. With {{b|link_id}} to hijack the url:== | |||
{{Color|yellow|Input:}} | |||
<pre><nowiki> | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = sub_class_demons_magic_2 | |||
| suffix=_icon.png | |||
| link_id = magic_demon | |||
}} | |||
</nowiki></pre> | |||
{{Color|lime|Output:}} | |||
{{Sandbox/Aurelain/LinkIcon | |||
| id = sub_class_demons_magic_2 | |||
| suffix=_icon.png | |||
| link_id = magic_demon | |||
}} | |||
__NOTOC__ | |||
</noinclude> | </noinclude> | ||
Latest revision as of 11:40, 26 August 2026
This template is meant to handle the linking of articles in a way that is language-agnostic, meaning that it can be used in language-aware infoboxes and other contexts which need to be able to handle multiple languages. This template only works with concepts which have their translation managed by Cargo.
The default assumption for the icon's file name is that it is identical to the id, plus the .png extension. This can be further configured with the suffix parameter, or be completely overridden by the filename parameter.
1. Basic:
(rarely used, as you usually need to specify type and suffix)
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon}}
Output:
Herald
2. With type:
Input: {{Sandbox/Aurelain/LinkIcon | id=skill_assault | type=skill}}
Output:
Offense
3. With suffix:
(to override the default .png)
Input: {{Sandbox/Aurelain/LinkIcon | id=angel | suffix=_icon.png}}
Output:
Angel
4. With lang:
(to override the default en)
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon || lang=ja}}
Output:
ヘラルド
5. With size:
(to override the default 32px)
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | size=64px}}
Output:
Herald
6. With filename:
(to override the automated file path)
Input: {{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=Ister.png}}
Output:
Ister
7. With zero filename:
(to disable the icon)
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | filename=0}}
Output: Herald
8. With text:
(to override the automated text)
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=Hello}}
Output:
Hello
9. With zero text:
(to disable the text)
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=0}}
10. With link:
(to override the automated link)
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=Foobar}}
Output:
Herald
11. With zero link:
(to disable the link)
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=0}}
Output:
Herald
12. With color:
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | color=magenta}}
Output:
Herald
13. With stack=1:
(to switch to a vertical layout)
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | stack=1}}
Output:
Herald
14. With wrap=1:
(to allow the resulting link to wrap; useful if used without icons)
Input:
{|class=wikitable
|style="width:100px;"|{{Sandbox/Aurelain/LinkIcon|id=might_undead|suffix=_icon.png|wrap=1}}
|}
Output:
15. With filename=1:
(to use the English name as filename)
Input: {{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=1}}
Output:
Ister
16. Stinger conflict:
Input:
{{Sandbox/Aurelain/LinkIcon
| id = wasp_upg_alt
| type = unit
| filename = 1
| suffix = _icon.png
}}
{{Sandbox/Aurelain/LinkIcon
| id = dungeon_hero_3
| type = hero
| filename = 1
}}
17. Summon Avatar conflict:
Input:
{{Sandbox/Aurelain/LinkIcon
| id = bonus_magic_astral_summon_1
| type = spell
}}
{{Sandbox/Aurelain/LinkIcon
| id = skill_summoner
| type = skill
}}
Output:
Basic Summon Avatar
Summon Avatar
18. Proper linking of Skill levels:
Input:
{{Sandbox/Aurelain/LinkIcon
| id = skill_assault
| type = skill_level
| variant = 3
}}
Output:
Expert Offense
19. With link_id to hijack the url:
Input:
{{Sandbox/Aurelain/LinkIcon
| id = sub_class_demons_magic_2
| suffix=_icon.png
| link_id = magic_demon
}}
Output:
Lord of Chaos


