Template:Imagelink: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
m (Implement fix to make 3rd param not necessary)
(made translations depend on the language of the page the template is on; readded the caption; removed unnecessary css)
Line 1: Line 1:
<includeonly><div style="padding:5px;"><div class="icon" style="display:inline-block; position:relative; padding:3px; width:32px; height:32px; background-color:#999; border:1px solid #ccc;">{{#if: {{{link|}}}|[[File:{{{1}}}.png{{!}}32px]]|[[File:{{{1}}}.png{{!}}32px{{!}}link={{{2|}}}]]}}</div><span style="position:relative; padding:3px; font-size:larger; color: black;">{{#if: {{{link|}}}|{{#if:{{#titleparts:{{{2}}}|1|2}}|{{translation/{{#titleparts:{{{2}}}|1|2}}|{{#titleparts:{{{2}}}|1|1}}}}|{{{2}}}}}|[[{{{2}}}{{!}}{{#if:{{#titleparts:{{{2}}}|1|2}}|{{translation/{{#titleparts:{{{2}}}|1|2}}|{{#titleparts:{{{2}}}|1|1}}}}|{{{2}}}}}]]}}</span></div></includeonly>
<includeonly><div style="padding:5px;"><div class="factorio-icon" style="background-color:#999; border:1px solid #ccc;">{{#if: {{{link|}}}|[[File:{{{1}}}.png{{!}}32px]]|[[File:{{{1}}}.png{{!}}32px{{!}}link={{{2|}}}]]}}</div><span style="position:relative; padding:3px; font-size:larger; color: black;">{{#if: {{{link|}}}|{{#if:{{#titleparts:{{{2}}}| |-1}}|{{Translation|{{#titleparts:{{{2}}}|1|1}}}}|{{{2}}}}}|[[{{{2}}}{{!}}{{#if:{{{3|}}}|{{{3}}}|{{Translation|{{#titleparts:{{{2}}}|1|1}}}}}}]]}}</span></div></includeonly>


<noinclude>
<noinclude>
== Usage ==
== Usage ==
<pre>
<pre>
{{imagelink|icon|link|caption}}
{{imagelink|icon|link|caption}}
1. {{imagelink|rocket|Rocket}}
1. {{imagelink|rocket|Rocket}}
2. {{imagelink|basic-splitter|Transport network#Basic splitter|Basic splitter}}
2. {{imagelink|basic-splitter|Transport network#Basic splitter|Basic splitter}}
</pre>
</pre>
 
The template automatically translates the link if no caption is provided and the page is not in English.


== Result ==
== Result ==

Revision as of 15:18, 23 April 2017


Usage

{{imagelink|icon|link|caption}}

1. {{imagelink|rocket|Rocket}}
2. {{imagelink|basic-splitter|Transport network#Basic splitter|Basic splitter}}

The template automatically translates the link if no caption is provided and the page is not in English.

Result

1.

Rocket.png
Rocket


2.

Basic splitter