Template:Indent

From TrainzOnline
Jump to: navigation, search


{{#switch: {{{1}}} | 1=  | 2=   | 3=    | 4=      | 5=      | 6=       | 7=        | 8=         | 9=          |10=           |11=            |12=             |13=              |14=               |15=                |16=                 |17=                  |18=                   |19=                    |20=                     |21=                      |22=                       |23=                        |24=                         |25=                          |26=                           |27=                            |28=                             |29=                              |30=                               |0|#default=}} The indenter Template:Indent puts a newline and indents the specified count of spaces.

Usage: {{indent|# of spaces}}

  • Indents up to 30 spaces, mixing en-size & em-size spaces.
  • Indent differs from {{space}} only in that it automatically begins a wrapped-newline, then spaces
    across n spaces, whereas {{space}} spaces over n in the same (current) line.

Example (indenting by 5):  Some text.{{indent|5}}Some more text.
Result:
Some text.{{#if:|
}}
{{#switch: 5 | 1=  | 2=   | 3=    | 4=      | 5=      | 6=       | 7=        | 8=         | 9=          |10=           |11=            |12=             |13=              |14=               |15=                |16=                 |17=                  |18=                   |19=                    |20=                     |21=                      |22=                       |23=                        |24=                         |25=                          |26=                           |27=                            |28=                             |29=                              |30=                               |0|#default=}}Some more text.

For more detailed examples, and for comparisons with colon-shifts ":" or "::" for indenting,
see the full documentation: Template:Indent/doc.

Also see: Template:Tl2 - to shift by n equal-size spaces.


This is a documentation subpage for Template:Indent.

 
It contains usage information, categories and other informational content that is best arranged so that it is not part of the original template page, such as in many cases, examples of how to use the template in question.
  • Documentation subpages were developed to reduce server demands, or to protect the code version of widely used templates.
     

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 Template:Tl2 which puts all as the standard-size " " space.)

Contents

The indentation spacing generated by Template:indent will match the alignment of a colon-shift (":") by using Template:Tl2, or to match "::" then align by Template:Tl2.

Usage: {{indent|# of spaces}}

  • Indents up to 30 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.{{#if:|
}}
{{#switch: 5 | 1=  | 2=   | 3=    | 4=      | 5=      | 6=       | 7=        | 8=         | 9=          |10=           |11=            |12=             |13=              |14=               |15=                |16=                 |17=                  |18=                   |19=                    |20=                     |21=                      |22=                       |23=                        |24=                         |25=                          |26=                           |27=                            |28=                             |29=                              |30=                               |0|#default=}}Some more text.

Example 2 - Alignment with ":" or "::" indentations:
: Line of colon-shifted text.
{{indent|5}}Line of indent-5-shifted text.
<br>&nbsp; &nbsp; &nbsp;&nbsp;Line of br-6-nbsp-shifted text.
<br>&nbsp; &nbsp; &nbsp;Line of br-5-nbsp-shifted text.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.

{{#if:|
}}
{{#switch: 5 | 1=  | 2=   | 3=    | 4=      | 5=      | 6=       | 7=        | 8=         | 9=          |10=           |11=            |12=             |13=              |14=               |15=                |16=                 |17=                  |18=                   |19=                    |20=                     |21=                      |22=                       |23=                        |24=                         |25=                          |26=                           |27=                            |28=                             |29=                              |30=                               |0|#default=}}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.

Template:SpaceLine of space-10-shifted text.

Note that if the prior line is already colon-shifted text, then using "Template:Tl2" generates a blank line first, so instead, use "Template:Tl2" (or such) after a colon-shifted line.

Analysis of uneven spacing

The non-breaking "&nbsp;" is exactly the same size as a space (by definition, it must be the same), so it can be alternated with spaces to skip a wider area. Notice that neither {{indent}} nor {{space}} use true space-size, but rather mix en+em spaces, whereas "Template:Tl2" will actually skip n count of spaces, as if inserting n repetitions of an "&nbsp;" space.

See also

  • {{space}} - skips similar spacing mix of en-size & em-size spaces.
  • {{in}} - skips equal-size spacing as all en-size spaces.

</noinclude>

Personal tools