Ad placeholder

Template:IconLink: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 9: Line 9:
{{#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 | {{#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>
}}{{#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>}}


Result: {{IconLink|Flourish Icon.png|Flourish}}
Result: {{IconLink | Flourish Icon.png | Flourish }}


The link text can be changed with a third parameter:
The link text can be changed with a third parameter:


Usage: {{code|<nowiki>{{IconLink|Flourish Icon.png|Flourish|Custom Text}}</nowiki>}}
Usage: {{code|<nowiki>{{IconLink | Flourish Icon.png | Flourish | Custom Text }}</nowiki>}}


Result: {{IconLink|Flourish Icon.png|Flourish|Custom Text}}
Result: {{IconLink | Flourish Icon.png | Flourish | Custom Text }}


The default size is {{code|x40px}} meaning the icon is scaled until the '''height''' is 40 px.  It's usually important to limit the height since the icons are used inline, and a very high inline image makes for an unpleasant text layout.
The default size is {{code|x40px}} meaning the icon is scaled until the '''height''' is 40 px.  It's usually important to limit the height since the icons are used inline, and a very high inline image makes for an unpleasant text layout.
Line 23: Line 23:
An alternative value for the height can be provided via the {{code|size}} or {{code|h}} parameters, which are synonyms:
An alternative value for the height can be provided via the {{code|size}} or {{code|h}} parameters, which are synonyms:


Usage: {{code|<nowiki>{{IconLink|size=25|Flourish Icon.png|Flourish}}</nowiki>}}
Usage: {{code|<nowiki>{{IconLink | size = 25 | Flourish Icon.png | Flourish }}</nowiki>}}


Result: {{IconLink|Flourish Icon.png|Flourish|size=30}}
Result: {{IconLink | size = 25 | Flourish Icon.png | Flourish }}


Usage: {{code|<nowiki>{{IconLink|size=25|Flourish Icon.png|Flourish|Custom Text}}</nowiki>}}
Usage: {{code|<nowiki>{{IconLink | size = 25 | Flourish Icon.png | Flourish | Custom Text }}</nowiki>}}


Result: {{IconLink|Flourish Icon.png|Flourish|Custom Text|size=30}}
Result: {{IconLink | size = 25 | Flourish Icon.png | Flourish | Custom Text }}


Behavior on missing icon:
Behavior on missing icon:

Navigation menu