Template:Api: Difference between revisions
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.) |
mNo edit summary |
||
| Line 1: | Line 1: | ||
Creates a link to a specific API | Creates a link to a specific API element. Mark API actual pages with [[Template:widget]], [[Template:wowapi]], [[Template:attrtype]]. See shorthand templates [[Template:apif]], [[Template:apiwidget]], [[Template:xml]], [[Template:xmlattr]]. See [[Template:id]] for list links that need a page #section reference. | ||
;Usage | ;Usage | ||
:<code><nowiki>{{api|Quit}}</nowiki></code> : {{api|Quit}} | * 1 - name of the api | ||
* 2 - alternate link display text. Default is same as name of the api | |||
:<code><nowiki>{{api|PLAYER_LOGIN|t=e}}</nowiki></code> : {{api|PLAYER_LOGIN|t=e}} | * 3 - parameter list. Default is not displaying parameters. | ||
* t - type of api. Default is 'api'. Options: | |||
** a|api - API function, other WoW API well-known global, member, or method | |||
**: Function -> API Function|Function | |||
**: Name.member -> API Global member|Global.member | |||
**: Name:Method -> API Global Method|Global:Method | |||
** f|func - API function but showing ellipses and parameters | |||
** t|type - API TYPE | |||
** e|event - Event | |||
** c|cvar - CVAR | |||
** w|widget - UIOBJECT widget or widget method or other member | |||
**: Widget -> UIObject Widget|Widget | |||
**: Widget.member -> API Widget member|Widget.member | |||
**: Widget:Method -> API Widget Method|Widget:Method | |||
** m|macro - MACRO | |||
** x|xml - XML | |||
** xa|xmlattr - XML attributes | |||
;Examples | |||
API | |||
* <code><nowiki>{{api|Quit}}</nowiki></code> : {{api|Quit}} | |||
* <code><nowiki>{{api|Quit|t=f}}</nowiki></code> : {{api|Quit|t=f}} - params | |||
* <code><nowiki>{{api|AuctionFrameAuctions.duration}}</nowiki></code> : {{api|AuctionFrameAuctions.duration}} - global member | |||
* <code><nowiki>{{api|C_EquipmentSet.UseEquipmentSet}}</nowiki></code> : {{api|C_EquipmentSet.UseEquipmentSet}} | |||
* <code><nowiki>{{api|C_EquipmentSet.UseEquipmentSet||equipmentSetID|t=f}}</nowiki></code> : <br/> {{api|C_EquipmentSet.UseEquipmentSet||equipmentSetID|t=f}} | |||
Event | |||
* <code><nowiki>{{api|PLAYER_LOGIN|t=e}}</nowiki></code> : {{api|PLAYER_LOGIN|t=e}} | |||
CVar | |||
* <code><nowiki>{{api|farclip|t=c}}</nowiki></code> : {{api|farclip|t=c}} | |||
Widget | |||
* <code><nowiki>{{api|Texture|t=w}}</nowiki></code> : {{api|Texture|t=w}} - UIObject / Lua side widget | |||
* <code><nowiki>{{api|Texture:SetTexture|t=w}}</nowiki></code> : {{api|Texture:SetTexture|t=w}} - method | |||
Type | |||
* <code><nowiki>{{api|string|t=t}}</nowiki></code> : {{api|string|t=t}} | |||
Macro | |||
* <code><nowiki>{{api|wargame|t=m}}</nowiki></code> : {{api|wargame|t=m}} | |||
XML | |||
* <code><nowiki>{{api|LayoutFrame|t=x}}</nowiki></code> : {{api|LayoutFrame|t=x}} | |||
* <code><nowiki>{{api|name|t=xa}}</nowiki></code> : {{api|name|t=xa}} | |||
| Line 16: | Line 48: | ||
---- | ---- | ||
;Template | ;Template | ||
<onlyinclude><includeonly>{{# | <onlyinclude><includeonly><!-- | ||
| | |||
-->{{#vardefine:tN|{{#ifeq:{{{2|}}}||{{{1|}}}|{{{2|}}}}}}}<!-- name | |||
| | -->{{#vardefine:tP|{{#replace:{{#replace:{{{1|}}}|:|_}}|.|_}}}}<!-- page | ||
| | -->{{#vardefine:tM|{{#ifeq:{{{1|}}}|{{#var:tP}}||1}}}}<!-- is method or member | ||
| | |||
|t|type=[[API TYPE {{{1|}}}|{{ | |a|api=[[API {{{1|}}}|{{#var:tN}}]] | ||
|m|macro=[[MACRO {{{1|}}}|{{{ | -->{{#switch:{{{t|api}}} | ||
}}</includeonly></onlyinclude> | |a|api=[[API {{#var:tP}}|{{#var:tN}}]] | ||
|f|func=[[API {{#var:tP}}|{{#var:tN}}]]({{{3|}}}) | |||
|e|event=[[Events/{{#sub:{{{1|}}}|0|1}}#{{{1|}}}|{{#var:tN}}]] | |||
|c|cvar=[[CVar {{{1|}}}|{{#var:tN}}]] | |||
|w|widget=[[{{#if:{{#var:tM}}|API|UIOBJECT}} {{#var:tP}}|{{#var:tN}}]] | |||
|t|type=[[API TYPE {{{1|}}}|{{#var:tN}}]] | |||
|m|macro=[[MACRO {{{1|}}}|{{#var:tN}}]] | |||
|x|xml=[[XML/{{#var:tP}}|{{#var:tN}}]] | |||
|xa|xmlattr=[[XML attributes#{{#var:tP}}|{{#var:tN}}]] | |||
}}<!-- | |||
--></includeonly></onlyinclude> | |||
Latest revision as of 03:38, 13 February 2021
Creates a link to a specific API element. Mark API actual pages with Template:widget, Template:wowapi, Template:attrtype. See shorthand templates Template:apif, Template:apiwidget, Template:xml, Template:xmlattr. See Template:id for list links that need a page #section reference.
- Usage
- 1 - name of the api
- 2 - alternate link display text. Default is same as name of the api
- 3 - parameter list. Default is not displaying parameters.
- t - type of api. Default is 'api'. Options:
- a|api - API function, other WoW API well-known global, member, or method
- Function -> API Function|Function
- Name.member -> API Global member|Global.member
- Name:Method -> API Global Method|Global:Method
- f|func - API function but showing ellipses and parameters
- t|type - API TYPE
- e|event - Event
- c|cvar - CVAR
- w|widget - UIOBJECT widget or widget method or other member
- Widget -> UIObject Widget|Widget
- Widget.member -> API Widget member|Widget.member
- Widget:Method -> API Widget Method|Widget:Method
- m|macro - MACRO
- x|xml - XML
- xa|xmlattr - XML attributes
- a|api - API function, other WoW API well-known global, member, or method
- Examples
API
{{api|Quit}}: Quit{{api|Quit|t=f}}: Quit() - params{{api|AuctionFrameAuctions.duration}}: AuctionFrameAuctions.duration - global member{{api|C_EquipmentSet.UseEquipmentSet}}: C_EquipmentSet.UseEquipmentSet{{api|C_EquipmentSet.UseEquipmentSet||equipmentSetID|t=f}}:
C_EquipmentSet.UseEquipmentSet(equipmentSetID)
Event
{{api|PLAYER_LOGIN|t=e}}: PLAYER_LOGIN
CVar
{{api|farclip|t=c}}: farclip
Widget
{{api|Texture|t=w}}: Texture - UIObject / Lua side widget{{api|Texture:SetTexture|t=w}}: Texture:SetTexture - method
Type
{{api|string|t=t}}: string
Macro
{{api|wargame|t=m}}: wargame
XML
{{api|LayoutFrame|t=x}}: LayoutFrame{{api|name|t=xa}}: name
- Template