Template:Wowapi: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(This revision and previous are available under: CC BY-SA 3.0. See list of authors in previous history below.)
mNo edit summary
 
Line 1: Line 1:
Use this at the top of all global WoW 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:World of Warcraft API]] or Category:World of Warcraft API/sub-page. See [[World of Warcraft API]]. See also [[Template:Widget]], [[Template:Framexml]].
Use this at the top of all global WoW 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:World of Warcraft API]] or Category:World of Warcraft API/sub-page. See [[World of Warcraft API]]. See also [[Template:Widget]], [[Template:Framexml]].


;Usage
;Usage
:<nowiki>{{wowapi}} or {{wowapi|context}} or {{wowapi|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, type] - identifier type for page, like if page subject is an general topic, object, method, or regular member or type.
* t - [member, method, type] - identifier type for page, like if page subject is an general topic, object, method, or regular member or type.
* 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.
* toc - [0,1] - Force TOC enabled or disabled. Default depends on type.


;Examples
;Examples
* <code><nowiki>{{wowapi|Glue}}</nowiki></code> - 'World of Warcraft API/Glue', 'Category:World of Warcraft API/Glue'.
* <code><nowiki>{{wowapi|Glue}}</nowiki></code> - 'World of Warcraft API/Glue', 'Category:World of Warcraft API/Glue'  
* <code><nowiki>{{wowapi|t=method}}</nowiki></code> - 'API AuctionFrameAuction duration' displays link as 'AuctionFrameAuction:duration'.
* <code><nowiki>{{wowapi|t=method}}</nowiki></code> - 'API AuctionFrameAuction duration', displays link as 'AuctionFrameAuction:duration'.
* <code><nowiki>{{wowapi|t=member}}</nowiki></code> - 'API AuctionFrameAuction duration' displays link as 'AuctionFrameAuction.duration'.
* <code><nowiki>{{wowapi|t=member}}</nowiki></code> - 'API AuctionFrameAuction duration', displays link as 'AuctionFrameAuction.duration'.
* <code><nowiki>{{wowapic}}</nowiki></code> - 'API C EquipmentSet UseEquipmentSet', displays link as 'C_EquipmentSet.UseEquipmentSet'.


[[Category:Interface customization templates|{{PAGENAME}}]]
[[Category:Interface customization templates|{{PAGENAME}}]]
----
----
;Template
;Template
<onlyinclude><div style="float:right; margin-left:2em; margin-bottom:1em">{{apinav}}<!--
<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
 
  API TYPE UnitId
  API SomeWidget SomeMember
  API SomeWidget SomeMethod
  API C EquipmentSet UseEquipmentSet
 
-->{{#vardefine:tNAME|{{PAGENAME}}}}<!-- fixed-up display name without disambig prefixes
 
-->{{#vardefine:tTYPE|{{#sub:{{PAGENAME}}|0|4}}}}<!-- page type 'API ' - whitespace gets trimmed
-->{{#ifeq:{{#var:tTYPE}}|API|<!--
 
  -->{{#vardefine:tSTYPE|{{#sub:{{PAGENAME}}|3|5}}}}<!-- page sub-type ' TYPE '
  -->{{#vardefine:tNSTART|{{#ifeq:{{#var:tSTYPE}}|TYPE|8|4}}}}<!-- start of first real name
 
  -->{{#vardefine:tNAME|{{#sub:{{#var:tNAME}}|{{#var:tNSTART}}}}}}<!-- to start of name without disambig
 
  -->{{#vardefine:tCTYPE|{{#sub:{{#var:tNAME}}|0|2}}}}<!-- page api container type 'C '
  -->{{#ifeq:{{#var:tCTYPE}}|C|{{#vardefine:tNAME|C_{{#sub:{{#var:tNAME}}|2}}}}}}<!-- ' ' to '_'
 
-->}}<!--
 
-->{{#vardefine:tSTYPE|{{lc:{{{t|{{#var:tSTYPE}}}}}}}}}<!-- parameter or automatic by page name for type
-->{{#switch:{{#var:tSTYPE}}<!-- make name a fully qualified member or method
  -->|member|method={{#vardefine:tNAME|{{#replace:{{#var:tNAME}}|<nowiki> </nowiki>|{{#ifeq:{{#var:tSTYPE}}|member|.|:}}}}}}<!--
-->}}<!--
 
  'World of Warcraft API' 'API types' 'World of Warcraft API/Glue' 'API types/Glue' full version of parent page name
-->{{#vardefine:tPPAGE|{{#switch:{{#var:tSTYPE}}|type=API types|#default=World of Warcraft API}}{{#if:{{{1|}}}|/{{{1|}}}}}}}<!--
 
  'WoW API' 'API types' 'Glue API' 'Glue types' short version of parent page name
-->{{#vardefine:tPNAME|{{#switch:{{#var:tSTYPE}}|type={{{1|API}}} types|#default={{{1|WoW}}} API}}}}<!--
 
  --><div style="margin-left: 1em; margin-right: 1em;"><!-- cat link at bottom of api navbox
    --><small>&rarr; [[:Category:{{#var:tPPAGE}}|{{#var:tPNAME}}]]</small></div><!--
--></div><!--
-->{{#ifeq:{{FULLPAGENAME}}|Category:{{#var:tPPAGE}}||[[Category:{{#var:tPPAGE}}]]}}<!-- skip adding cat on actual cat page
-->{{#if:{{{nosort|}}}||{{DEFAULTSORT:{{#var:tNAME}}}}}}<!--
 
-->{{#ifeq:{{#var:tSTYPE}}|type|{{#ifeq:{{{toc|}}}|1||__NOTOC__}}<!--
  -->|{{#ifeq:{{{toc|}}}|0|__NOTOC__|{{#ifeq:{{{tocright|1}}}|0||{{tocright}}}}}}}}<!-- toc style
 
-->{{#ifeq:{{FULLPAGENAME}}|{{#var:tPPAGE}}||<!-- if we are not actual parent page, a list page
  -->{{DISPLAYTITLE:WoW {{{1|}}} {{#ifeq:{{#var:tSTYPE}}|type|API type:|API:}} {{#var:tNAME}}}}<!--
-->}}<!--
 
-->{{#ifeq:{{FULLPAGENAME}}|{{#var:tPPAGE}}<!-- if we are actual parent page, a list page
  -->|{{#ifeq:{{FULLPAGENAME}}|World of Warcraft API||&larr; [[World of Warcraft API|WoW API]]|}}<!-- if top level don't render
  -->|&larr; [[{{#var:tPPAGE}}|{{#var:tPNAME}}]]<!--
-->}}<!--


-->{{#vardefine:tTYPE|{{#sub:{{PAGENAME}}|0|3}}}}<!--
-->{{#switch:{{#var:tTYPE}}<!-- if a list-able API signature or type, put list breadcrumb
-->{{#vardefine:tSTYPE|{{#sub:{{PAGENAME}}|4|4}}}}<!--
  -->|API=&nbsp;&lt;&nbsp;[[{{#var:tPPAGE}}#{{#var:tNAME}}|{{#var:tNAME}}]]}}<!--
-->{{#vardefine:tNAME|{{#ifeq:{{#var:tTYPE}}|API|{{#sub:{{PAGENAME}}|{{#switch:{{#var:tSTYPE}}|TYPE=8|#default=4}}|0}}|{{PAGENAME}}}}}}<!--
-->{{#vardefine:tSTYPE|{{lc:{{{t|{{#var:tSTYPE}}}}}}}}}<!--
-->{{#switch:{{#var:tSTYPE}}|member|method={{#vardefine:tNAME|{{#replace:{{#var:tNAME}}|<nowiki> </nowiki>|{{#ifeq:{{#var:tSTYPE}}|member|.|:}}}}}}}}<!--
-->{{#vardefine:tFULLNAME|{{#switch:{{#var:tSTYPE}}|type=API types|#default=World of Warcraft API}}{{#if:{{{1|}}}|/{{{1|}}}}}}}<!--
-->{{#vardefine:tPARENTNAME|{{#switch:{{#var:tSTYPE}}|type={{{1|API}}} types|#default={{{1|WoW}}} API}}}}<!--


--><div style="margin-left: 1em; margin-right: 1em;"><small>&rarr; [[:Category:{{#var:tFULLNAME}}|{{#var:tPARENTNAME}}]]</small></div></div><!--
tTYPE ({{#var:tTYPE}})
--><includeonly><!--
  -->{{#ifeq:{{FULLPAGENAME}}|Category:{{#var:tFULLNAME}}||[[Category:{{#var:tFULLNAME}}]]}}<!--
  -->{{#if:{{{nosort|}}}||{{DEFAULTSORT:{{#var:tNAME}}}}}}__NOWYSIWYG__[[ru:Шаблон:WoWAPI]]{{#ifeq:{{#var:tSTYPE}}|type|{{#ifeq:{{{toc|}}}|1||__NOTOC__}}|{{#ifeq:{{{toc|}}}|0||{{tocright}}}}}}<!--
--></includeonly><!--
-->{{#ifeq:{{FULLPAGENAME}}|{{#var:tFULLNAME}}<!--            if is a list page
  -->|{{#ifeq:{{FULLPAGENAME}}|World of Warcraft API||&larr; [[World of Warcraft API|WoW API]]|}}<!--
  -->|&larr; [[{{#var:tFULLNAME}}|{{#var:tPARENTNAME}}]]}}<!--
-->{{#ifeq:{{#var:tTYPE}}|API<!--                            if a list-able API signature or type, put list breadcrumb
  -->|&nbsp;&lt;&nbsp;[[{{#var:tFULLNAME}}#{{#var:tNAME}}|{{#var:tNAME}}]]}}<!--


--></onlyinclude>
--></includeonly></onlyinclude>

Latest revision as of 05:13, 13 February 2021

Use this at the top of all global WoW 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:World of Warcraft API or Category:World of Warcraft API/sub-page. See World of Warcraft API. See also Template:Widget, Template:Framexml.

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, type] - identifier type for page, like if page subject is an general topic, object, method, or regular member or type.
  • 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.
Examples
  • {{wowapi|Glue}} - 'World of Warcraft API/Glue', 'Category:World of Warcraft API/Glue'
  • {{wowapi|t=method}} - 'API AuctionFrameAuction duration', displays link as 'AuctionFrameAuction:duration'.
  • {{wowapi|t=member}} - 'API AuctionFrameAuction duration', displays link as 'AuctionFrameAuction.duration'.
  • {{wowapic}} - 'API C EquipmentSet UseEquipmentSet', displays link as 'C_EquipmentSet.UseEquipmentSet'.

Template