Author: rene.kijewski
Description:
It would be nice, if there would be a easier way to access the variables the "parent" template has received.
Example:
- Template {{A}} transcludes one out of three templates (let’s call them {{A/n}}), depending on a parameter it was "called" with.
- Overall, {{A/n}} are all the same, save some minor differences like their background color or the order of the lines in the infobox they are part of.
- Thus {{A/n}} have to get the same parameters. And especially they have to get the same parameters as {{A}} was "called" with. Only the one distinguishing parameter may not be needed.
By now, {{A}} would be something like
{{switch:{{{1}}}
a={{A/1 | par0={{{par0}}} | .. | parM={{{parM}}}}} |
b={{A/2 | par0={{{par0}}} | .. | parM={{{parM}}}}} |
c={{A/3 | par0={{{par0}}} | .. | parM={{{parM}}}}} |
}}.
There is much needless overhead in the source code, which could be rather good evaded, if {{A/n}} would be aware of {{A}}’s parameters, making {{A}}’s code:
{{switch:{{{1}}} |a={{A/1}} |b={{A/2}} |c={{A/3}} }}.
Proposal:
There would be three options, how to make {{A/n}} aware of {{A}}’s parameters:
- Always give the own parameters to transcluded templates.
- Add a new parameter accessing prefix for {{A/n}}: {{{..:par0}}}.
- Transclude {{A/n}} differently: {{include:A/1}}.
I would prefer the third option, because it would likely 1) be the easiest to implement, 2) have least overhead and 3) be the most explicit variant.
Main beneficiaries would be beasts like [[Template:Location map]].
Version: unspecified
Severity: enhancement