Template:Code Reference: Difference between revisions

Added Template:References to "see also" section
(expound on documentation)
(Added Template:References to "see also" section)
 
(10 intermediate revisions by 2 users not shown)
Line 3: Line 3:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Template Parameter !! Required? !! Default Value
! Template Parameter     !! Required? !! Default Value                   !! Notes
|-
|-
| <code>namespace</code> || No || <code>XRL.World.Parts</code>
| <code>assembly</code> || No       || <code>Assembly-CSharp.dll</code> || This is ''currently'' unused, but ought to be specified anyway if the relevant code is not in the default assembly.
|-
|-
| <code>class</code> || Yes || None – This must be specified or else the template will error.
| <code>namespace</code> || No        || <code>XRL.World.Parts</code>    ||
|-
|-
| <code>method</code> || No || None If omitted, a method name will not be included in the reference.
| <code>class</code>    || Yes      || ''(None)''                      || This must be specified or else the template will error.
|-
| <code>method</code>    || No        || ''(None)''                      || If provided, a method name will be included in the reference.
|-
| <code>case</code>     || No       || ''(None)''                      || If both this and <code>method</code> are provided, the context will be further narrowed down to a specific conditional case in the given method.
|-
| <code>property</code>  || No        || ''(None)''                      || If provided, a property name will be included in the reference. This parameter cannot be used in combination with <code>method</code>.
|-
| <code>comment</code>  || No        || ''(None)''                      || A freeform natural-language addendum that further clarifies or explains the reference.
|-
| <code>name</code>      || No        || ''(None)''                      || If this is present, the citation will be named so that it can be referred to again later by the same name with <code><nowiki><ref name="the-name-you-chose" /></nowiki></code>
|}
|}


Line 56: Line 66:
}}
}}


[[Category:Templates]]</noinclude><includeonly>{{#if:{{{class|}}}|{{#tag:ref|<code>{{{namespace|XRL.World.Parts}}}.{{{class}}}{{#if:{{{method|}}}|, method {{{method}}}}}</code>}}|[[Category:Pages with code reference errors]]}}</includeonly>
If it's necessary to be even ''more'' specific for a particularly large method (such as a <code>FireEvent</code> method), you may use the <code>case</code> parameter:
 
<pre><nowiki>{{Code Reference
| namespace = Fake.Namespace
| class    = FakeClass
| method    = FakeMethod(GameObject, GameObject)
| case      = "Foo"
}}</nowiki></pre>{{Code Reference
| namespace = Fake.Namespace
| class    = FakeClass
| method    = FakeMethod(GameObject, GameObject)
| case      = "Foo"
}}
 
In other cases, it may be useful to specify a property (instead of a method). In that case, use the following form:
 
<pre><nowiki>{{Code Reference
| namespace = Fake.Namespace
| class    = FakeClass
| property  = FakeProperty
}}</nowiki></pre>{{Code Reference
| namespace = Fake.Namespace
| class    = FakeClass
| property  = FakeProperty
}}
 
== See Also ==
* [[Template:References]]
* [[Template:XML Reference]]
* [[Template:File Reference]]
 
== References ==
<references />
 
[[Category:Reference Templates]]</noinclude><includeonly>{{#if: {{{class |}}}
| {{#if: {{{name |}}}
    | {{#tag: ref | <code>{{{namespace | XRL.World.Parts}}}.{{{class}}}</code>{{#if: {{{method |}}} |, method <code>{{{method}}}</code>{{#if: {{{case |}}} | , in the <code>{{{case}}}</code> case}}|{{#if: {{{property |}}} |, property <code>{{{property}}}</code>}}}}{{#if: {{{comment |}}} | {{Space}}– {{{comment}}}}} | name={{{name}}}}}
    | {{#tag: ref | <code>{{{namespace | XRL.World.Parts}}}.{{{class}}}</code>{{#if: {{{method |}}} |, method <code>{{{method}}}</code>{{#if: {{{case |}}} | , in the <code>{{{case}}}</code> case}}|{{#if: {{{property |}}} |, property <code>{{{property}}}</code>}}}}{{#if: {{{comment |}}} | {{Space}}– {{{comment}}}}}}}
}}
| {{Template Error}}
}}</includeonly>
312

edits