Template:Software inline: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(No need for a standard color anymore. Also additional optimization)
Line 1: Line 1:
<includeonly><onlyinclude><span style="{{#ifeq:{{{2|}}}|2|background:#00000059; padding:2px; border-radius:4px;}} white-space:nowrap; display:inline-flex; gap:.35ch; align-items:baseline; direction:{{Text-dir|ltr=ltr|rtl=rtl}}">{{#ifeq:{{{1|}}}|name||{{#ifeq: {{{icon|}}} |||<span style="user-select:none; line-height:{{#ifeq:{{{icon size|}}}||16|{{{icon size}}}}}px; height:{{#ifeq:{{{icon size|}}}||16|{{{icon size}}}}}px; position:relative; top:-1px">[[File:{{{icon}}}|{{#ifeq:{{{icon size|}}}||16|{{{icon size}}}}}px|link={{#ifeq: {{#titleparts:{{{link|}}}|1|1}}|Ext|{{#titleparts:{{{link|}}}||2}}| {{{link|}}} }}]]</span>}}}}{{#ifeq: {{{1|}}} | icon ||<span style="line-height:16px; {{#switch:{{{2|}}}|1|2=font-weight:bold}}">{{#switch:{{#titleparts:{{{link|}}}|1|1}}|=<span {{#ifeq:{{{link|}}}|||style="color:{{#switch:{{{2|}}}|1|2={{{color|#5081D1}}}|#default=#5081D1}}"}}>{{{name|}}}</span>|Ext=[{{#titleparts:{{{link|}}}||2}} <span {{#ifeq:{{{link|}}}|||style="color:{{#switch:{{{2|}}}|1|2={{{color|#5081D1}}}|#default=#5081D1}}"}}>{{{name|}}}</span>]|#default=[[:{{{link|}}}|<span {{#ifeq:{{{link|}}}|||style="color:{{#switch:{{{2|}}}|1|2={{{color|#5081D1}}}|#default=#5081D1}}"}}>{{{name|}}}</span>]]}}<wbr></span>}}</span></onlyinclude></includeonly>
<includeonly><onlyinclude><span style="white-space:nowrap; display:inline-flex; gap:.35ch; align-items:baseline; direction:{{Text-dir|ltr=ltr|rtl=rtl}}; {{#switch:{{{2|}}}|2=border-radius:4px; padding:2px; background:#00000055}}">{{#switch:{{{1|}}}|name=|#default={{#if:{{{icon|}}}|<span style="position:relative; top:-1px; user-select:none; line-height:{{#if:{{{icon size|}}}|{{{icon size}}}|16}}px; height:{{#if:{{{icon size|}}}|{{{icon size}}}|16}}px">[[File:{{{icon}}}|{{#if:{{{icon size|}}}|{{{icon size}}}|16}}px|link={{#switch: {{#titleparts:{{{link|}}}|1|1}}|Ext={{#titleparts:{{{link|}}}||2}}|#default={{{link|}}}}}]]</span>}}}}{{#switch:{{{1|}}}|icon=|#default=<span style="line-height:16px; {{#switch:{{{2|}}}|1|2=font-weight:bold}}">{{#switch:{{#titleparts:{{{link|}}}|1|1}}|={{{name|}}}|Ext=[{{#titleparts:{{{link|}}}||2}} <span {{#switch:{{{2|}}}|1|2=style="color:{{{color|#5081D1}}}"}}>{{{name|}}}</span>]|#default=[[:{{{link|}}}|<span {{#switch:{{{2|}}}|1|2=style="color:{{{color|#5081D1}}}"}}>{{{name|}}}</span>]]}}<wbr></span>}}</span></onlyinclude></includeonly>
This template is an improved and simplified version of template [[Template:Software]].
This template is an improved and simplified version of template [[Template:Software]].


Line 47: Line 47:
  {{td| This is {{Software inline|color=#FFD700|icon=CS2D icon.png|link=ext/https://store.steampowered.com/app/666220/CS2D|name=CS2D}}! }}
  {{td| This is {{Software inline|color=#FFD700|icon=CS2D icon.png|link=ext/https://store.steampowered.com/app/666220/CS2D|name=CS2D}}! }}
  {{td| External link. }}
  {{td| External link. }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|name}}</nowiki>}} }}
  {{td| This is {{Software inline|name|name|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Link without icon. }}
}}
}}
{{tr|
{{tr|
Line 52: Line 57:
  {{td| This is {{Software inline|icon|icon|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| This is {{Software inline|icon|icon|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Clickable Icon. }}
  {{td| Clickable Icon. }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|name}}</nowiki>}} }}
  {{td| This is {{Software inline|name|name|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Link without icon. }}
}}
}}
{{tr|
{{tr|
Line 67: Line 67:
  {{td| This is {{Software inline|2|2|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| This is {{Software inline|2|2|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Link with style № 2. }}
  {{td| Link with style № 2. }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|name|1}}</nowiki>}} }}
  {{td| This is {{Software inline|name|1|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Link without icon and with style № 1. }}
}}
}}
{{tr|
{{tr|
Line 74: Line 79:
}}
}}
{{tr|
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|name|1}}</nowiki>}} }}
  {{td| {{Code|<nowiki>{{Hl2|mode=short}}</nowiki>}} }}
  {{td| This is {{Software inline|name|1|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| This is {{Software inline|color=#FFCC14|icon=Hl2-16px.png|link=Half-Life 2|name={{#switch:short|short=HL2|#default=Half-Life 2}} }}! }}
  {{td| Link without icon and with style № 1. }}
  {{td| Link with custom display mode “short”. }}
}}
}}
{{tr|
{{tr|
Line 82: Line 87:
  {{td| This is {{Software inline|1|1|color=#FFCC14|icon=Hl2-16px.png|link=Half-Life 2|name={{#switch:short|short=HL2|#default=Half-Life 2}} }}! }}
  {{td| This is {{Software inline|1|1|color=#FFCC14|icon=Hl2-16px.png|link=Half-Life 2|name={{#switch:short|short=HL2|#default=Half-Life 2}} }}! }}
  {{td| Link with style № 1 and custom display mode “short”. }}
  {{td| Link with style № 1 and custom display mode “short”. }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Hl2|2|mode=short}}</nowiki>}} }}
  {{td| This is {{Software inline|2|2|color=#FFCC14|icon=Hl2-16px.png|link=Half-Life 2|name={{#switch:short|short=HL2|#default=Half-Life 2}} }}! }}
  {{td| Link with style № 2 and custom display mode “short”. }}
}}
}}
{{tr|
{{tr|

Revision as of 06:23, 20 June 2024

This template is an improved and simplified version of template Template:Software.

Note.pngNote:Two template styling options (colored text) were left as something that could be used in some situations, but not everywhere.
Note.pngNote:All links are colored in the color of the visited link, since external links and links to Wikipedia become more difficult to read after visiting. If you have a better color for this situation, simply replace all occurrences of the color #5081D1 in the template code.

Parameters

  • {{{1}}}, {{{2}}} – specially prepared code is written into these parameters for the convenient ability to select styles and display type in child templates (see example below).
  • {{{name}}} – The name that will be displayed. It is recommended to use the String template in this parameter to add a name translation.
  • {{{link}}} – The link that will be used. It is recommended to combine this parameter with #switch: if you want to add the ability to specify more than one link. For example, links to categories related to this game.
  • {{{icon}}} – An icon that will be displayed next to the game name. Also clickable. You only need to enter the name and format of the image, for example, SomeImage.png
  • {{{icon size}}} – icon size (default is 16px). Only accepts px. In this parameter the same parameter is specified for the ability to specify the size of the icon in child templates.
  • {{{color}}} – The color that is used for certain styles of this template. Supports hex, rgb, hsl, etc.

Example

Template:Portal2 (not the actual one)
  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
{{Software inline | {{{1|}}} | {{{2|{{{1|}}}}}} | color = #23B1E5 | icon = Portal2-16px.png | icon size = {{{icon size|}}} | link = {{{link|Portal 2}}} | name = {{{String|en=Portal 2|ru=Портал 2}} }}

Child Usage

These examples are written directly using this template, since the {{Portal2}}, {{Hl2}}, {{Hammer}} and other templates do not currently use this template as their base.