Anonymous user
Module:Unsubst/doc: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
m
→Usage: + notes on new parameters
m (→Usage: rm $N) |
m (→Usage: + notes on new parameters) |
||
Line 22:
Some templates have a <noinclude> but no matching </noinclude> at the end of the template. In such cases the missing </noinclude> must be added before the ending <code>{{))}}</code>.
==== Advanced ====
<pre>
{{ {{{|safesubst:}}}#invoke:Unsubst||$params=[ parameters ]|$aliases=[ aliases ]|$flags=[ flags ]|$B=
[ ... existing template code ... ]
}}
</pre>
Due to Lua limitations, parameters are normally ordered randomly when the template is substituted. {{para|$params}} can be used in #invoke:Unsubst to list template parameters in order, comma-separated (e.g. <code>egg,bacon,sausage,cheese,spam</code>). Numbered parameters should be before others in the list. Any remaining parameters are tacked onto the end of the generated invocation.
Parameter aliases can be listed in {{para|$aliases}} (and shouldn't be listed in {{para|$params}}), and will be replaced automatically. Each alias and its replacement should be formatted as <code>alias>replacement</code>, and each of those pairs should be comma-separated (e.g. <code>œuf>egg,melt>cheese</code>). Note that this parameter can function with or without {{para|$params}}.
Parameter {{para|$flags}} can be used to modify other facets of the module's behaviour; entries are comma-separated. Valid flags are <code>override</code> (allows parameters in the #invoke: to take precedence over parameters in the original template invocation); <code>keep-whitespace</code> (prevents whitespace from being trimmed from unnamed parameters); and <code>remove-empty</code> (removes empty parameters).
=== Example ===
|