Anonymous user
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
put frame examples in tables for easier comparison
(→Custom formatting of arguments: clearer wording) |
(put frame examples in tables for easier comparison) |
||
Line 210:
Now if we were to call <code>Template:ExampleArgs</code>, the following would happen:
{| class="wikitable" style="width: 50em; max-width: 100%;"
* <code><nowiki>{{ExampleArgs}}</nowiki></code> → firstInvokeArg ▼
|-
* <code><nowiki>{{ExampleArgs|firstTemplateArg}}</nowiki></code> → firstInvokeArg▼
! style="width: 60%;" | Code
* <code><nowiki>{{ExampleArgs|firstTemplateArg|secondTemplateArg}}</nowiki></code> → firstInvokeArg secondTemplateArg▼
! 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>:
{| class="wikitable" style="width: 50em; max-width: 100%;"
** <code><nowiki>{{ExampleArgs}}</nowiki></code> → firstInvokeArg ▼
|-
** <code><nowiki>{{ExampleArgs|firstTemplateArg}}</nowiki></code> → firstInvokeArg ▼
! style="width: 60%;" | Code
** <code><nowiki>{{ExampleArgs|firstTemplateArg|secondTemplateArg}}</nowiki></code> → firstInvokeArg ▼
! style="width: 40%;" | Result
* <code>parentOnly</code>▼
|-
** <code><nowiki>{{ExampleArgs}}</nowiki></code> → ▼
| firstInvokeArg
** <code><nowiki>{{ExampleArgs|firstTemplateArg|secondTemplateArg}}</nowiki></code> → firstTemplateArg secondTemplateArg▼
|-
* <code>parentFirst</code>▼
| firstInvokeArg
** <code><nowiki>{{ExampleArgs|firstTemplateArg}}</nowiki></code> → firstTemplateArg ▼
|-
** <code><nowiki>{{ExampleArgs|firstTemplateArg|secondTemplateArg}}</nowiki></code> → firstTemplateArg secondTemplateArg▼
▲
| 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.
|