Template:Var: Difference between revisions
Created page with "{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> This template is to help facilitate the displaying of variable names (in ma..." |
(No difference)
|
Latest revision as of 05:30, December 13, 2014
Template loop detected: Template:Documentation subpage
Usage[edit]
- {{{{#if:|subst:|{{#if:|:| }}}}Documentation subpage{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}}
- or
- {{{{#if:|subst:|{{#if:|:| }}}}Documentation subpage {{#if:[[Template loop detected: Template:Documentation subpage
This template is to help facilitate the displaying of variable names (in mathematics, computer source code, wikimarkup, etc.) with the semantically correct Template:Tag tags, which also renders the variable in italics, as is customary. This method is preferred to simply italicizing for many reasons, including accessibility, separation of presentation and content, semantic Web, and metadata; In XHTML and HTML, the Template:Tag element has semantic meaning, while simple italicization does not. "Variable" in this sense may include arbitrary or unknown names or terms, example human input, arithmetical variables in equations, etc. This template (and the underlying XHTML) are generally Template:Em used if MediaWiki's Template:Tag tags (or any other stand-alone mathematical markup) are being used.
- Example
- Template:Tlxb
outputs the following HTML:
which renders as:
- Template loop detected: Template:Var
Note that on the screen or in print, this renders as simple italicization, as does Template:Code (using pairs of apostrophes) or Template:Tag (using HTML), yet it carries more semantic meaning than either of these methods.
At times, you may wish to use a serif font. This is especially true when attempting to render single-letter variables like "I" (upper-case "i") and "l" (lower-case "L"), since they are nearly indistinguishable (if at all). In such situations, use the {{{{#if:|subst:|{{#if:|:| }}}}varserif{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}} template instead of Template:Tnull, to make them more distinguishable, like these serif examples: Template:Varserif, Template:Varserif.
- More examples
Template:Semantic markup templates
]]||[[Template loop detected: Template:Documentation subpage
This template is to help facilitate the displaying of variable names (in mathematics, computer source code, wikimarkup, etc.) with the semantically correct Template:Tag tags, which also renders the variable in italics, as is customary. This method is preferred to simply italicizing for many reasons, including accessibility, separation of presentation and content, semantic Web, and metadata; In XHTML and HTML, the Template:Tag element has semantic meaning, while simple italicization does not. "Variable" in this sense may include arbitrary or unknown names or terms, example human input, arithmetical variables in equations, etc. This template (and the underlying XHTML) are generally Template:Em used if MediaWiki's Template:Tag tags (or any other stand-alone mathematical markup) are being used.
- Example
- Template:Tlxb
outputs the following HTML:
which renders as:
- Template loop detected: Template:Var
Note that on the screen or in print, this renders as simple italicization, as does Template:Code (using pairs of apostrophes) or Template:Tag (using HTML), yet it carries more semantic meaning than either of these methods.
At times, you may wish to use a serif font. This is especially true when attempting to render single-letter variables like "I" (upper-case "i") and "l" (lower-case "L"), since they are nearly indistinguishable (if at all). In such situations, use the {{{{#if:|subst:|{{#if:|:| }}}}varserif{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}} template instead of Template:Tnull, to make them more distinguishable, like these serif examples: Template:Varserif, Template:Varserif.
- More examples
Template:Semantic markup templates
]]}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}}
Userbox documentation[edit]
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
- {{{{#if:|subst:|{{#if:|:| }}}}Userbox documentation subpage{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}}
- or
- {{{{#if:|subst:|{{#if:|:| }}}}Userbox documentation subpage {{#if:[[Template loop detected: Template:Documentation subpage
This template is to help facilitate the displaying of variable names (in mathematics, computer source code, wikimarkup, etc.) with the semantically correct Template:Tag tags, which also renders the variable in italics, as is customary. This method is preferred to simply italicizing for many reasons, including accessibility, separation of presentation and content, semantic Web, and metadata; In XHTML and HTML, the Template:Tag element has semantic meaning, while simple italicization does not. "Variable" in this sense may include arbitrary or unknown names or terms, example human input, arithmetical variables in equations, etc. This template (and the underlying XHTML) are generally Template:Em used if MediaWiki's Template:Tag tags (or any other stand-alone mathematical markup) are being used.
- Example
- Template:Tlxb
outputs the following HTML:
which renders as:
- Template loop detected: Template:Var
Note that on the screen or in print, this renders as simple italicization, as does Template:Code (using pairs of apostrophes) or Template:Tag (using HTML), yet it carries more semantic meaning than either of these methods.
At times, you may wish to use a serif font. This is especially true when attempting to render single-letter variables like "I" (upper-case "i") and "l" (lower-case "L"), since they are nearly indistinguishable (if at all). In such situations, use the {{{{#if:|subst:|{{#if:|:| }}}}varserif{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}} template instead of Template:Tnull, to make them more distinguishable, like these serif examples: Template:Varserif, Template:Varserif.
- More examples
Template:Semantic markup templates
]]||[[Template loop detected: Template:Documentation subpage
This template is to help facilitate the displaying of variable names (in mathematics, computer source code, wikimarkup, etc.) with the semantically correct Template:Tag tags, which also renders the variable in italics, as is customary. This method is preferred to simply italicizing for many reasons, including accessibility, separation of presentation and content, semantic Web, and metadata; In XHTML and HTML, the Template:Tag element has semantic meaning, while simple italicization does not. "Variable" in this sense may include arbitrary or unknown names or terms, example human input, arithmetical variables in equations, etc. This template (and the underlying XHTML) are generally Template:Em used if MediaWiki's Template:Tag tags (or any other stand-alone mathematical markup) are being used.
- Example
- Template:Tlxb
outputs the following HTML:
which renders as:
- Template loop detected: Template:Var
Note that on the screen or in print, this renders as simple italicization, as does Template:Code (using pairs of apostrophes) or Template:Tag (using HTML), yet it carries more semantic meaning than either of these methods.
At times, you may wish to use a serif font. This is especially true when attempting to render single-letter variables like "I" (upper-case "i") and "l" (lower-case "L"), since they are nearly indistinguishable (if at all). In such situations, use the {{{{#if:|subst:|{{#if:|:| }}}}varserif{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}} template instead of Template:Tnull, to make them more distinguishable, like these serif examples: Template:Varserif, Template:Varserif.
- More examples
Template:Semantic markup templates
]]}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}}
Text customization[edit]
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template:Float Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template:Float Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template:Float Template loop detected: Template:Documentation subpage
Template:Hidden end
Display[edit]
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Documentation subpage
{{#ifeq:Template:Var | Template:Tl | Template:High-risk }}
Template:Commons
The template link template is a simple macro template used to display a template name as a link surrounded by braces, thus showing how the template name would be used in code. Its primary use is in instruction and documentation. A short example is that the code:
{{tl|Example}}
- generates
- Template loop detected: Template:Tl
<templatedata>{
"description": "This template displays a template name as a link surrounded by braces, thus showing how the template name would be used in code. Its primary use is in instruction and documentation.",
"params": {
"1": {
"label": "template name",
"description": "the template name without the namespace prefix “Template:”, which is added automatically",
"type": "string",
"required": true
}
}}</templatedata>
More complex variations are described below.
Example[edit]
Code
Result
Notes
{{tl|Void}}
{{Void}}
Standard usage
{{tls|Void}}
{{subst:Example}}
For templates that should be substituted
{{tl2|X1}}
{{X1}}
This formats the link to show how it would look in code
{{tl2|SISTER=M:|3x}}
{{3x}}
Same as above, for templates on another Wikimedia project (such as meta)
{{tl2|SISTER=wikibooks|LANG=de:|WP}}
{{[hcodep://de.wikibooks.org/wiki/Vorlage:WP WP]}}
For templates on another language project
{{tl|1==)}}
Template loop detected: Template:Tl
Use the format {{tl|1=templatename}} if the template contains template coding characters such as Template loop detected: Template:Tl or Template loop detected: Template:Tl
See also[edit]
) will automatically note that the documentation is transcluded from a subpage.
{{#ifeq:Var|sandbox | |
}}
Functions[edit]
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also[edit]
Template:Documentation/see also
{{#ifeq:Var|sandbox | |
tn:Template:Documentation subpage }}
This template is to help facilitate the displaying of variable names (in mathematics, computer source code, wikimarkup, etc.) with the semantically correct Template:Tag tags, which also renders the variable in italics, as is customary. This method is preferred to simply italicizing for many reasons, including accessibility, separation of presentation and content, semantic Web, and metadata; In XHTML and HTML, the Template:Tag element has semantic meaning, while simple italicization does not. "Variable" in this sense may include arbitrary or unknown names or terms, example human input, arithmetical variables in equations, etc. This template (and the underlying XHTML) are generally Template:Em used if MediaWiki's Template:Tag tags (or any other stand-alone mathematical markup) are being used.
- Example
- Template:Tlxb
outputs the following HTML:
which renders as:
- Template loop detected: Template:Documentation subpage
Usage[edit]
- {{{{#if:|subst:|{{#if:|:| }}}}Documentation subpage{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}}
- or
- {{{{#if:|subst:|{{#if:|:| }}}}Documentation subpage {{#if:[[Template loop detected: Template:Var]]||[[Template loop detected: Template:Var]]}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}}
Userbox documentation[edit]
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
- {{{{#if:|subst:|{{#if:|:| }}}}Userbox documentation subpage{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}}
- or
- {{{{#if:|subst:|{{#if:|:| }}}}Userbox documentation subpage {{#if:[[Template loop detected: Template:Var]]||[[Template loop detected: Template:Var]]}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}}
Text customization[edit]
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template:Float Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template:Float Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template:Float Template loop detected: Template:Documentation subpage
Template:Hidden end
Display[edit]
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Documentation subpage
{{#ifeq:Template:Var | Template:Tl | Template:High-risk }}
Template:Commons
The template link template is a simple macro template used to display a template name as a link surrounded by braces, thus showing how the template name would be used in code. Its primary use is in instruction and documentation. A short example is that the code:
{{tl|Example}}
- generates
- Template loop detected: Template:Tl
<templatedata>{
"description": "This template displays a template name as a link surrounded by braces, thus showing how the template name would be used in code. Its primary use is in instruction and documentation.",
"params": {
"1": {
"label": "template name",
"description": "the template name without the namespace prefix “Template:”, which is added automatically",
"type": "string",
"required": true
}
}}</templatedata>
More complex variations are described below.
Example[edit]
Code
Result
Notes
{{tl|Void}}
{{Void}}
Standard usage
{{tls|Void}}
{{subst:Example}}
For templates that should be substituted
{{tl2|X1}}
{{X1}}
This formats the link to show how it would look in code
{{tl2|SISTER=M:|3x}}
{{3x}}
Same as above, for templates on another Wikimedia project (such as meta)
{{tl2|SISTER=wikibooks|LANG=de:|WP}}
{{[hcodep://de.wikibooks.org/wiki/Vorlage:WP WP]}}
For templates on another language project
{{tl|1==)}}
Template loop detected: Template:Tl
Use the format {{tl|1=templatename}} if the template contains template coding characters such as Template loop detected: Template:Tl or Template loop detected: Template:Tl
See also[edit]
) will automatically note that the documentation is transcluded from a subpage.
{{#ifeq:Var|sandbox | |
}}
Functions[edit]
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also[edit]
Template:Documentation/see also
{{#ifeq:Var|sandbox | |
tn:Template:Documentation subpage }}
This template is to help facilitate the displaying of variable names (in mathematics, computer source code, wikimarkup, etc.) with the semantically correct Template:Tag tags, which also renders the variable in italics, as is customary. This method is preferred to simply italicizing for many reasons, including accessibility, separation of presentation and content, semantic Web, and metadata; In XHTML and HTML, the Template:Tag element has semantic meaning, while simple italicization does not. "Variable" in this sense may include arbitrary or unknown names or terms, example human input, arithmetical variables in equations, etc. This template (and the underlying XHTML) are generally Template:Em used if MediaWiki's Template:Tag tags (or any other stand-alone mathematical markup) are being used.
- Example
- Template:Tlxb
outputs the following HTML:
which renders as:
- Template loop detected: Template:Var
Note that on the screen or in print, this renders as simple italicization, as does Template:Code (using pairs of apostrophes) or Template:Tag (using HTML), yet it carries more semantic meaning than either of these methods.
At times, you may wish to use a serif font. This is especially true when attempting to render single-letter variables like "I" (upper-case "i") and "l" (lower-case "L"), since they are nearly indistinguishable (if at all). In such situations, use the {{{{#if:|subst:|{{#if:|:| }}}}varserif{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}} template instead of Template:Tnull, to make them more distinguishable, like these serif examples: Template:Varserif, Template:Varserif.
- More examples
Template:Semantic markup templates
Note that on the screen or in print, this renders as simple italicization, as does Template:Code (using pairs of apostrophes) or Template:Tag (using HTML), yet it carries more semantic meaning than either of these methods.
At times, you may wish to use a serif font. This is especially true when attempting to render single-letter variables like "I" (upper-case "i") and "l" (lower-case "L"), since they are nearly indistinguishable (if at all). In such situations, use the {{{{#if:|subst:|{{#if:|:| }}}}varserif{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||etc.}}}} template instead of Template:Tnull, to make them more distinguishable, like these serif examples: Template:Varserif, Template:Varserif.
- More examples
Template:Semantic markup templates