Template:Indent/doc
{{#ifeq:doc |doc
|
{{#ifeq:show |show
| {{ {{#invoke:Namespace detect|main}}
| type = notice
| image = File:Edit-copy green.svg
| imageright =
| class =
| style = margin-bottom:1.0em;
| textstyle =
| text = This is a documentation subpage for Template:Indent.
It contains usage information, categories and other content that is not part of the original {{#if: |{{{text2}}} |{{#if: |{{{text1}}} |{{#ifeq:Template |User |template template page |{{#if:Template |template page|article}}}}}}}}.
| small =
| smallimage =
| smallimageright =
| smalltext =
| subst =
| date =
| name =
}}
}}{{#if: | | {{#ifexist:Template:Indent | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]] | }} }} | }}
{{#invoke:Lua banner|main}} {{#ifeq:{{subst:substcheck}}|SUBST
|{{#if:Confusing
|{{#invoke:Error|error|Template {{{{#if: |subst:}}Confusing{{#if: ||{{{2}}}}}{{#if: ||{{{3}}}}}{{#if: ||{{{4}}}}}{{#if: ||{{{5}}}}}{{#if: ||{{{6}}}}}{{#if: ||{{{7}}}}}{{#if: ||{{{8}}}}}{{#if: ||{{{9}}}}}{{#if: ||{{{10}}}}}{{#if: ||{{{11}}}}}{{#if: ||…}}}}
has been incorrectly substituted.|tag=}}
}}
}}{{Ambox/{{#ifeq:{{#ifeq:|section|left}}|left|small|core}}
|type = style |image = |smallimage = {{#if:|{{{smallimage}}}|}} |imageright = |smallimageright = {{#if:|{{{smallimageright}}}|}} |class = ambox-{{#switch:style |speedy = speedy |delete = delete |content = content |style = style |move = move |protection = protection |notice|#default = notice }} ambox-confusing |style = |textstyle = |smalltext = |talk = {{#switch:¬ |¬ = | = {{#ifeq:{{ safesubst:#if: {{ safesubst:#switch: | |File |MediaWiki |Category = |yes
}}
| {{ safesubst:#titleparts:{{ safesubst:#if:|{{{1}}}|Template:Indent/doc}}|1}} | {{ safesubst:#if:|{{{1}}}|Template:Indent/doc}}
}}|Template:Confusing|#}}
|#default = {{{talk}}} }} |issue = {{#switch:¬ |¬ = | = This article |This {{{sect}}} }} This article may be confusing or unclear to readers. {{#if:|In particular, {{{reason}}}.}} |fix = Please help us clarify the article; suggestions may be found on the talk page. |date = {{#switch: |¬ = | = {{#ifeq:{{ safesubst:#if: {{ safesubst:#switch: | |File |MediaWiki |Category = |yes
}}
| {{ safesubst:#titleparts:{{ safesubst:#if:|{{{1}}}|Template:Indent/doc}}|1}} | {{ safesubst:#if:|{{{1}}}|Template:Indent/doc}}
}}|Template:Confusing|November 2024}}
|#default = }} |info =
}}{{#if:
{{#ifeq: | true | dontcat }}{{#ifeq: | no | dontcat }}{{#switch: ¬ | yes | ¬ = | #default = dontcat }}{{#switch: | no = {{#switch: {{#if: | {{#if:{{#titleparts:|0|3}} | subsubpage | {{#if:{{#titleparts:|0|2}} | subpage | basepage }} }} | {{#if:{{#titleparts:Template:Indent/doc|0|3}} | subsubpage | {{#if:{{#titleparts:Template:Indent/doc|0|2}} | subpage | basepage }} }} }}
| basepage =
| subpage = dontcat
| subsubpage = dontcat
}}
| only = {{#switch: {{#if: | {{#if:{{#titleparts:|0|3}} | subsubpage | {{#if:{{#titleparts:|0|2}} | subpage | basepage }} }} | {{#if:{{#titleparts:Template:Indent/doc|0|3}} | subsubpage | {{#if:{{#titleparts:Template:Indent/doc|0|2}} | subpage | basepage }} }} }}
| basepage = dontcat
| subpage = | subsubpage = }}
}}
| |
{{#switch: {{#ifeq: | false | | {{#ifeq: | yes | | {{#ifeq: | yes | | {{#if:x
|
{{#if:{{#titleparts:{{#if:| | Template:Indent/doc }}|0|2}} | | }}
}}
}} }} }} | hide = | #default = {{#ifeq: h0#384!5nea+w9 | {{#if:Wikipedia articles needing clarification |{{#if: |{{#ifexist:Category:Wikipedia articles needing clarification from | | }} | }}
}}{{#if:All Wikipedia articles needing clarification
|
}}{{#if:
|{{#if: |{{#ifexist:Category: from | | }} |[[Category:]] }}
}}{{#if:
|[[Category:]]
}}{{#if:
|{{#if: |{{#ifexist:Category: from | | }} |[[Category:]] }}
}}{{#if:
|[[Category:]]
}}
| {{#invoke:Namespace detect|main}} | {{#iferror: {{#expr: 1 + {{#invoke:Namespace detect|main}} }}
| {{#invoke:Namespace detect|main}} | }}
}} }}
}}
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 {{[[:{{safesubst:#if: | {{{sister}}}: }}{{safesubst:#if: | {{{lang}}}: }}Template:in5|in5]]{{safesubst:#if:n||n}}{{safesubst:#if:||{{{3}}}}}}}
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 {{[[:{{safesubst:#if: | {{{sister}}}: }}{{safesubst:#if: | {{{lang}}}: }}Template:indent|indent]]{{safesubst:#if:5||5}}{{safesubst:#if:||{{{3}}}}}}}
, or to match "::" then align by {{[[:{{safesubst:#if: | {{{sister}}}: }}{{safesubst:#if: | {{{lang}}}: }}Template:indent|indent]]{{safesubst:#if:10||10}}{{safesubst:#if:||{{{3}}}}}}}
.
Usage: {{indent|# of spaces}}
- Indents up to 30 spaces. (use
{{[[:{{safesubst:#if: | {{{sister}}}: }}{{safesubst:#if: | {{{lang}}}: }}Template:in5|in5]]{{safesubst:#if:n||n}}{{safesubst:#if:||{{{3}}}}}}}
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.{{#invoke:Indent|indent|1=5|2=}}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.
{{#invoke:Indent|indent|1=5|2=}}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.
{{#invoke:String|rep| |10}}Line of space-10-shifted text.
Note that if the prior line is already colon-shifted text, then using "{{[[:{{safesubst:#if: | {{{sister}}}: }}{{safesubst:#if: | {{{lang}}}: }}Template:indent|indent]]{{safesubst:#if:5||5}}{{safesubst:#if:||{{{3}}}}}}}
" generates a blank line first, so instead, use "{{[[:{{safesubst:#if: | {{{sister}}}: }}{{safesubst:#if: | {{{lang}}}: }}Template:space|space]]{{safesubst:#if:5||5}}{{safesubst:#if:||{{{3}}}}}}}
" (or such) after a colon-shifted line.
Analysis of uneven spacing
{{#if:The non-breaking " " 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|The non-breaking " " 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|}}{{#if:
| |[{{#if:
|{{{pre-text}}} }}clarify{{#if:
| {{{post-text}}} }}]
}}{{#if:
{{#ifeq: | true | dontcat }}{{#ifeq: | no | dontcat }}{{#switch: ¬ | yes | ¬ = | #default = dontcat }}{{#switch: no | no = {{#switch: {{#if: | {{#if:{{#titleparts:|0|3}} | subsubpage | {{#if:{{#titleparts:|0|2}} | subpage | basepage }} }} | {{#if:{{#titleparts:Template:Indent/doc|0|3}} | subsubpage | {{#if:{{#titleparts:Template:Indent/doc|0|2}} | subpage | basepage }} }} }}
| basepage =
| subpage = dontcat
| subsubpage = dontcat
}}
| only = {{#switch: {{#if: | {{#if:{{#titleparts:|0|3}} | subsubpage | {{#if:{{#titleparts:|0|2}} | subpage | basepage }} }} | {{#if:{{#titleparts:Template:Indent/doc|0|3}} | subsubpage | {{#if:{{#titleparts:Template:Indent/doc|0|2}} | subpage | basepage }} }} }}
| basepage = dontcat
| subpage = | subsubpage = }}
}}
| |
{{#switch: {{#ifeq: | false | | {{#ifeq: | yes | | {{#ifeq: | yes | | {{#if:x
|
{{#if:{{#titleparts:{{#if:| | Template:Indent/doc }}|0|2}} | | }}
}}
}} }} }} | hide = | #default = {{#ifeq: h0#384!5nea+w9 |{{#if:Category:Wikipedia articles needing clarification |[[Category:Wikipedia articles needing clarification {{#if:November 2012 |from November 2012 }}]]{{#if:November 2012 |{{#ifexist:Category:Wikipedia articles needing clarification from November 2012| | }} }} }} | {{#invoke:Namespace detect|main}} | {{#iferror: {{#expr: 1 + {{#invoke:Namespace detect|main}} }}
| {{#invoke:Namespace detect|main}} | }}
}} }}
}}{{#ifeq:Template|{{subst:NAMESPACE}}||}}. Notice that neither {{indent}} nor {{space}} use true space-size, but rather mix en+em spaces, whereas "{{[[:{{safesubst:#if: | {{{sister}}}: }}{{safesubst:#if: | {{{lang}}}: }}Template:in5|in5]]{{safesubst:#if:n||n}}{{safesubst:#if:||{{{3}}}}}}}
" will actually skip n count of spaces, as if inserting n repetitions of an " " space.
History
This template originated on the sister project Wikisource—(home 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.
- Pages with broken file links
- Documentation subpages without corresponding pages
- Pages with incorrectly substituted templates
- Wikipedia articles needing clarification from
- Articles with invalid date parameter in template
- Wikipedia articles needing clarification
- All Wikipedia articles needing clarification
- From