Template:Widget: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (This revision and previous are available under: CC BY-SA 3.0. See list of authors in previous history below.)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Use this at the top of all WoW widget API information pages. Any pages with this template will be added to [[:Category:Widgets]]. See [[Widget API]]. See also [[Template:Widgetmethod]], [[Template:Widgethandler]], [[Template:Wowapi]].
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
;Usage
:<nowiki>{{widget}} or {{widget|t=type}}</nowiki>
* 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.
* 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.
* t - [member, method] - identifier type for page, like if page subject is an general topic, object, method, or regular member.
* toc - [0,1] - Force TOC enabled or disabled. Default depends on type. Default is 1.
* 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
;Examples
Line 16: Line 20:
----
----
;Template
;Template
<onlyinclude><!--
<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|.|:}}}}}}<!--
-->}}<!--


--><div style="float:right; margin-left:2em; margin-bottom:1em">{{apinav}}<!--
-->{{#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:tT|{{#sub:{{PAGENAME}}|0|3}}}}<!--
-->{{#vardefine:tPPAGE|{{#switch:{{#var:tSTYPE}}|handler|uih=Widget handlers|#default=Widget API}}}}<!--
-->{{#vardefine:tNAME|{{#sub:{{PAGENAME}}|{{#switch:{{#var:tT}}|API=4|UIO=8|UIH=9|#default=0}}}}}}<!--
-->{{#vardefine:tST|{{lc:{{{t|{{#var:tT}}}}}}}}}<!--
-->{{#switch:{{#var:tST}}|member|method={{#vardefine:tSPAR|{{#sub:{{#var:tNAME}}|0|{{#pos:{{#var:tNAME}}|}}}}}}}}<!--
-->{{#switch:{{#var:tST}}|member|method={{#vardefine:tSNAM|{{#explode:{{#var:tNAME}}||-1}}}}}}<!--
-->{{#switch:{{#var:tST}}|member|method={{#vardefine:tNAME|{{#replace:{{#var:tNAME}}||{{#ifeq:{{#var:tST}}|member|.|:}}}}}}}}<!--


-->{{#vardefine:tCAT|{{#switch:{{#var:tST}}|method|member=Widget methods|handler=Widget event handlers|#default=Widgets}}}}<!--
  --><div style="margin-left: 1em; margin-right: 1em;"><!-- cat link at bottom of api navbox
-->{{#vardefine:tSCAT|{{#switch:{{#var:tST}}|method|member=Methods|handler=Handlers|#default={{#var:tCAT}}}}}}<!--
    --><small>&rarr; [[:Category:{{#var:tCAT}}|{{#var:tSCAT}}]]</small></div><!--
-->{{#vardefine:tPARENT|{{#switch:{{#var:tST}}|handler|uih=Widget handlers|#default=Widget API}}}}<!--
--></div><!--
-->{{#ifeq:{{FULLPAGENAME}}|{{PAGENAME}}|[[Category:{{#var:tCAT}}|{{#var:tNAME}}]]}}<!-- skip if cat, tempate, etc...
-->{{#if:{{{nosort|}}}||{{DEFAULTSORT:{{#var:tNAME}}}}}}<!--


--><div style="margin-left:1em; margin-right:1em;"><small>&rarr; [[:Category:{{#var:tCAT}}|{{#var:tSCAT}}]]</small></div></div><!--
-->{{#ifeq:{{#var:tSTYPE}}|uiob|{{#ifeq:{{{toc|}}}|1||__NOTOC__}}<!--
--><includeonly><!--
   -->|{{#ifeq:{{{toc|}}}|0|__NOTOC__|{{#ifeq:{{{tocright|1}}}|0||{{tocright}}}}}}}}<!-- toc style
  -->{{#ifeq:{{FULLPAGENAME}}|{{PAGENAME}}|[[Category:{{#var:tCAT}}|{{#var:tNAME}}]]}}<!-- skip if cat, tempate, etc...
  -->{{#if:{{{nosort|}}}||{{DEFAULTSORT:{{#var:tNAME}}}}}}__NOWYSIWYG__<!--
   -->{{#ifeq:{{#var:tST}}|uiob|{{#ifeq:{{{toc|}}}|1||__NOTOC__}}|{{#ifeq:{{{toc|}}}|0||{{tocright}}}}}}<!--
--></includeonly><!--


-->{{#ifeq:{{FULLPAGENAME}}|{{#var:tPARENT}}<!--
-->{{#switch:{{FULLPAGENAME}}|Widget handlers|Widget API=|#default=<!-- if we are not actual list page
   -->|{{#ifeq:{{FULLPAGENAME}}|Widget API||&larr; [[Widget API]]|}}<!--
  -->{{DISPLAYTITLE: {{#switch:{{#var:tTYPE}}<!--
   -->|&larr; [[{{#var:tPARENT}}|{{#var:tPARENT}}]]<!--
    -->|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}}]]<!--
-->}}<!--
-->}}<!--


Line 47: Line 72:
-->}}<!--
-->}}<!--


-->{{#switch:{{#var:tT}}|API|UIO|UIH=&nbsp;&lt;&nbsp;[[{{#var:tPARENT}}#{{#var:tNAME}}|{{#var:tSNAM|{{#var:tNAME}}}}]]}}<!--
-->{{#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}})


--></onlyinclude>
--></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