Module:Arguments/doc: Difference between revisions
From Mariopedia, a wiki on Mario, Yoshi, Wario, Donkey Kong, Super Smash Bros., and more!
Jump to navigationJump to search
Content added Content deleted
(→Custom formatting of arguments: clearer wording) |
(put frame examples in tables for easier comparison) |
||
Line 210: | Line 210: | ||
Now if we were to call <code>Template:ExampleArgs</code>, the following would happen: |
Now if we were to call <code>Template:ExampleArgs</code>, the following would happen: |
||
{| class="wikitable" style="width: 50em; max-width: 100%;" |
|||
⚫ | |||
|- |
|||
⚫ | |||
! style="width: 60%;" | Code |
|||
⚫ | |||
! style="width: 40%;" | Result |
|||
|- |
|||
⚫ | |||
| firstInvokeArg |
|||
|- |
|||
⚫ | |||
| firstInvokeArg |
|||
|- |
|||
⚫ | |||
| firstInvokeArg secondTemplateArg |
|||
|} |
|||
There are three options you can set to change this behaviour: <code>frameOnly</code>, <code>parentOnly</code> and <code>parentFirst</code>. If you set <code>frameOnly</code> then only arguments passed from the current frame will be accepted; if you set <code>parentOnly</code> then only only arguments passed from the parent frame will be accepted; and if you set <code>parentFirst</code> then arguments will be passed from both the current and parent frames, but the parent frame will have priority over the current frame. Here are the results in terms of <code>Template:ExampleArgs</code>: |
There are three options you can set to change this behaviour: <code>frameOnly</code>, <code>parentOnly</code> and <code>parentFirst</code>. If you set <code>frameOnly</code> then only arguments passed from the current frame will be accepted; if you set <code>parentOnly</code> then only only arguments passed from the parent frame will be accepted; and if you set <code>parentFirst</code> then arguments will be passed from both the current and parent frames, but the parent frame will have priority over the current frame. Here are the results in terms of <code>Template:ExampleArgs</code>: |
||
; frameOnly |
|||
{| class="wikitable" style="width: 50em; max-width: 100%;" |
|||
⚫ | |||
|- |
|||
⚫ | |||
! style="width: 60%;" | Code |
|||
⚫ | |||
! style="width: 40%;" | Result |
|||
⚫ | |||
|- |
|||
⚫ | |||
| <code><nowiki>{{ExampleArgs}}</nowiki></code> |
|||
| firstInvokeArg |
|||
⚫ | |||
|- |
|||
⚫ | |||
| <code><nowiki>{{ExampleArgs|firstTemplateArg}}</nowiki></code> |
|||
| firstInvokeArg |
|||
⚫ | |||
|- |
|||
⚫ | |||
⚫ | |||
| firstInvokeArg |
|||
|} |
|||
⚫ | |||
{| class="wikitable" style="width: 50em; max-width: 100%;" |
|||
|- |
|||
! style="width: 60%;" | Code |
|||
! style="width: 40%;" | Result |
|||
|- |
|||
⚫ | |||
| |
|||
|- |
|||
⚫ | |||
| firstTemplateArg |
|||
|- |
|||
⚫ | |||
| firstTemplateArg secondTemplateArg |
|||
|} |
|||
⚫ | |||
{| class="wikitable" style="width: 50em; max-width: 100%;" |
|||
|- |
|||
! style="width: 60%;" | Code |
|||
! style="width: 40%;" | Result |
|||
|- |
|||
⚫ | |||
| firstInvokeArg |
|||
|- |
|||
⚫ | |||
| firstTemplateArg |
|||
|- |
|||
⚫ | |||
| firstTemplateArg secondTemplateArg |
|||
|} |
|||
Note: if you set both the <code>frameOnly</code> and <code>parentOnly</code> options, the module won't fetch any arguments at all from #invoke. This is probably not what you want. |
Note: if you set both the <code>frameOnly</code> and <code>parentOnly</code> options, the module won't fetch any arguments at all from #invoke. This is probably not what you want. |