v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "Template:Menu icon"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(Made menu icons displayable inline so they are a closer drop in replacement for key template)
(Added "num" parameter to allow fewer icons to be displayed if desired (count from last))
Line 1: Line 1:
 
<span><!--
 
<span><!--
 +
-->{{#if:{{{num|}}}|<!-- case for "num" defined where user wants to display only the last num icons
 +
  -->{{#ifexpr:{{{num|4}}}-{{#if:{{{4|}}}|1|0}}-{{#if:{{{3|}}}|1|0}}-{{#if:{{{2|}}}|1|0}} > 0 |<!--
 +
    --><span style="display: inline-flex;"><!--
 +
    -->[[File:Ui {{{1|<noinclude>b</noinclude>}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{1|<noinclude>b</noinclude>}}}}}</span></span><!--
 +
    -->{{#ifexpr: {{#if:{{{2|}}}|1|0}} and {{{num|4}}}-{{#if:{{{4|}}}|1|0}}-{{#if:{{{3|}}}|1|0}} > 0 | {{{sep|}}}}}<!--draw sep if icon exists above and below
 +
  -->}}<!--
 +
   
 +
  -->{{#ifexpr: {{#if:{{{2|}}}|1|0}} and {{{num|4}}}-{{#if:{{{4|}}}|1|0}}-{{#if:{{{3|}}}|1|0}} > 0 |<!--
 +
    --><span style="display: inline-flex;"><!--
 +
    -->[[File:Ui {{{1}}}{{{2}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{2}}}}}</span></span><!--
 +
    -->{{#ifexpr: {{#if:{{{3|}}}|1|0}} and {{{num|4}}}-{{#if:{{{4|}}}|1|0}} > 0 | {{{sep|}}}}}<!--draw sep if icon exists above and below
 +
  -->}}<!--
  
-->{{#if:{{{1|<noinclude>b</noinclude>}}}|<!--
+
  -->{{#ifexpr: {{#if:{{{3|}}}|1|0}} and {{{num|4}}}-{{#if:{{{4|}}}|1|0}} > 0 |<!--
  --><span style="display: inline-flex;"><!--
+
    --><span style="display: inline-flex;"><!--
  -->[[File:Ui {{{1|<noinclude>b</noinclude>}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{1|<noinclude>b</noinclude>}}}}}</span></span>}}<!--
+
    -->[[File:Ui {{{1}}}{{{2}}}{{{3}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{3}}}}}</span></span><!--
 +
    -->{{#if:{{{4|}}} | {{{sep|}}}}}<!--draw sep if icon exists above and below
 +
  -->}}<!--
  
-->{{#if:{{{2|}}}|<!--
+
  -->{{#if:{{{4|}}}|<!--
  -->{{{sep|}}}<!--
+
    --><span style="display: inline-flex;"><!--
  --><span style="display: inline-flex;"><!--
+
    -->[[File:Ui {{{1}}}{{{2}}}{{{3}}}{{{4}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{4}}}}}</span></span>}}<!--
  -->[[File:Ui {{{1}}}{{{2}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{2}}}}}</span></span>}}<!--
 
  
-->{{#if:{{{3|}}}|<!--
 
  -->{{{sep|}}}<!--
 
  --><span style="display: inline-flex;"><!--
 
  -->[[File:Ui {{{1}}}{{{2}}}{{{3}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{3}}}}}</span></span>}}<!--
 
  
-->{{#if:{{{4|}}}|<!--
+
  -->|<!--simpler case for "num" undefined where user wants to display all icons
   -->{{{sep|}}}<!--
+
    --><span style="display: inline-flex;"><!--
   --><span style="display: inline-flex;"><!--
+
    -->[[File:Ui {{{1|<noinclude>b</noinclude>}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{1|<noinclude>b</noinclude>}}}}}</span></span><!--
  -->[[File:Ui {{{1}}}{{{2}}}{{{3}}}{{{4}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{4}}}}}</span></span>}}<!--
+
 
 +
  -->{{#if:{{{2|}}}|<!--
 +
    -->{{{sep|}}}<!--
 +
    --><span style="display: inline-flex;"><!--
 +
    -->[[File:Ui {{{1}}}{{{2}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{2}}}}}</span></span>}}<!--
 +
 
 +
   -->{{#if:{{{3|}}}|<!--
 +
    -->{{{sep|}}}<!--
 +
    --><span style="display: inline-flex;"><!--
 +
    -->[[File:Ui {{{1}}}{{{2}}}{{{3}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{3}}}}}</span></span>}}<!--
 +
 
 +
   -->{{#if:{{{4|}}}|<!--
 +
    -->{{{sep|}}}<!--
 +
    --><span style="display: inline-flex;"><!--
 +
    -->[[File:Ui {{{1}}}{{{2}}}{{{3}}}{{{4}}}.png]]<span style="align-self: flex-end; margin-left: -8px; margin-bottom: -2px;">{{k|{{{4}}}}}</span></span>}}<!--
 +
-->}}<!--
  
 
--></span><noinclude>
 
--></span><noinclude>
Line 34: Line 58:
 
<pre><nowiki>{{Menu icon|b}}</nowiki></pre>
 
<pre><nowiki>{{Menu icon|b}}</nowiki></pre>
  
Multiple keys can be passed as separate parameters to this template, with the "sep" parameter determining the separator (the default is an empty string).
+
Multiple keys can be passed as separate parameters to this template, with the "sep" parameter determining the separator (the default is an empty string), and the number of icons to display, counting from the end, as the "num" parameter (the default displays 4 icons).
 +
 
 +
<pre><nowiki>{{Menu icon|key|sep=separator>|num=number}}</nowiki></pre>
  
 
{|class="wikitable"
 
{|class="wikitable"
 
|-
 
|-
 
|``<nowiki>{{Menu icon|b|o}}</nowiki>`` || {{Menu icon|b|o}}
 
|``<nowiki>{{Menu icon|b|o}}</nowiki>`` || {{Menu icon|b|o}}
 +
|-
 +
|``<nowiki>{{Menu icon|num=1|b|o}}</nowiki>`` || {{Menu icon|num=1|b|o}}
 
|-
 
|-
 
|``<nowiki>{{Menu icon|b|o|sep=,}}</nowiki>`` || {{Menu icon|b|o|sep=,}}
 
|``<nowiki>{{Menu icon|b|o|sep=,}}</nowiki>`` || {{Menu icon|b|o|sep=,}}
Line 46: Line 74:
 
|``<nowiki>{{Menu icon|b|o|b|sep=-}}</nowiki>`` || {{Menu icon|b|o|b|sep=-}}
 
|``<nowiki>{{Menu icon|b|o|b|sep=-}}</nowiki>`` || {{Menu icon|b|o|b|sep=-}}
 
|-
 
|-
|``<nowiki>{{Menu icon|b|o|l|y|sep=&amp;rarr;}}</nowiki>`` || {{Menu icon|b|o|l|y|sep=&rarr;}}
+
|``<nowiki>{{Menu icon|b|o|l|y|sep=&amp;rarr;|num=2}}</nowiki>`` || {{Menu icon|b|o|l|y|sep=&rarr;|num=2}}
 
|}
 
|}
 
----
 
----

Revision as of 08:54, 4 January 2023

Ui b.pngb


Shortcut:
Template:K

Examples of Appearance

Selected from the Ui b.pngb build menu.

Usage

{{Menu icon|b}}

Multiple keys can be passed as separate parameters to this template, with the "sep" parameter determining the separator (the default is an empty string), and the number of icons to display, counting from the end, as the "num" parameter (the default displays 4 icons).

{{Menu icon|key|sep=separator>|num=number}}
{{Menu icon|b|o}} Ui b.pngbUi bo.pngo
{{Menu icon|num=1|b|o}} Ui bo.pngo
{{Menu icon|b|o|sep=,}} Ui b.pngb,Ui bo.pngo
{{Menu icon|b|sep=+|o|f|}} Ui b.pngb+Ui bo.pngo+Ui bof.pngf
{{Menu icon|b|o|b|sep=-}} Ui b.pngb-Ui bo.pngo-Ui bob.pngb
{{Menu icon|b|o|l|y|sep=&rarr;|num=2}} Ui bol.pnglUi boly.pngy

See also: {{key}}