Template:Widget: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(float:right, Formatting.)
No edit summary
 
(10 intermediate revisions by 7 users not shown)
Line 1: Line 1:
Use this at the top of all WoW widget API pages. This template mostly just floats {{t|apinav}} table to the right and adds categories.


Any pages with this template will be added to [[:Category:Widgets]]. See [[Widget API]]. See also [[Template:Widgetmethod]], [[Template:Widgethandler]], [[Template:Wowapi]].
;Usage
* 1 - API context type, like 'Glue'. Default is regular game play UI context. Affects wiki categories and page parent folder. Used by 'Glue' environment API.
* t - [member, method] - identifier type for page, like if page subject is an general topic, object, method, or regular member.
* removed - patch number removed in. See also [[Template:WoW/removedapi]]
* replace - text explaining what to use if removed, replaced or deprecated.
* toc - [0,1] - Force TOC enabled or disabled. Default depends on type.
* tocright [1,0] - disables or enables toc going right side. Default is '1'.
;Examples
* <code><nowiki>{{widget}}</nowiki></code> - Used for main page, widget topics, and widget api objects
* <code><nowiki>{{widget|t=method}}</nowiki></code> - 'API Frame SetText' displays as 'Frame:SetText'.
* <code><nowiki>{{widget|t=member}}</nowiki></code> - 'API Frame parent' displays as 'Frame.parent'.
* <code><nowiki>{{widget|t=handler}}</nowiki></code> - 'UIHANDLER OnClick' displays as 'OnClick'.
[[Category:Interface customization templates|{{PAGENAME}}]]
----
;Template
<onlyinclude><includeonly>__NOWYSIWYG__<!--
-->{{#if:{{{removed|}}}|{{WoW/removedapi|{{{removed|}}}|{{{replace|}}}}}}}<!--
--><div style="float:right; margin-left:2em; margin-bottom:1em">{{apinav|toc={{{toc|}}}}}<!-- do vars after apinav so not conflict
-->{{#vardefine:tNAME|{{PAGENAME}}}}<!-- fixed-up display name without disambig prefixes
-->{{#vardefine:tTYPE|{{#sub:{{PAGENAME}}|0|3}}}}<!-- page type 'API ' - whitespace gets trimmed
-->{{#vardefine:tNSTART|{{#switch:{{#var:tTYPE}}|API=4|UIO=8|UIH=9|#default=0}}}}<!-- start of first real name
-->{{#ifeq:{{#var:tNSTART}}|0||<!--
  -->{{#vardefine:tNAME|{{#sub:{{#var:tNAME}}|{{#var:tNSTART}}}}}}<!-- to start of name without disambig
-->}}<!--
-->{{#vardefine:tSTYPE|{{lc:{{{t|{{#var:tTYPE}}}}}}}}}<!-- parameter or automatic by page name for type
-->{{#switch:{{#var:tSTYPE}}|member|method={{#vardefine:tSPAR|{{#sub:{{#var:tNAME}}|0|{{#pos:{{#var:tNAME}}|}}}}}}}}<!--
-->{{#switch:{{#var:tSTYPE}}|member|method={{#vardefine:tSNAM|{{#explode:{{#var:tNAME}}||-1}}}}}}<!--
-->{{#switch:{{#var:tSTYPE}}<!--
  -->|member|method={{#vardefine:tNAME|{{#replace:{{#var:tNAME}}||{{#ifeq:{{#var:tSTYPE}}|member|.|:}}}}}}<!--
-->}}<!--
-->{{#vardefine:tCAT|{{#switch:{{#var:tSTYPE}}|method|member=Widget methods|handler=Widget event handlers|#default=Widgets}}}}<!--
-->{{#vardefine:tSCAT|{{#switch:{{#var:tSTYPE}}|method|member=Methods|handler=Handlers|#default={{#var:tCAT}}}}}}<!--
-->{{#vardefine:tPPAGE|{{#switch:{{#var:tSTYPE}}|handler|uih=Widget handlers|#default=Widget API}}}}<!--
  --><div style="margin-left: 1em; margin-right: 1em;"><!-- cat link at bottom of api navbox
    --><small>&rarr; [[:Category:{{#var:tCAT}}|{{#var:tSCAT}}]]</small></div><!--
--></div><!--
-->{{#ifeq:{{FULLPAGENAME}}|{{PAGENAME}}|[[Category:{{#var:tCAT}}|{{#var:tNAME}}]]}}<!-- skip if cat, tempate, etc...
-->{{#if:{{{nosort|}}}||{{DEFAULTSORT:{{#var:tNAME}}}}}}<!--
-->{{#ifeq:{{#var:tSTYPE}}|uiob|{{#ifeq:{{{toc|}}}|1||__NOTOC__}}<!--
  -->|{{#ifeq:{{{toc|}}}|0|__NOTOC__|{{#ifeq:{{{tocright|1}}}|0||{{tocright}}}}}}}}<!-- toc style
-->{{#switch:{{FULLPAGENAME}}|Widget handlers|Widget API=|#default=<!-- if we are not actual list page
  -->{{DISPLAYTITLE: {{#switch:{{#var:tTYPE}}<!--
    -->|API=Widget API:|UIH=Widget handler:|UIO=Widget:|#default=}} {{#var:tNAME}}}}<!--
-->}}<!--
-->{{#ifeq:{{FULLPAGENAME}}|{{#var:tPPAGE}}<!-- if we are actual parent page, a list page
  -->|{{#ifeq:{{FULLPAGENAME}}|Widget API||&larr; [[wo:Widget API|Widget API]]|}}<!-- if top level don't render
  -->|&larr; [[{{#var:tPPAGE}}|{{#var:tPPAGE}}]]<!--
-->}}<!--
-->{{#if:{{#var:tSPAR}}|<!--
  -->&nbsp;&larr; [[UIOBJECT {{#var:tSPAR}}|{{#var:tSPAR}}]]<!--
-->}}<!--
-->{{#switch:{{#var:tTYPE}}<!-- if a list-able API signature or type, put list breadcrumb
  -->|API|UIO|UIH=&nbsp;&lt;&nbsp;[[{{#var:tPPAGE}}#{{#var:tNAME}}|{{#var:tSNAM|{{#var:tNAME}}}}]]}}<!--
tTYPE ({{#var:tTYPE}})
--></includeonly></onlyinclude>

Latest revision as of 23:48, 14 August 2023

Use this at the top of all WoW widget API pages. This template mostly just floats {{apinav}} table to the right and adds categories.

Any pages with this template will be added to Category:Widgets. See Widget API. See also Template:Widgetmethod, Template:Widgethandler, Template:Wowapi.

Usage
  • 1 - API context type, like 'Glue'. Default is regular game play UI context. Affects wiki categories and page parent folder. Used by 'Glue' environment API.
  • t - [member, method] - identifier type for page, like if page subject is an general topic, object, method, or regular member.
  • removed - patch number removed in. See also Template:WoW/removedapi
  • replace - text explaining what to use if removed, replaced or deprecated.
  • toc - [0,1] - Force TOC enabled or disabled. Default depends on type.
  • tocright [1,0] - disables or enables toc going right side. Default is '1'.
Examples
  • {{widget}} - Used for main page, widget topics, and widget api objects
  • {{widget|t=method}} - 'API Frame SetText' displays as 'Frame:SetText'.
  • {{widget|t=member}} - 'API Frame parent' displays as 'Frame.parent'.
  • {{widget|t=handler}} - 'UIHANDLER OnClick' displays as 'OnClick'.

Template