Template:Software inline: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with "<includeonly><onlyinclude><span style="{{#ifeq:{{{2|}}}|2|background:#00000059; padding:2px; border-radius:4px;}} white-space:nowrap; display:inline-flex; gap:.35ch; align-ite...")
 
mNo edit summary
 
(8 intermediate revisions by the same user not shown)
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>{{#ifeq:{{{1|}}}|color|{{#tag:nowiki|{{{color|#5081D1}}}}}|<span style="{{#ifeq:{{{2|}}}|styled|{{#if:{{{link|}}}||color:{{{color|#5081D1}}};}} padding:2px 3px; border-radius:3px; background:#00000030; font-weight:bold;}} white-space:nowrap">{{#ifeq:{{{1|}}}|name||<span style="{{#ifeq:{{{1|}}}|icon||margin-inline-end:.2em;}} font-size:16px; user-select:none">[[File:{{{icon}}}|16px|link={{{link|}}}]]</span>}}{{#ifeq:{{{1|}}}|icon||{{#if:{{{link|}}}|{{#if:{{{external|}}}|[{{{link}}} {{#ifeq:{{{2|}}}|styled|<span style="color:{{{color|#5081D1}}}">{{{name|}}}</span>|{{{name|}}}}}]|[[:{{{link}}}|{{#ifeq:{{{2|}}}|styled|<span style="color:{{{color|#5081D1}}}">{{{name|}}}</span>|{{{name|}}}}}]]}}|{{{name|}}}}}}}</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]].
{{Note|Two template styling options (colored text) were left as something that could be used in some situations, but not everywhere.}}
{{Note|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 ==
== Parameters ==
* {{Param}}, {{Param|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).
* {{Param}}, {{Param|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).
* {{Param|name}} – The name that will be displayed. It is recommended to use the String template in this parameter to add a name translation.
* {{Param|color}} – The color that is used for colored style of this template. Supports hex, rgb, hsl, etc.
* {{Param|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.
* {{Param|icon}} – An icon that will be displayed next to the game name. You only need to enter the name and format of the image, for example, {{Code|SomeImage.png}}.
* {{Param|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, {{Code|SomeImage.png}}
* {{Param|external}} – Whether the link in the link parameter is external.
* {{Param|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.
* {{Param|link}} – The link that will be used.
* {{Param|color}} – The color that is used for certain styles of this template. Supports hex, rgb, hsl, etc.
* {{Param|name}} – The name that will be displayed.


== Example ==
== Example ==
{{CodeBlock|src=Template:Portal2 (not the actual one)|lines=9|<nowiki>{{Software inline
{{CodeBlock|src=Template:Portal2 (not the actual one)|lines=8|<nowiki>{{Software inline
| {{{1|}}}
| {{{1|}}}
| {{{2|{{{1|}}}}}}
| {{{2|{{{1|}}}}}}
| color = #23B1E5
| color = #23B1E5
| icon = Portal2-16px.png
| icon = Portal2-16px.png
| icon size = {{{icon size|}}}
| link = {{#if:{{{link}}}| {{Langprefix}}Portal 2 }}
| link = Portal 2
| name = {{#switch:{{Language}}|#default=Portal 2|ru=Портал 2}}
| name = Portal 2
}}</nowiki>}}
}}</nowiki>}}


== Child Usage ==
== Child Usage ==
These examples are written directly using this template, since the <nowiki>{{Portal2}}, {{Hl2}}, {{Hammer}}</nowiki> and other templates do not currently use this template as their base.
These examples are written directly using this template, since the {{T|Portal2}}, {{T|Cs2d}}, {{T|Hammer}} and other templates do not currently use this template as their base.
{{Table
{{Table
| {{tr|
| {{tr|
Line 45: Line 40:
{{tr|
{{tr|
  {{td| {{Code|<nowiki>{{Cs2d}}</nowiki>}} }}
  {{td| {{Code|<nowiki>{{Cs2d}}</nowiki>}} }}
  {{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|external=1|link=https://store.steampowered.com/app/666220/CS2D|name=CS2D}}! }}
  {{td| External link. }}
  {{td| External link. }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|icon}}</nowiki>}} }}
  {{td| This is {{Software inline|icon|icon|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Clickable Icon. }}
}}
}}
{{tr|
{{tr|
Line 59: Line 49:
}}
}}
{{tr|
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|1}}</nowiki>}} }}
  {{td| {{Code|<nowiki>{{Portal2|icon}}</nowiki>}} }}
  {{td| This is {{Software inline|1|1|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| Link with style № 1. }}
  {{td| Clickable Icon. }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|2}}</nowiki>}} }}
  {{td| This is {{Software inline|2|2|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Link with style № 2. }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|icon|2}}</nowiki>}} }}
  {{td| This is {{Software inline|icon|2|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Clickable Icon 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|
  {{td| {{Code|<nowiki>{{Hl2|1|mode=short}}</nowiki>}} }}
  {{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”. }}
}}
{{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|
  {{td| {{Code|<nowiki>{{Hammer|1}}</nowiki>}} }}
  {{td| This is {{Software inline|1|1|color=#6165AD|icon=Hammer-16px.png|link=Valve Hammer Editor|name=Hammer}}! }}
  {{td| Link with style № 1. }}
}}
}}
{{tr|
{{tr|
  {{td| {{Code|<nowiki>{{Hammer|mode=full}}</nowiki>}} }}
  {{td| {{Code|<nowiki>{{Portal2|styled}}</nowiki>}} }}
  {{td| This is {{Software inline|color=#6165AD|icon=Hammer-16px.png|link=Valve Hammer Editor|name={{#switch:full|full=Valve Hammer Editor|#default=Hammer}} }}! }}
  {{td| This is {{Software inline|styled|styled|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Link with custom display mode “full”. }}
  {{td| Link with styling. }}
}}
}}
{{tr|
{{tr|
  {{td| {{Code|<nowiki>{{Hammer|2|mode=full}}</nowiki>}} }}
  {{td| {{Code|<nowiki>{{Portal2|name|styled}}</nowiki>}} }}
  {{td| This is {{Software inline|2|2|color=#6165AD|icon=Hammer-16px.png|link=Valve Hammer Editor|name={{#switch:full|full=Valve Hammer Editor|#default=Hammer}} }}! }}
  {{td| This is {{Software inline|name|styled|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Link with style № 2 and custom display mode “full”. }}
  {{td| Link without icon and with styling. }}
}}
}}
{{tr|
{{tr|
  {{td| {{Code|<nowiki>{{Hammer|mode=old}}</nowiki>}} }}
  {{td| {{Code|<nowiki>{{Hammer|styled}}</nowiki>}} }}
  {{td| This is {{Software inline|color=#{{#switch:old|old=7EA465|#default=6165AD}}|icon={{#switch:old|old=Icon-Hammer_3.x.png|#default=Hammer-16px.png}}|link=Valve Hammer Editor|name={{#switch:old|old=Worldcraft|#default=Hammer}} }}! }}
  {{td| This is {{Software inline|styled|styled|color=#6165AD|icon=Hammer-16px.png|link=Valve Hammer Editor|name=Hammer}}!}}
  {{td| Link with custom display mode “old”. }}
  {{td| Link with styling. }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Hammer|mode=3x}}</nowiki>}} }}
  {{td| This is {{Software inline|color=#{{#switch:3x|3x=7EA465|#default=6165AD}}|icon={{#switch:3x|3x=Icon-Hammer_3.x.png|#default=Hammer-16px.png}}|link=Valve Hammer Editor|name={{#switch:3x|3x=Hammer 3.x|#default=Hammer}} }}! }}
  {{td| Link with custom display mode “3x”. }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|link=category}}</nowiki>}} }}
  {{td| This is {{Software inline|color=#23B1E5|icon=Portal2-16px.png|link={{#switch:category|category=Category:Portal 2|#default=Portal 2}}|name=Portal 2}}! }}
  {{td| Custom link leading to a place defined by the word “category” (In this case, this is a link to “Category:Portal 2”). }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|1|link=games}}</nowiki>}} }}
  {{td| This is {{Software inline|1|1|color=#23B1E5|icon=Portal2-16px.png|link={{#switch:games|games=Category:Portal 2 engine branch games|#default=Portal 2}}|name=Portal 2}}! }}
  {{td| Custom link leading to a place defined by the word “games” (In this case, this is a link to “Category:Portal 2 engine branch games”). }}
}}
}}
{{tr|
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|link=}}</nowiki>}} }}
  {{td| {{Code|<nowiki>{{Portal2|link=}}</nowiki>}} }}
  {{td| This is {{Software inline|color=#23B1E5|icon=Portal2-16px.png|link=|name=Portal 2}}! }}
  {{td| This is {{Software inline|color=#23B1E5|icon=Portal2-16px.png|link=|name=Portal 2}}! }}
  {{td| No Link and without style. }}
  {{td| No Link. }}
}}
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|icon size=32}}</nowiki>}} }}
  {{td| This is {{Software inline|icon size=32|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| Link with custom icon size. }}
}}
}}
{{tr|
{{tr|
  {{td| {{Code|<nowiki>{{Portal2|1|icon size=32}}</nowiki>}} }}
  {{td| {{Code|<nowiki>{{Portal2|name|link=}}</nowiki>}} }}
  {{td| This is {{Software inline|1|1|icon size=32|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| This is {{Software inline|color=#23B1E5|icon=Portal2-16px.png|name|name|link=|name=Portal 2}}! }}
  {{td| Link with style № 1 and custom icon size. }}
  {{td| No Link without icon. }}
}}
}}
{{tr|
{{tr|
  {{td|radius=0 0 0 3px| {{Code|<nowiki>{{Portal2|icon|icon size=24}}</nowiki>}} }}
  {{td| {{Code|<nowiki>{{Portal2|color}}</nowiki>}} }}
  {{td| This is {{Software inline|icon|icon size=24|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td| This is {{Software inline|color|color=#23B1E5|icon=Portal2-16px.png|link=Portal 2|name=Portal 2}}! }}
  {{td|radius=0 0 3px 0| Icon with custom size. }}
  {{td| Template color. }}
}}
}}
}}
}}

Latest revision as of 18:25, 12 May 2025

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

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).
  • {{{color}}} – The color that is used for colored style of this template. Supports hex, rgb, hsl, etc.
  • {{{icon}}} – An icon that will be displayed next to the game name. You only need to enter the name and format of the image, for example, SomeImage.png.
  • {{{external}}} – Whether the link in the link parameter is external.
  • {{{link}}} – The link that will be used.
  • {{{name}}} – The name that will be displayed.

Example

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

Child Usage

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