साँचा:Space/doc
These templates alternate HTML and unicode acceptable variations of ways to declaring spaces, forcing browsers to recognize each in turn, when their rendering would normally compact and eliminate successive spaces. In short, they force padding within, before, or after a field which includes them in a line (which in practice, is usually within a wikitable, to force alignments of long and short words, such as month names, etc.)
Usage
Note this is common usage for {{Space}} and the derivative templates (in the set: {S & SP, S2, S3, S4, S5 }) of which those with a numeric suffix {S2, S3, S4, S5} (i.e. excepting S & SP which are just short-names of {{Space}}) should be used when they work as well (most times) because {{Space}} [and therefore 'S' or 'SP'] is a large template and could cause pre-expansion template limits to be exceeded on some pages.
- Furthermore, those, unlike {{Space}} will substitute well. Subst'ing {{Space}} gives something of a mess.
- Space, on the other hand can expand to 30 logical spaces (What you get will depend on browser, font selections, etc.).
This साँचा:tl template can be used inline to create alignment between adjacent text lines, or to space out titles, etc. Like साँचा:tl, it takes a numeric argument 'nn' after the pipe and provides that many consecutive spaces. Indent differs only in that it automatically begins a newline, then spaces over nn spaces.
Examples
{{indent|2}}, {{space|7}}, {{in|7}}, etc. साँचा:indentThe templates space and indent are limited to adding 30 spaces, and have a large-ish cost in pre-expansion template size, because their logic contains 30 sets of the counted spaces. Template साँचा:tl allows 40 spaces and has logic 4x shorter than साँचा:tl. However, using them repeatedly multiplies their cost on a page, so it is recommended that specific-numbered templates be used (such as साँचा:tl to indent by 5), or else the particular 'switch line' be hand substituted in, once a desirable format effect is achieved, at least within a (frequently-used) template. For example, to indent many lines by 9 spaces, consider using the quick templates "{{i5}}{{sp4}}" together, as 5+4 = 9 spaces (for less than 100 lines, just use साँचा:tl2).
- Example 1 - comparing sp2/sp3/sp4/sp5:
- Testing sp2 on colon-line, spaced here:{{sp2}}to here.
- Testing sp3 on colon-line, spaced here:{{sp3}}to here.
- Testing sp4 on colon-line, spaced here:{{sp4}}to here.
- Testing sp5 on colon-line, spaced here:{{sp5}}to here.
- Testing 'x' s on colon-line, 5 exes here:xxxxxto here.
- Results
- Testing sp2 on a colon-line, spaced here:साँचा:sp2to here.
- Testing sp3 on a colon-line, spaced here:साँचा:sp3to here.
- Testing sp4 on a colon-line, spaced here:साँचा:sp4to here.
- Testing sp5 on a colon-line, spaced here:साँचा:sp5to here.
- Testing 'x' s on a colon-line, 5 exes here:xxxxxto here.
- Better results, for indenting large sections, can frequently be gained by using {{nowrap}} and/or the HTML formatting
<tt> ...</tt>
about any of the spacing templates, since browser design philosophy is to trim consecutive spaces, check results also in different zoom settings, and on more than one browser if possible. One repeat offender is the IE browser family... which is unfortunately the numerically predominate browser of the world, by a large margin, since it's embedded within most turn-key personal computer sales.
See also
- साँचा:tl or 'SP' — brief 'switch logic' version for inline use, defaults to 3 spaces given no numeric argument, will expand up to 8 spaces. साँचा:tl is a subset of साँचा:tl. Recommend replacing BOTH (if used 100 times), on grounds of costs to pre-expansion template limits, with inline expansions of साँचा:tl or using the numbered-versions (below), particularly in oft-used templates. Since January 2008, Wikipedia's new MediaWiki parser avoids pre-expansion and only retains the space-strings generated by those templates.
- Below are really short Nn space versions for use in tables and templates: