Template:Path: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (automatic icon switching should work now)
m (Properly switch images with {{{2}}} parameter now.)
Line 1: Line 1:
{{todo|Automatic icons (should be case insensitive):
* Use music icon if {{param|2}} is "wav", "mp3", "ogg", "vsnd_c", or any other audio formats.
* Use video icon if {{param|2}} is "bik", "avi", "wmv", "mov", "webm", "mp4", or any other video formats.
* Use picture icon if {{param|2}} is "jpg", "bmp", "tga", "vtf", "vtex_c", "spr", "png", or any other image and texture formats.
* Use executable icon if {{param|2}} is "exe", "bat", "sh", "com", "app", or any other executable applications.
* Otherwise, use generic file icon if {{param|2}} exists.}}
{{Bug|Characters "<" and ">" can break the template partially. Use {{code|<nowiki><nowiki></nowiki>}} as a workaround.{{todo|Remove unnecessary (redundant) tooltip span that does this.}}}}{{Doc}}<includeonly><onlyinclude><!--
{{Bug|Characters "<" and ">" can break the template partially. Use {{code|<nowiki><nowiki></nowiki>}} as a workaround.{{todo|Remove unnecessary (redundant) tooltip span that does this.}}}}{{Doc}}<includeonly><onlyinclude><!--
--><span title="{{#switch:{{{icon}}}
--><span title="{{#switch:{{{icon}}}
Line 20: Line 14:
--><span style="background-color:{{#if:{{{2|}}}|#984EDDCC|#536FFFCC}}; border-radius:4px 0 0 4px; padding:0 3px 0 4px; user-select:none; pointer-events:none"><!--
--><span style="background-color:{{#if:{{{2|}}}|#984EDDCC|#536FFFCC}}; border-radius:4px 0 0 4px; padding:0 3px 0 4px; user-select:none; pointer-events:none"><!--
--><span style="position:relative; top:1px">[[File:{{#if:{{{icon|}}}|{{#switch:{{{icon}}}
--><span style="position:relative; top:1px">[[File:{{#if:{{{icon|}}}|{{#switch:{{{icon}}}
|#default=icon-folder open-filled.png
|#default=icon-folder open-filled.png
|exe|executable=Icon-Windows_Executable.png
|exe|executable=Icon-Windows_Executable.png
|reg|regedit|registry|regvalue|regv=Icon-regedit-2D-PathTemplate.png
|reg|regedit|registry|regvalue|regv=Icon-regedit-2D-PathTemplate.png
|custom={{{customico}}}
|custom={{{customico}}}
|audio|sound|music=Icon-Music-Note.png
|audio|sound|music=Icon-Music-Note.png
|video|movie=Icon-Video_File-filled.png
|video|movie=Icon-Video_File-filled.png
|image|picture=Icon-Image-filled.png
|image|picture=Icon-Image-filled.png
|texture=Icon-Image-filled.png<!-- Texture file will have same icon as image, but the tooltip will remain different.-->
|texture=Icon-Image-filled.png<!-- Texture file will have same icon as image, but the tooltip will remain different.-->
|generic|file=Icon-File-filled-cropped.png
|generic|file=Icon-File-filled-cropped.png
}}|{{#switch:{{{2}}}
}}|{{#switch:{{{2}}}
|#default=icon-folder open-filled.png
|#default=icon-folder open-filled.png
|exe|executable=Icon-Windows_Executable.png
|app|bat|com|exe|sh=Icon-Windows_Executable.png
|reg|regedit|registry|regvalue|regv=Icon-regedit-2D-PathTemplate.png
|wav|mp3|ogg|vsnd_c=Icon-Music-Note.png
|custom={{{customico}}}
|avi|bik|mkv|mov|mp4|wmv|webm=Icon-Video_File-filled.png
|audio|sound|music=Icon-Music-Note.png
|apng|bmp|jpg|jpeg|png|spr|tga|tiff|vtf|vtex_c|webp=Icon-Image-filled.png
|video|movie=Icon-Video_File-filled.png
|image|picture=Icon-Image-filled.png
|texture=Icon-Image-filled.png<!-- Texture file will have same icon as image, but the tooltip will remain different.-->
|generic|file=Icon-File-filled-cropped.png
}}}}|baseline|alt={{#switch:{{{icon}}}
}}}}|baseline|alt={{#switch:{{{icon}}}
|#default={{Path/strings|Folder}}
|#default={{Path/strings|Folder}}
|exe=Windows Executable
|exe=Windows Executable
|reg|regedit|registry=Registry Path
|reg|regedit|registry=Registry Path
|regvalue|regv=Registry Value
|regvalue|regv=Registry Value
|custom=Custom Icon
|custom=Custom Icon
|audio|sound|music={{Unicode|♪}}
|audio|sound|music={{Unicode|♪}}
|video|movie={{Unicode|[►]}}
|video|movie={{Unicode|[►]}}
|image|picture={{Path/strings|ImageIconFallback}}
|image|picture={{Path/strings|ImageIconFallback}}
|texture={{Path/strings|TexturesIconFallback}}
|texture={{Path/strings|TexturesIconFallback}}
|generic|file={{Path/strings|File}} <!--alt parameter will be used for unicode fallback if the icon doesnt load properly.  
|generic|file={{Path/strings|File}} <!-- alt parameter will be used for unicode fallback if the icon doesnt load properly.  
Emojis are not recommended as older OS usually may lacking certain emojis.-->
Emojis are not recommended as older OS usually may lacking certain emojis.-->
}}|15px]]</span><!--
}}|15px]]</span><!--
--></span><!--
--></span><!--
--><code style="background-color:rgba({{#if:{{{2|}}}|152,78,221,.25|83,111,255,.25}}); border-radius:0 4px 4px 0; color:#CCC; padding:0 4px; {{#if:{{{select|}}}|user-select:{{{select}}}|}}">{{{1|}}}{{#if:{{{2|}}}|.{{#ifexist: {{{2}}} | [[{{{2}}}]] | {{{2}}} }}|}}</code><!--
--><code style="background-color:rgba({{#if:{{{2|}}}|152,78,221,.25|83,111,255,.25}}); border-radius:0 4px 4px 0; color:#CCC; padding:0 4px; {{#if:{{{select|}}}|user-select:{{{select}}}|}}">{{{1|}}}{{#if:{{{2|}}}|.{{#ifexist: {{{2}}} | [[{{{2}}}]] | {{{2}}} }}|}}</code><!--
--></span></onlyinclude></includeonly>
--></span></onlyinclude></includeonly>

Revision as of 03:17, 26 July 2023

Icon-Bug.pngBug:Characters "<" and ">" can break the template partially. Use <nowiki> as a workaround.
Todo: Remove unnecessary (redundant) tooltip span that does this.
  [todo tested in ?]
English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Curly brackets white.pngTemplate Documentation [view] [edit]
Icon-translate.png Available doc translations
View
Page history
Icon-translate.png
This template uses a strings subpage
Please follow the format on this subpage(s) to add translations.

The path to the folder or file. {{file}} aliases here.

Parameters and Examples

Parameter Description Examples Preview
{{{1}}} The path to the folder or file.
{{Path|C:\Program Files\Steam}}
FolderC:\Program Files\Steam
{{{2}}} File extension, if any. Omit the dot.
{{Path|D:\Program Files\Steam\steam|exe}}
{{Path|de_dust2|bsp}}
{{Path|materials\debug\debugempty|vtf}}
FolderD:\Program Files\Steam\steam.exe
Folderde_dust2.bsp
Foldermaterials\debug\debugempty.vtf
{{{select}}} Text selection mode based on the CSS property user-select.
No effect on some browsers.
Warning.pngWarning:select=none is likely to cause user frustration; use sparingly.
{{Path|select=none|C:\Program Files}}
{{Path|select=all|C:\Program Files}}
FolderC:\Program Files
FolderC:\Program Files
{{{icon}}}
{{{customico}}}
Changes the icon. The tooltip (which appears if you are hovering the text or the icon itself), will have it's text changed aswell.

If the images is disabled in your browser or when a new icon file is being uploaded, it may fallback to Unicode symbols or simple text.

{{{customico}}} is used to change to any icon if you want. Tooltip will likely be limited with this method, which only refers custom icon as a generic file, and may cause a scaling bug (more noticeable when zooming in).
Executable:
{{Path|hl2|exe|icon=exe}}
Registry path:
{{Path|Computer\HKEY_CURRENT_USER\SOFTWARE\Valve\Source|icon=reg}}
Registry value:
{{Path|DXLevel_V1|icon=regv}}
Audio/Music:
{{Path|Half-Life01|mp3|icon=audio}}
Videos:
{{Path|valve|bik|icon=video}}
File (generic):
{{Path|example|sound.cache|icon=file}}
Image:
{{Path|d1_trainstation_010000|jpg|icon=image}}
Texture (currently same icon, but this will likely change):
{{Path|alyx_sheet|vtf|icon=texture}}
Custom icon:
{{Path|hl2|exe|icon=custom|customico=HL2-hires.png}}
Windows Executablehl2.exe
Registry PathHKEY_CURRENT_USER\SOFTWARE\Valve\Source
Registry ValueDXLevel_V1
♪Half-Life01.mp3
[►]valve.bik
Fileexample.sound.cache
Imaged1_trainstation_010000.jpg
Texturealyx_sheet.vtf
Custom Iconp3.exe

See also