Template:WildStar/api: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Created page with "Adds a wiki link to an API page to a wiki page. Optionally create complex links and ids for technical pages. See also {{t|id}}. ;Usage :1= [text] - name for page link, text, ...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{ {{PAGENAME}}|ns={{BASEPAGENAME}}}}
Adds a link an API reference page to a wiki page. Optionally create complex links and ids for technical pages. See also {{t|id}} for API links on special pages.
Adds a link an API reference page to a wiki page. Optionally create complex links and ids for technical pages. See also {{t|id}} for API links on special pages.


Line 7: Line 8:
:4= [text] - fourth part
:4= [text] - fourth part
:t= [member,method] (Optional) - ''parts'' delimiter for text and id. Only added between parts 2, 3 and 4. Default is member.
:t= [member,method] (Optional) - ''parts'' delimiter for text and id. Only added between parts 2, 3 and 4. Default is member.
:ns= [text] (Optional) - base page name for parent subpage to use. Like 'WoW' or 'WildStar'. Default is same as the including pages current namespace.


;Examples
;Examples
<pre>{{api||GameLib|GetPlayerUnit}}</pre>
<pre>{{api||GameLib|GetPlayerUnit}}</pre>
{{api||GameLib|GetPlayerUnit}}
{{ {{BASEPAGENAME}}/api||GameLib|GetPlayerUnit|ns=WildStar}}
<pre>{{api|CVAR|locale|languageId}}</pre>
<pre>{{api|CVAR|locale|languageId}}</pre>
{{api|CVAR|locale|languageId}}
{{ {{BASEPAGENAME}}/api|CVAR|locale|languageId|ns=WildStar}}
<pre>{{api|TYPE|unit}}</pre>
<pre>{{api|TYPE|unit}}</pre>
{{api|TYPE|unit}}
{{ {{BASEPAGENAME}}/api|TYPE|unit|ns=WildStar}}
<pre>{{api|TYPE|unit|GetFaction}}</pre>
<pre>{{api|TYPE|unit|GetFaction}}</pre>
{{api|TYPE|unit|GetFaction}}
{{ {{BASEPAGENAME}}/api|TYPE|unit|GetFaction|ns=WildStar}}
<pre>{{api|EVENT|ToggleQuestLog}}</pre>
<pre>{{api|EVENT|ToggleQuestLog}}</pre>
{{api|EVENT|ToggleQuestLog}}
{{ {{BASEPAGENAME}}/api|EVENT|ToggleQuestLog|ns=WildStar}}
<pre>{{api|EVENT|Apollo|ToggleQuestLog}}</pre>
<pre>{{api|EVENT|Apollo|ToggleQuestLog}}</pre>
{{api|EVENT|Apollo|ToggleQuestLog}}
{{ {{BASEPAGENAME}}/api|EVENT|Apollo|ToggleQuestLog|ns=WildStar}}


;Options
;Options
:1= Special link part names:
:1= Special link part names:
:* API - A [[UI API]] api page link. Defaults to t=member (.). Omits |2= in link text if 3 or 4 parts
:* API - A [[{{BASEPAGENAME}}/UI API|UI API]] api page link. Defaults to t=member (.). Omits |2= in link text if 3 or 4 parts
:* API TYPE - A [[API types]] api page link. Defaults to t=method (:). Omits |2= in link text if 3 or 4 parts
:* API TYPE - A [[{{BASEPAGENAME}}/API types|API types]] api page link. Defaults to t=method (:). Omits |2= in link text if 3 or 4 parts
:* API EVENT - A [[API events]] api page link. Defaults to t=member (.). Omits |2= in link text if 3 or 4 parts
:* API EVENT - A [[{{BASEPAGENAME}}/API events|API events]] api page link. Defaults to t=member (.). Omits |2= in link text if 3 or 4 parts
:* CVAR - A [[CVars]] page link. Defaults to t=member (.).
:* CVAR - A [[{{BASEPAGENAME}}/CVars|CVars]] page link. Defaults to t=member (.).
:* APIT or TYPE - short-hand for ''API TYPE''. Otherwise works the same and produces same links.
:* APIT or TYPE - short-hand for ''API TYPE''. Otherwise works the same and produces same links.
:* APIE or EVENT - short-hand for ''API EVENT''. Otherwise works the same and produces same links.
:* APIE or EVENT - short-hand for ''API EVENT''. Otherwise works the same and produces same links.
Line 39: Line 41:
:<nowiki>{{api|API|Apollo|SetAlpha|t=method}}</nowiki> - link: API Apollo SetAlpha, text: Apollo:SetAlpha
:<nowiki>{{api|API|Apollo|SetAlpha|t=method}}</nowiki> - link: API Apollo SetAlpha, text: Apollo:SetAlpha


