文件圖示 模板文件[檢視] [編輯] [歷史] [清除快取]

This template adds indentation to text using the CSS text-indent property. This property controls the indentation of the first line of a paragraph of text. It can be specified with any valid CSS unit, but em is the preferred unit. The indentation can be 0 to disable an inherited indent, or negative to achieve various special effects such as hanging indents (but use {{hanging indent}} for that). The default value is 2em.

Note that this template should not be used to attempt to replicate the printing style where the first line of every new paragraph is indented.

See the policy on indentation of paragraphs.


The primary calling convention for this template is the block-based one:

{{ti/s|CSS unit}} … text … {{ti/e}}


For a single shorter run of text containing no characters that are significant in wikicode (equals signs in particular), you can also use the inline calling convention:

{{ti|CSS unit|text}}


For most use cases though, the block calling convention is strongly recommended as it is the most flexible and creates the fewest surprising edge cases and weird behaviour..

Arguments

編輯

This template uses positional (unnamed) parameters. If only one parameter is provided it is assumed to be a CSS length value and is passed directly into the style attribute for the container (so make sure you provide a valid value here!). If you are using the inline calling convention you can also provide the text the template should apply to in the second unnamed parameter. In either case you can leave the indent amount empty and the template will default to 2em.

  {{ti}} {{ti/s}} {{ti/m}} /{{ti/c}}
1= length length length
2= text

Examples

編輯

Example: basic block based calling convention

{{ti/s}}{{lorem ipsum}}{{ti/e}}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.


Example: with a custom length

{{ti/s|5em}}{{lorem ipsum}}{{ti/e}}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.


Example: overriding an inherited text-indent

{{ti/s|5em}}
{{lorem ipsum}}
{{ti/s|0}}{{lorem ipsum}}{{ti/e}}
{{lorem ipsum}}
{{ti/e}}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.


Example: hanging indent

{{left margin|2em}}
{{ti/s|-2em}}{{lorem ipsum}}{{ti/e}}
{{div end}}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.


Basic use

編輯
{{text-indent|CSS unit|text}}

For a single shorter run of text containing no characters that are significant in wikicode (equals signs in particular), you can use the inline calling convention: the amount of indentation is given in the first parameter, and the text to which it is to be applied in the second. For most use cases though, the block calling convention is strongly recommended.

Example

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.'Cui dōnō lepidum novum libellum āridā modo pūmice expolītum

Please note that the last paragraph is not indented, since there are two new lines before it. This makes MediaWiki insert a <br /> before it which "steals" the indentation.

Page:ed use

編輯

When transcribing in Page namespace, text with indented paragraph(s) may continue across Page: breaks. On the first page, {{ti/s}} in the body, and {{ti/e}} in the footer should be used. On a continuation of an indented paragraph(s) to a subsequent page(s), ({{ti/c}} or {{ti/m}}) should be placed in the header (which cancels the indentation for the first 'paragraph' on the Page:, but not when the text is combined on transcription.) and {{ti/e}} at the end of the portion containing indented paragraphs. (either in the body, or footer dependent on the circumstances.

See also

編輯