Template:Code Reference: Difference between revisions

add support for property parameter
(add comment parameter)
(add support for property parameter)
Line 14: Line 14:
|-
|-
| <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>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>comment</code>  || No        || ''(None)''                      || A freeform natural-language addendum that further clarifies or explains the reference.
Line 76: Line 78:
| method    = FakeMethod(GameObject, GameObject)
| method    = FakeMethod(GameObject, GameObject)
| case      = "Foo"
| 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
}}
}}


[[Category:Templates]]</noinclude><includeonly>{{#if: {{{class |}}}
[[Category:Templates]]</noinclude><includeonly>{{#if: {{{class |}}}
| {{#if: {{{name |}}}
| {{#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: {{{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}}}}} | 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: {{{comment |}}} | {{Space}}– {{{comment}}}}}}}
     | {{#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}}
| {{Template Error}}
}}</includeonly>
}}</includeonly>