[[Category:WS development templates|{{PAGENAME}}]][[Category:Link helper templates]]
[[Category:WildStar development templates|{{PAGENAME}}]][[Category:Link helper templates]]
----
----
;Template
;Template
<onlyinclude><!--
<onlyinclude><includeonly><!--
 
-->{{#vardefine:sub|{{{ns|{{#var:sub|{{NAMESPACE}}}}}}}}}<!--


-->{{#vardefine:t1|{{#switch:{{{1|}}}<!--  alt names
-->{{#vardefine:t1|{{#switch:{{{1|}}}<!--  alt names
Line 54: Line 58:
-->{{#vardefine:tLT2|{{#switch:{{#var:t1}}|API|API TYPE={{{2|}}}|#default={{{2|}}}}}}}<!-- link text for part 2
-->{{#vardefine:tLT2|{{#switch:{{#var:t1}}|API|API TYPE={{{2|}}}|#default={{{2|}}}}}}}<!-- link text for part 2


-->{{#if:{{{4|}}}|[[{{#var:t1}} {{{2}}} {{{3}}} {{{4}}}|{{#var:tLT2}}{{#var:tDEL}}{{{3}}}{{#var:tDEL}}{{{4}}}]]|<!--
-->{{#if:{{{4|}}}|[[{{#var:sub}}/{{#var:t1}} {{{2}}} {{{3}}} {{{4}}}|{{#var:tLT2}}{{#var:tDEL}}{{{3}}}{{#var:tDEL}}{{{4}}}]]|<!--
-->{{#if:{{{3|}}}|[[{{#var:t1}} {{{2}}} {{{3}}}|{{#var:tLT2}}{{#var:tDEL}}{{{3}}}]]|<!--
-->{{#if:{{{3|}}}|[[{{#var:sub}}/{{#var:t1}} {{{2}}} {{{3}}}|{{#var:tLT2}}{{#var:tDEL}}{{{3}}}]]|<!--
-->{{#if:{{{2|}}}|[[{{#var:t1}} {{{2}}}|{{{2}}}]]|<!--
-->{{#if:{{{2|}}}|[[{{#var:sub}}/{{#var:t1}} {{{2}}}|{{{2}}}]]|<!--
-->{{#if:{{{1|}}}|[[{{{1}}}|{{{1}}}]]|<!--
-->{{#if:{{{1|}}}|[[{{#var:sub}}/{{{1}}}|{{{1}}}]]|<!--
-->}}}}}}}}<!--
-->}}}}}}}}<!--


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

Latest revision as of 07:40, 9 August 2023

Adds a link an API reference page to a wiki page. Optionally create complex links and ids for technical pages. See also {{id}} for API links on special pages.

Usage
1= [text] - name for page link, text, and id. Not used in text or id, if parts 2, 3 or 4 are used
2= [text] - second part
3= [text] - third part
4= [text] - fourth part
t= [member,method] (Optional) - parts delimiter for text and id. Only added between parts 2, 3 and 4. Default is member.
ns= [text] (Optional) - base page name for parent subpage to use. Like 'WoW' or 'WildStar'. Default is same as the including pages current namespace.
Examples
{{api||GameLib|GetPlayerUnit}}

GameLib.GetPlayerUnit

{{api|CVAR|locale|languageId}}

locale.languageId

{{api|TYPE|unit}}

unit

{{api|TYPE|unit|GetFaction}}

unit:GetFaction

{{api|EVENT|ToggleQuestLog}}

ToggleQuestLog

{{api|EVENT|Apollo|ToggleQuestLog}}

Apollo.ToggleQuestLog

Options
1= Special link part names:
  • API - A UI API api page link. Defaults to t=member (.). Omits |2= in link text if 3 or 4 parts
  • API TYPE - A API types api page link. Defaults to t=method (:). Omits |2= in link text if 3 or 4 parts
  • API EVENT - A API events api page link. Defaults to t=member (.). Omits |2= in link text if 3 or 4 parts
  • CVAR - A CVars page link. Defaults to t=member (.).
  • APIT or TYPE - short-hand for API TYPE. Otherwise works the same and produces same links.
  • APIE or EVENT - short-hand for API EVENT. Otherwise works the same and produces same links.
Results samples
{{api||Apollo}} - link: API Apollo, text: Apollo
{{api||Apollo|Bob}} - link: API Apollo Bob, text: Apollo.Bob
{{api|CVAR|assistAttack}} - link: CVAR assistAttack, text: assistAttack
{{api|CVAR|ui|setting}} - link: CVAR ui.setting, text: ui.setting
{{api|API|Apollo|SetAlpha}} - link: API Apollo SetAlpha, text: Apollo.SetAlpha
{{api|API|Apollo|SetAlpha|t=method}} - link: API Apollo SetAlpha, text: Apollo:SetAlpha

Template