Difference between revisions of "Template:SourceMod API"

From AlliedModders Wiki
Jump to: navigation, search
m (Avoid breaking lines after the end of the template)
(Add support for linking to include file roots)
 
Line 1: Line 1:
<code>[https://sm.alliedmods.net/new-api/{{{file}}}/{{#if:{{{class|}}}|{{{class}}}/|}}{{{function}}} {{#if:{{{class|}}}|{{{class}}}.|}}{{{function}}}]</code><noinclude>
+
<code>[https://sm.alliedmods.net/new-api/{{{file}}}/{{#if:{{{class|}}}|{{{class}}}/|}}{{#if:{{{function|}}}|{{{function}}}|}} {{#if:{{{function|}}}|{{#if:{{{class|}}}|{{{class}}}.|}}{{{function}}}|<{{{file}}}>}}]</code><noinclude>
  
 
This generates a link to the [https://sm.alliedmods.net/new-api/ SourceMod Scripting API reference] entry.
 
This generates a link to the [https://sm.alliedmods.net/new-api/ SourceMod Scripting API reference] entry.
  
 
== Usage ==
 
== Usage ==
 +
 +
<nowiki>{{SourceMod API|file=dhooks}}</nowiki>
 +
produces
 +
:{{SourceMod API|file=dhooks}}
 +
 +
<nowiki>{{SourceMod API|file=sourcemod|function=OnMapStart}}</nowiki>
 +
produces
 +
:{{SourceMod API|file=sourcemod|function=OnMapStart}}
 +
 
  <nowiki>{{SourceMod API|file=datapack|class=DataPack|function=Reset}}</nowiki>
 
  <nowiki>{{SourceMod API|file=datapack|class=DataPack|function=Reset}}</nowiki>
 
produces
 
produces
Line 10: Line 19:
 
=== Parameters ===
 
=== Parameters ===
 
; file
 
; file
: the source file that contains the function.
+
: the source file that contains the function.  If no other parameters are provided, the link will be displayed as <code><file></code>.
  
 
; class
 
; class
 
: optional. The methodmap class associated with a method. If this is present, the link will be displayed as <code>Class.Method</code>.
 
: optional. The methodmap class associated with a method. If this is present, the link will be displayed as <code>Class.Method</code>.
  
; function
+
; identifier
: the function / method / other identifier.
+
: optional. The function / method / other identifier that is part of the file.
  
 
</noinclude>
 
</noinclude>

Latest revision as of 10:13, 23 October 2022

<{{{file}}}>

This generates a link to the SourceMod Scripting API reference entry.

Usage

{{SourceMod API|file=dhooks}}

produces

<dhooks>
{{SourceMod API|file=sourcemod|function=OnMapStart}}

produces

OnMapStart
{{SourceMod API|file=datapack|class=DataPack|function=Reset}}

produces

DataPack.Reset

Parameters

file
the source file that contains the function. If no other parameters are provided, the link will be displayed as <file>.
class
optional. The methodmap class associated with a method. If this is present, the link will be displayed as Class.Method.
identifier
optional. The function / method / other identifier that is part of the file.