Template:Favilink: Difference between revisions
Jump to navigation
Jump to search
m (fix for wrapping issue in small spaces (like table cells)) |
(add displayname-tooltip-override (intended to fix infobox Inventory ellipses ambiguities as observed with Q Girl's credit wedge)) |
||
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_ = {{#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}}|{{#var:displayname}}]]</span></span></includeonly><noinclude> | <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_ = {{#cargo_query:table=GeneralData|fields=DisplayName|where=_pageNamespace='0' AND PlainName='{{#replace:{{{1|}}}|'|''}}'|limit=1|more results text=|default={{{1|}}} }} | 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> | ||
[[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. | !!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. | ||
Line 9: | Line 9: | ||
{{favilink|stopsvalinn}} | {{favilink|stopsvalinn}} | ||
You can | ==Optional Parameters== | ||
You can use the following values as the second argument: | |||
{| class="wikitable" | |||
! <code>plural</code> | |||
| pluralizes the item name while preserving the color formatting. | |||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
Line 17: | Line 21: | ||
{{favilink | antimatter cell | plural}} | {{favilink | antimatter cell | plural}} | ||
|- | |||
! style="white-space:nowrap;" | <code>displayname-tooltip-override</code> | |||
| 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"> | |||
{{favilink | cybernetics credit wedge 1¢ | displayname-tooltip-override}} | |||
</syntaxhighlight> | |||
<div class="qud-inventory-item" style="font-family:'Open Sans';font-size:15.5px;">{{favilink | cybernetics credit wedge 1¢ | displayname-tooltip-override}}</div> | |||
<div style="margin:1.5em 0 0.5em 2em;color:grey;"> | |||
''Compare to tooltip when this parameter is not specified:'' | |||
<div class="qud-inventory-item" style="font-family:'Open Sans';font-size:15.5px;">{{favilink | cybernetics credit wedge 1¢}}</div> | |||
</div> | |||
|- | |||
! ''<any other value>'' | |||
| completely overrides the name shown in the favilink to whatever argument specified. | |||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
Line 24: | Line 44: | ||
{{favilink|torch|A &Rreally&y spicy meatball}} | {{favilink|torch|A &Rreally&y spicy meatball}} | ||
|- | |||
|} | |||
</noinclude> | </noinclude> |
Revision as of 14:18, 25 August 2019
!!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
Used similar to regular wikipage linking syntax. First argument takes name of the page and will pull the image from that item.
{{favilink|stopsvalinn}}
Optional Parameters
You can use the following values as the second argument:
plural
|
pluralizes the item name while preserving the color formatting.
{{favilink | antimatter cell | plural}}
|
---|---|
displayname-tooltip-override
|
makes the hover tooltip equal to the display name for items whose display name doesn't match their page name, such as cybernetics credit wedge 1¢ . 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.
{{favilink | cybernetics credit wedge 1¢ | displayname-tooltip-override}}
Compare to tooltip when this parameter is not specified: |
<any other value> | completely overrides the name shown in the favilink to whatever argument specified.
{{favilink|torch|A &Rreally&y spicy meatball}}
|