Ad placeholder

Template:IconLink: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
<includeonly>{{trim|
<includeonly>{{trim|
{{#vardefine: icon | {{{1}}} }}
{{#vardefine: link | {{{2}}} }}
{{#vardefine: text | {{{3 | {{{2}}} }}} }}
{{#vardefine: icon-link | {{#ifexist: File:{{#var:icon}} | {{{2}}} | File:{{#var:icon}} }} }}
{{#vardefine: icon-caption | {{#ifexist: File:{{#var:icon}} | {{#var:text}} | (Missing Icon) }} }}
{{#vardefine: min-w | {{{w | {{{size | 40}}} }}} }}
{{#vardefine: min-w | {{{w | {{{size | 40}}} }}} }}
{{#vardefine: max-w | {{{w|}}} }}
{{#vardefine: max-w | {{{w|}}} }}
{{#vardefine: max-h | {{{h | {{{size | 40}}} }}} }}
{{#vardefine: max-h | {{{h | {{{size | 40}}} }}} }}
}}{{#if: {{{block|}}} | <span style="display: inline-flex; align-items: center; {{#if: {{{gap|}}} | gap: {{{gap}}}px; }}"> }}<span style="display: inline-flex; align-items: center; justify-content: center; min-width: {{#var:min-w}}px; height: {{#var:max-h}}px;">{{icon | {{{1}}} | link = {{{2}}} | w = {{#var:max-w}} | h = {{#var:max-h}} }}</span>&nbsp;[[ {{{2}}} |{{{ 3 |{{{ 2 }}}}}}]]{{#if: {{{block|}}} | </span> }}</includeonly><noinclude>
}}{{#if: {{{block|}}} | <span style="display: inline-flex; align-items: center; {{#if: {{{gap|}}} | gap: {{{gap}}}px; }}"> }}<span style="display: inline-flex; align-items: center; justify-content: center; min-width: {{#var:min-w}}px; height: {{#var:max-h}}px;">{{icon | {{#var:icon}} | link = {{#var:icon-link}} | caption = {{#var:icon-caption}} | w = {{#var:max-w}} | h = {{#var:max-h}} }}</span>&nbsp;[[ {{#var:link}} | {{#var:text}} ]]{{#if: {{{block|}}} | </span> }}</includeonly><noinclude>
Usage: {{code|<nowiki>{{IconLink|Flourish Icon.png|Flourish}}</nowiki>}}
Usage: {{code|<nowiki>{{IconLink|Flourish Icon.png|Flourish}}</nowiki>}}


Line 25: Line 30:


Result: {{IconLink|Flourish Icon.png|Flourish|Custom Text|size=30}}
Result: {{IconLink|Flourish Icon.png|Flourish|Custom Text|size=30}}
Behavior on missing icon:
{{IconLink | Missing Icon 123.png | Flourish | Custom Text | size = 30 }}


The width can be set via the {{code|w}} parameter.  This could be useful if several elements are supposed to align vertically for design purposes, such as in the following table shown on our main page as of the writing of this documentation.  This also uses the {{code|block}} and {{code|gap}} parameters.  View the source of this page for usage.
The width can be set via the {{code|w}} parameter.  This could be useful if several elements are supposed to align vertically for design purposes, such as in the following table shown on our main page as of the writing of this documentation.  This also uses the {{code|block}} and {{code|gap}} parameters.  View the source of this page for usage.

Navigation menu