This template can simulate the behaviour of a template to solve the problems such as code duplication.
<!-- Template declaration -->
{{ptl|define=<template name>|tl=<nowiki>
<template code>
<!-- Parameter usage -->
<!-- All parameter names would ignore the leading and trailing spaces which is consistent with a Wikitext template -->
{{{ 1 }}} <!-- An anonymous parameter -->
{{{ name }}} <!-- A named parameter -->
{{{ 2 | default value }}} <!-- An anonymous parameter with default value -->
{{{ 3 | {{{ age | 14 }}} }}} <!-- Nested usage -->
</nowiki>
}}
<!-- Template use -->
{{ptl|use=<template name>|<parameters>...}}
<nowiki>.|), you can use {{!}} instead.use, which would call the template called last time.{{ptl|define=plus|tl=<nowiki>
{{#expr:{{{1 | 0}}} + 1}}
</nowiki>}}
{{ptl}}
{{ptl|10}}
Result:
1
11
{{ptl|define=rect|tl=<nowiki>
<div style="width:{{{width | 100px}}}; height:{{{height | 100px}}}; background:{{{color | #eee}}};"></div>
</nowiki>}}
{{ptl|define=round|tl=<nowiki>
<div style="width:{{{width | 100px}}}; height:{{{height | 100px}}}; background:{{{color | orange}}}; border-radius:50%;"></div>
</nowiki>}}
{{ptl}}
{{ptl|use=rect|color=blue}}
Result: