https://bugzilla.wikimedia.org/show_bug.cgi?id=22636

           Summary: Make current variables available for transcluded
                    templates.
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: Page rendering
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: rene.kijew...@fu-berlin.de


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]].

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to