Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Example/doc: Difference between revisions

Template page
Djavin novienta (talk | contribs)
Created page with "<noinclude>{{main|Template:Example}}</noinclude> As the name suggests, this template produces a colored box, which is used when you want to give an example on a page. You can ..."
 
m Fix typo.
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>{{main|Template:Example}}</noinclude>
; Description
As the name suggests, this template produces a colored box, which is used when you want to give an example on a page. You can use common wiki-formatting (eg bold, links) if you wish. The formatting of this template is kept subtle on purpose, so as not to interfere too much with the general flow of a page (if you want a stronger emphasis for your text, you can use <code>{{t|note box}}</code> or even <code>{{t|important note box}}</code>).
: Produces a centered, colored box, which is used to present an example on a page.


If the text you would like to use include an equals sign (=), you need to explicitly declare your text as a numbered parameter (i.e. put <code>1=</code> before your example text), otherwise the template will display nothing.
; Dependencies
:; Uses
:: {{T|Color box}}


=== Examples ===
; Syntax
: {{T|Example|content|3= width= width}}
:; Parameters
::; content : The example text inside the box. The box has "<code>An example!</code>" as the default text. If the text includes an equals sign (<code>=</code>), the text needs to be explicitly declared as a numbered parameter (i.e. put <code>1=</code> before the text), otherwise the template will display the default text.
::; width : Sets the width of the box. It's recommended to set this as a percentage (of the paragraph width), so <code>50%</code> will produce a text box half as wide as the surrounding paragraph. The default width is set at 95%. When width is set to less than <code>100%</code>, the box will be centered.


<code><nowiki>{{example|An example to ''illustrate'' my article with a link to the [[Venture]].}}</nowiki></code> gives:
; Examples
{{example|An example to ''illustrate'' my article with a link to the [[Venture]].}}
{{Code|<nowiki>{{Example|An example to ''illustrate'' my article with a link to the [[Venture]].}}</nowiki>}} gives ...
{{Example|An example to ''illustrate'' my article with a link to the [[Venture]].}}


<code><nowiki>{{example|How not to put the formula 2+2=4 into an example.}}</nowiki></code> gives:
{{example|How not to put the formula 2+2=4 into an example.}}


<code><nowiki>{{example|1=How to put the formula 2+2=4 into an example.}}</nowiki></code> gives:
{{Code|<nowiki>{{Example|How not to put the formula 2+2=4 into an example.}}</nowiki>}} gives ...
{{example|1=How to put the formula 2+2=4 into an example.}}
{{Example|How not to put the formula 2+2=4 into an example.}}


== See also ==
*<code>{{t|note box}}</code> and <code>{{t|important note box}}</code>, designed for general notes and warnings on pages.
*<code>{{t|color box}}</code>, the general template for creating coloured boxes with text in them.


<includeonly>[[Category:Template]]</includeonly>
{{Code|<nowiki>{{Example|1= How to put the formula 2+2=4 into an example.}}</nowiki>}} gives ...
{{Example|1= How to put the formula 2+2=4 into an example.}}
 
 
; See also
* {{T|Note box}}  and  {{T|Important note box}} , designed for general notes and warnings on pages.
* {{T|Color box}} , the general template for creating colored boxes with text in them.
 
; Template data
: This is the [[mediawikiwiki:Help:TemplateData|TemplateData]] documentation for this template used by [[mediawikiwiki:VisualEditor|VisualEditor]] and other tools.
:: <templatedata>
{
"params": {
"1": {
"label": "Content",
"description": "The content of the example box. If the text includes an equals sign (=), the text needs to be explicitly declared as a numbered parameter (i.e. put 1= before the text), otherwise the template will display the default text.",
"type": "content",
"default": "An example!",
"required": true
},
"width": {
"description": "Set the width of the box. Preferably in %",
"type": "string",
"default": "95%"
}
},
"description": "Box to present examples in articles. When the (optional) width is set to less then 100% the box will be centered.",
"format": "{{_\n| _= _\n}}"
}</templatedata>
 
 
<includeonly>[[Category:Formatting templates]]</includeonly>
<noinclude>[[Category:Template documentation]]</noinclude>
<noinclude>[[Category:Template documentation]]</noinclude>