On Monday, July 13, 2015 at 9:02 PM, D F wrote:
Is there a way, or some hack, for an outer template to modify some inner templates' parameters in nested template calls? For example:
{{outer| ... {{inner1|...|???}} ... {{inner2|...|???}} ... {{inner17|...|???}} ... {{inner18|...|???}} ... |language}}
so that
- if language = english, then ??? is replaced with en (before the inner templates are called)
- if language = spanish, then ??? is replaced with sp (before the inner templates are called)
This way, we only have to change the language parameter of the outer template, and all the inner templates are called with the appropriate parameter. (Instead of manually modifying the numerous inner templates.)
I know that inner templates are called before outer ones. (This would mean that the inner templates would execute with the ??? parameter, returning something that would allow the outer template to modify the ???, then the outer template would call back the inner templates with the modified parameter, before the outer template finally does it's own thing with the result. I don't know whether or not this could be hacked.)
Maybe I’m misunderstanding but you can pass template parameters as arguments to nested templates. As in,
/Page {{aha|output=hello}}
/Tempate:aha {{echo|{{{output}}}}}
/Template:echo {{{1}}}
The content of page will be “hello”. I used a named parameter so that the example is clearer; that isn’t necessary.
Hope it helps.
Thanks
Daniel Forgues _______________________________________________ Wikitext-l mailing list Wikitext-l@lists.wikimedia.org (mailto:Wikitext-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/wikitext-l