ಟೆಂಪ್ಲೇಟು:Indent
This template uses Lua: |
The indenter Template:indent performs a newline and indents by a specified number of spaces. However, the spaces are not all the same size, but rather a mixture of en-size & em-size spaces that have been tested to work on a wide range of browsers. (To skip by n equal-size spaces, instead use {{in5|n}}
which puts all as the standard-size " " space.)
Usage
[ಬದಲಾಯಿಸಿ]The indentation spacing generated by Template:indent will match the alignment of a colon-shift (":") by using {{indent|5}}
, or to match "::" then align by {{indent|10}}
.
Usage: {{indent|# of spaces}}
- Indents up to 30 spaces. (use
{{in5|n}}
to skip up to 50 spaces) - Indent differs from
{{Space}}
only in that it automatically begins a wrapped-newline, then spaces over n spaces, whereas{{Space}}
spaces over n in the same (current) line.
Examples
[ಬದಲಾಯಿಸಿ]The following are detailed examples, also comparing to the equivalent indentation generated if a colon-shift ":" were used instead.
Example 1 – Indenting by 5:
Some text.{{indent|5}}Some more text.
Results:
Some text.
Some more text.
Example 2 – Alignment with ":" or "::" indentations:
: Line of colon-shifted text.
{{indent|5}}Line of indent-5-shifted text.
<br> Line of br-6-nbsp-shifted text.
<br> Line of br-5-nbsp-shifted text.
<br> Line of br-5-nbsp-true-shifted text.
:: Line of 2-colon-shifted text.
{{space|10}}Line of space-10-shifted text.
Results:
- Line of colon-shifted text.
Line of indent-5-shifted text.
Line of br-6-nbsp-shifted text.
Line of br-5-nbsp-shifted text.
Line of br-5-nbsp-true-shifted text.
- Line of 2-colon-shifted text.
Line of space-10-shifted text.
Note that if the prior line is already colon-shifted text, then using "{{indent|5}}
" generates a blank line first, so instead, use "{{space|5}}
" (or such) after a colon-shifted line.
Analysis of uneven spacing
[ಬದಲಾಯಿಸಿ]Editor note This was formerly marked as unclear. If it remains unclear, tag it and/or discuss on talk:
As computers optimize code, they occasionally risk displaying unsavory results after condensing monotonous strings of characters (such as spaces). Thus, many templates around Wiki choose to avoid this hurdle by alternating different types of spaces (with the intention of displaying no differently than regular spaces).
Spaces come in two main size varieties: em spaces and en spaces. Em spaces are generally defined as the width of one character, and en spaces exactly half that size. However, there is no requirement that browsers must conform to this standard, and so templates that code in en spaces may not display uniformly across all browsers. Neither {{Indent}}
nor {{Space}}
use true space-size (that is, em-size spaces), but rather mix en and em spaces, whereas {{in5|n}}
avoids en spaces altogether and will actually skip n count of spaces, as if inserting n repetitions of an em space. This is done by alternating em spaces with an em-size non-breaking " "
—by definition, it must be the same—in order to skip a wide area.
History
[ಬದಲಾಯಿಸಿ]This template originated on the sister project Wikisource—(main page)
- —and was subsequently ported to English Wikipedia at 21:27, 26 May 2006 (UTC).
See also
[ಬದಲಾಯಿಸಿ]- Module:Indent, the Lua module this template is based on.
{{Space}}
– skips similar spacing mix of en-size & em-size spaces.{{Spaces}}
– uses non-breaking spaces.{{In5}}
– skips up to 50 equal-size spaces as all en-size spaces.