Template:For/few/doc

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

Examples[edit]

Examples[edit]

{{for/few|-|3||c|q|call=x3|few=1}} using Template:X3 gives

333--ccc-qqq-===-===
333


ccc

qqq

=

=

333a

a

ccca

qqqa

===a

=

333

a

accc

aqqq

a===

a===

{| |- | {{for/few| {{!}}- {{!}} |3||c|q|call=x3}} |} gives

333
ccc
qqq
===
===
p333<br><br>ccc<br>qqqq

rendering as:

p333aacccaqqqa===a===q

p{{for/few|a|3||c|call=x3|newlines=1|few=1}}q expands to

paaa
333

cccq

rendering as:

p333aaccca===a===a===q


{{for/few|a|3||c|call=x3|sep=-|few=1}} using Template:X3 gives

333aaccca===a===a===

p{{for/few|a|3||c|call=x3|sep=<br>|few=1}}q expands to

paaa<br>333<br><br>cccq

rendering as:

p333aaccca===a===a===q

p{{for/few|a|3||c|call=x3|newlines=1|few=1}}q expands to

paaa
333

cccq

rendering as:

p333aaccca===a===a===q

p{{for/few|a|3||c|||zzz|call=x3|newlines=1|few=1}}q expands to

paaa
333

cccq

rendering as:

p333aacccaaazzzzzzzzzq

{{for/few|a|3||c|y| |call=x3|sep=|few=1|newlines=1}}q

gives

333aacccayyyaa===q

Substitution[edit]

p{{subst:for/few|a|3||c|call=x3|nl=1|substf=subst:|substfa=subst:|substa=subst:|few=1}}q gives the wikitext

p{{x3|=|=|=|=|1=a}}{{x3|=|=|=|=|1=3}}{{x3|=|=|=|=|1=}}{{x3|=|=|=|=|1=c}}q

rendering as:

paaa333cccq


p{{subst:for/few|a|3||c|call=x3|nl=1|substf=subst:|substfa=subst:|substa=subst:|newlines=1|few=1}}q gives the wikitext

p{{x3|=|=|=|=|1=a}}{{{ undefined|
}}}{{x3|=|=|=|=|1=3}}{{{ undefined|
}}}{{x3|=|=|=|=|1=}}{{{ undefined|
}}}{{x3|=|=|=|=|1=c}}q

which expands to

paaa
333

cccq

rendering as:

paaa 333

cccq


p{{subst:for/few|a|3||c|call=x3|nl=1|substf=subst:|substfa=subst:|substa=subst:|substc=subst:|newlines=1|few=1}}q gives the wikitext

paaa{{{ undefined|
}}}333{{{ undefined|
}}}{{{ undefined|
}}}cccq

which expands to

paaa
333

cccq

rendering as:

paaa 333

cccq

Perhaps Template:For and/or Template:For/aux can be changed such that substitution gives plain newlines instead of cluttering undefined-parameter code. See also Help:Newlines and spaces.

p{{subst:for/few|a|3||c||| |call=x3|nl=1|substf=subst:|substfa=subst:|substa=subst:|substc=subst:|newlines=1|few=1}}q gives the wikitext

paaa
333

ccc

q

Thus an unnamed parameter equal to a newline can be used. To keep the number of repetitions variable this has to be at the start, e.g. parameter 1, not at the end. Parameters 1 - 150 become 2 - 151.