Template:Favilink: Difference between revisions

712 bytes removed ,  17:21, 18 December 2023
m
Add link to the style guide page.
(Whoops, was editing an older version)
m (Add link to the style guide page.)
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>{{#vardefine:pagelink|{{#cargo_query:table=GeneralData|fields=_pageName|where=_pageNamespace='0' AND PlainName='{{#replace:{{{1|}}}|'|''}}'|limit=1|more results text=|default={{{1|}}}|format=template|template=single query result|no html }} }}{{#vardefine:displayname|{{#switch: {{{2|_NULL_}}} | _NULL_ | displayname-tooltip-override = {{#cargo_query:table=GeneralData|fields=DisplayName|where=_pageNamespace='0' AND PlainName='{{#replace:{{{1|}}}|'|''}}'|limit=1|more results text=|default={{{1|}}} }} | plural = {{#invoke: HTMLParse | pluralize | html = {{#cargo_query:table=GeneralData|fields=DisplayName|where=_pageNamespace='0' AND PlainName='{{#replace:{{{1|}}}|'|''}}'|limit=1|more results text=|default={{{1|}}}|no html}} }} | {{Qud text|&y{{{2}}}|notxml}} }} }}<span class="qud-image" style="white-space:nowrap;"><span class="qud-image-link-image-container">{{#ifexist: {{#cargo_query:table=GeneralData|fields=CONCAT('File:',Image)|where=_pageNamespace='0' AND PlainName='{{#replace:{{{1|}}}|'|''}}'|format=template|template=single query result|limit=1|more results text=}} | [[File:{{#cargo_query:table=GeneralData|fields=Image|where=_pageNamespace='0' AND PlainName='{{#replace:{{{1|}}}|'|''}}'|format=template|template=single query result|limit=1|more results text=|default=}}|16px|link={{{1|}}}]] | {{#cargo_query:table=GeneralData|fields=DisplayChar|where=_pageNamespace='0' AND PlainName='{{#replace:{{{1|}}}|'|''}}'|format=template|template=single query result|limit=1|more results text=|default=}} }}</span><span class="qud-image-link" style="color:#b1c9c3;">[[{{#var:pagelink}}|{{#ifeq: {{{2|}}} | displayname-tooltip-override | <span title="{{{1}}}">{{#var:displayname}}</span> | {{#var:displayname}} }}]]</span></span></includeonly><noinclude>
<includeonly>{{#invoke:Favilink| favilink |{{#if:{{{Page|}}}|{{{Page}}}|{{{1|}}} }}|{{{2|}}}}}</includeonly><noinclude>
[[Category:Shorthand Templates]]
[[Category:Shorthand Templates]]
!!Currently only for use for objects in the tables: ItemsTable, Food, Corpses, Characters, Locations. All possible items can be found here: [[Special:CargoTables/GeneralData]]. If an item is missing, please let [[User:Teamtoto]] know.
NOTE: this can also be invoked with [[Template:F]], which is fewer characters to type. !!Currently only for use for objects in the tables: ItemsTable, Food, Corpses, Characters, Locations. All possible items can be found here: [[Special:CargoTables/GeneralData]]. If an item is missing, please let [[User:Teamtoto]] know.
==Usage==
==Usage==
Used similar to regular wikipage linking syntax. First argument takes name of the page and will pull the image from that item.
Used similar to regular wikipage linking syntax. First argument takes name of the page and will pull the image from that item. This is not case sensitive!
<syntaxhighlight lang="xml">
<pre>
{{favilink|stopsvalinn}}
{{favilink|Stopsvalinn}}
</syntaxhighlight>
</pre>
{{favilink|stopsvalinn}}
{{favilink|Stopsvalinn}}
If you want to use the wiki's page name instead, see [[Template:Favilink page]]. For the ObjectBlueprint id (which IS case sensitive), use [[Template:Favilink id]]. See [[Style Guide#Colored Names]] for more information on when to use these different favilink types.


==Optional Parameters==
==Optional Parameters==
Line 15: Line 16:
| pluralizes the item name while preserving the color formatting.
| pluralizes the item name while preserving the color formatting.


<syntaxhighlight lang="xml">
<pre>
{{favilink | antimatter cell | plural}}
{{favilink |antimatter cell|plural}}
</syntaxhighlight>
</pre>


{{favilink | antimatter cell | plural}}
{{favilink |antimatter cell|plural}}
 
|-
! <code>possessive</code>
| makes the item name possessive while preserving the color formatting.
 
<pre>
{{favilink | Q Girl | possessive}}
</pre>
 
{{favilink | Q Girl | possessive}}


|-
|-
Line 25: Line 36:
| makes the hover tooltip equal to the display name for items whose display name doesn't match their page name, such as <code>cybernetics credit wedge 1¢</code>. This is probably only needed in special locations where part of the favilink can get truncated, such as in the Character infobox's Inventory list.
| makes the hover tooltip equal to the display name for items whose display name doesn't match their page name, such as <code>cybernetics credit wedge 1¢</code>. This is probably only needed in special locations where part of the favilink can get truncated, such as in the Character infobox's Inventory list.


<syntaxhighlight lang="xml">
<pre>
{{favilink | cybernetics credit wedge 1¢ | displayname-tooltip-override}}
{{favilink | cybernetics credit wedge 1¢ | displayname-tooltip-override}}
</syntaxhighlight>
</pre>


<div class="qud-inventory-item" style="font-family:'Open Sans';font-size:15.5px;">{{favilink | cybernetics credit wedge 1¢ | displayname-tooltip-override}}</div>
<div class="qud-inventory-item" style="font-family:'Open Sans';font-size:15.5px;">{{favilink | cybernetics credit wedge 1¢ | displayname-tooltip-override}}</div>
Line 35: Line 46:
<div class="qud-inventory-item" style="font-family:'Open Sans';font-size:15.5px;">{{favilink | cybernetics credit wedge 1¢}}</div>
<div class="qud-inventory-item" style="font-family:'Open Sans';font-size:15.5px;">{{favilink | cybernetics credit wedge 1¢}}</div>
</div>
</div>
|-
! style="white-space:nowrap;" | <code>prefix:<prefix></code>
| Prepends a prefix to the name, which can include qud text color styles.
<pre>
{{favilink | mental aggregator | prefix:&ylant&Ye&Wr&Yn&yed}}
</pre>
{{favilink | mental aggregator | prefix:&ylant&Ye&Wr&Yn&yed}}
|-
! style="white-space:nowrap;" | <code>suffix:<suffix></code>
| Postpends a suffix to the name, which can include qud text color styles.
<pre>
{{favilink | plasma grenade | suffix:mk II}}
</pre>
{{favilink | plasma grenade | suffix:mk II}}
|-
|-
! ''<any other value>''  
! ''<any other value>''  
| completely overrides the name shown in the favilink to whatever argument specified.
| completely overrides the name shown in the favilink to whatever argument specified.


<syntaxhighlight lang="xml">
<pre>
{{favilink|torch|A &Rreally&y spicy meatball}}
{{favilink|torch|A &Rreally&y spicy meatball}}
</syntaxhighlight>
</pre>


{{favilink|torch|A &Rreally&y spicy meatball}}
{{favilink|torch|A &Rreally&y spicy meatball}}