Template:Code Reference: Difference between revisions

add case parameter
m (replace error category with Template:Template Error)
(add case parameter)
Line 9: Line 9:
| <code>class</code> || Yes || None – This must be specified or else the template will error.
| <code>class</code> || Yes || None – This must be specified or else the template will error.
|-
|-
| <code>method</code> || No || None – If omitted, a method name will not be included in the reference.
| <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.
|}
|}


Line 56: Line 58:
}}
}}


[[Category:Templates]]</noinclude><includeonly>{{#if:{{{class|}}}|{{#tag:ref|<code>{{{namespace|XRL.World.Parts}}}.{{{class}}}{{#if:{{{method|}}}|, method {{{method}}}}}</code>}}|{{Template Error}}}}</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"
}}
 
[[Category:Templates]]</noinclude><includeonly>{{#if:{{{class|}}}|{{#tag:ref|<code>{{{namespace|XRL.World.Parts}}}.{{{class}}}</code>{{#if:{{{method|}}}|, method <code>{{{method}}}</code>{{#if:{{{case|}}}|, in the <code>{{{case}}}</code> case}}}}}}|{{Template Error}}}}</includeonly>