User talk:Jordan Brown/Infobox media
From Wikipedia, the free encyclopedia
[edit] Simplifying module implementation through metatemplates
Like I said, can't resist a puzzle. User:Jordan Brown/Infobox media/Sandbox is a version of the TV series module that is implemented using User:Jordan Brown/Infobox optional, so that the code creating the lines for director, network, and studio look like:
{{User:Jordan Brown/Infobox optional|Directed by|{{{director}}}}} {{User:Jordan Brown/Infobox optional|Studio|{{{studio}}}}} {{User:Jordan Brown/Infobox optional|Network|{{{network}}}}}
which is sure a heck of a lot nicer than three sets of
{{#if: {{{studio|<noinclude>-</noinclude>}}} | ! style="background: #e6e9ff;" {{!}} Studio {{!}} {{{studio}}} {{!}}- }}
I'd like to get rid of the braces around the variable name, but don't know how to get the expansion to happen at exactly the right time. (Infobox optional would have to expand to something including {{{director}}}, so that the module's template could then expand that.) Ain't programming macro languages fun?
If you want to see this version in action, you'd have to edit User:Jordan Brown/Dragnet (series) and change one of the
{{User:Jordan Brown/Infobox media/TV series ...
entries to
{{User:Jordan Brown/Infobox media/Sandbox ...
Jordan Brown 07:12, 6 December 2006 (UTC)