Template:Link/render: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
removed the space between the icon and the name
refactored the Link family
Line 1: Line 1:
<noinclude>
<includeonly><!--
--><span style="white-space:nowrap;"><!--
    -->{{#if:{{{filename|}}}
        |[[File:{{{filename}}} | {{{size|x32px}}} | link=<!--
            -->{{#if: {{{link|}}}
                |{{{link}}}<!--
                    -->{{#switch: {{{lang|en}}}
                        |en=
                        |#default=/{{{lang}}}
                    }}
            }}<!--
        -->]]
    }}<!--
    -->{{#if:{{{text|}}}
        |<span style='margin-left:2px; color:{{{color|}}}'><!--
        -->{{#if:{{{link|}}}
            |[[{{{link}}}<!--
            -->{{#switch: {{{lang|en}}}
                |en=
                |#default=/{{{lang}}}
            }}|<span style='color:{{{color|}}}'>{{{text}}}</span>]]
            |{{{text}}}
        }}</span>
    }}<!--
--></span><!--
####################################################################
--></includeonly><noinclude>


This template is used by [[Template:Link]] as the base for rendering a link with an icon in front of it. If '''filename''' is not provided, no icon will be rendered.  If '''article''' is not provided, the term will not be linked.
This template is used by [[Template:LinkIcon]] as the base for rendering a link with an icon {{b|in front}} of it.
===Usage===


<pre><nowiki>{{Link/render|filename=human_icon.png|link=Temple|lang=en|text=Temple}}</nowiki></pre>
1. Normal:


{{Link/render|filename=human_icon.png|link=Temple|lang=en|text=Temple}}
{{Color|yellow|Input:}}
<pre><nowiki>
{{Link/render
| filename=Ister.png
| link=Ister
| text=Ister
}}</nowiki></pre>


<pre><nowiki>{{Link/render|filename=human_icon.png|link=Temple|lang=en|text=Temple|size=64px|color=lime}}</nowiki></pre>
{{Color|lime|Output:}}
{{Link/render
| filename=Ister.png
| link=Ister
| text=Ister
}}


{{Link/render|filename=human_icon.png|link=Temple|lang=en|text=Temple|size=64px|color=lime}}
----


<pre><nowiki>{{Link/render|filename=human_icon.png|link=Temple|lang=pl|text=Świątynia}}</nowiki></pre>
2. With {{b|lang}}, to override the default (<code>en</code>) and thus change the link:


{{Link/render|filename=human_icon.png|link=Temple|lang=pl|text=Świątynia}}
{{Color|yellow|Input:}}
<pre><nowiki>
{{Link/render
| filename=Ister.png
| link=Ister
| text=イスター
| lang=ja
}}</nowiki></pre>


{{Color|lime|Output:}}
{{Link/render
| filename=Ister.png
| link=Ister
| text=イスター
| lang=ja
}}


<pre><nowiki>{{Link/render|link=Temple|lang=en|text=Temple}}</nowiki></pre>
----


{{Link/render|link=Temple|lang=en|text=Temple}}
3. With {{b|size}}, to override the default (<code>32px</code>):


{{Color|yellow|Input:}}
<pre><nowiki>
{{Link/render
| filename=Ister.png
| link=Ister
| text=Ister
| size=128px
}}</nowiki></pre>


<pre><nowiki>{{Link/render|link=Temple|lang=pl|text=Świątynia}}</nowiki></pre>
{{Color|lime|Output:}}
{{Link/render
| filename=Ister.png
| link=Ister
| text=Ister
| size=128px
}}


{{Link/render|link=Temple|lang=pl|text=Świątynia}}
----


4. With {{b|color}}, to override the default:


<pre><nowiki>{{Link/render|lang=en|text=Temple}}</nowiki></pre>
{{Color|yellow|Input:}}
<pre><nowiki>
{{Link/render
| filename=Ister.png
| link=Ister
| text=Ister
| color=magenta
}}</nowiki></pre>


{{Link/render|lang=en|text=Temple}}
{{Color|lime|Output:}}
{{Link/render
| filename=Ister.png
| link=Ister
| text=Ister
| color=magenta
}}


----


<pre><nowiki>{{Link/render|lang=pl|text=Świątynia}}</nowiki></pre>
5. With {{b|empty filename}}, to hide the icon:


{{Link/render|lang=pl|text=Świątynia}}
{{Color|yellow|Input:}}
<pre><nowiki>
{{Link/render
| link=Ister
| text=Ister
}}</nowiki></pre>


{{Color|lime|Output:}}
{{Link/render
| link=Ister
| text=Ister
}}


</noinclude><includeonly>{{#if:{{{filename|}}}|<span style="white-space: nowrap;">[[File:{{{filename}}}{{!}}{{{size|x32px}}}{{!}}link={{{link|}}}{{#ifeq:{{{lang|en}}}|en||/{{{lang}}}}}]]}}{{#if:{{{link|}}}|[[{{{link}}}{{#ifeq:{{{lang|en}}}|en||/{{{lang}}}}}|{{#if:{{{color|}}}|<span style="color:{{{color|}}}">{{{text}}}</span>|{{{text}}}}}]]|{{#if:{{{color|}}}|<span style="color:{{{color|}}}">{{{text}}}</span>|{{{text}}}}}}}{{#if:{{{filename|}}}|</span>}}</includeonly>
----
 
6. With {{b|empty text}}, to hide the right side:
 
{{Color|yellow|Input:}}
<pre><nowiki>
{{Link/render
| filename=Ister.png
| link=Ister
}}</nowiki></pre>
 
{{Color|lime|Output:}}
{{Link/render
| filename=Ister.png
| link=Ister
}}
 
----
 
7. With {{b|empty link}}, to omit the links:
 
{{Color|yellow|Input:}}
<pre><nowiki>
{{Link/render
| filename=Ister.png
| text=Ister
}}</nowiki></pre>
 
{{Color|lime|Output:}}
{{Link/render
| filename=Ister.png
| text=Ister
}}
 
</noinclude>

Revision as of 13:07, 26 June 2026


This template is used by Template:LinkIcon as the base for rendering a link with an icon in front of it.

Usage

1. Normal:

Input:

{{Link/render
| filename=Ister.png
| link=Ister
| text=Ister
}}

Output: Ister


2. With lang, to override the default (en) and thus change the link:

Input:

{{Link/render
| filename=Ister.png
| link=Ister
| text=イスター
| lang=ja
}}

Output: イスター


3. With size, to override the default (32px):

Input:

{{Link/render
| filename=Ister.png
| link=Ister
| text=Ister
| size=128px
}}

Output: Ister


4. With color, to override the default:

Input:

{{Link/render
| filename=Ister.png
| link=Ister
| text=Ister
| color=magenta
}}

Output: Ister


5. With empty filename, to hide the icon:

Input:

{{Link/render
| link=Ister
| text=Ister
}}

Output: Ister


6. With empty text, to hide the right side:

Input:

{{Link/render
| filename=Ister.png
| link=Ister
}}

Output:


7. With empty link, to omit the links:

Input:

{{Link/render
| filename=Ister.png
| text=Ister
}}

Output: Ister