Difference between revisions of "Help:Template"

Added info on how to see the template injection syntax
(Rephrased the help page - added command templates)
(Added info on how to see the template injection syntax)
Line 1: Line 1:
{{BoxDanger|Viewing the template inject syntax|You can examine how the templates are called by clicking the edit link. '''Do not modify the templates''' as any errors will reflect on all documents where the template is injected}}
==Using templates==
==Using templates==
Templates help to create a consistent look and feel to various elements.
Templates help to create a consistent look and feel to various elements.
A template is referenced using the '''TemplateName''' and one or more '''arguments'''.
A template is referenced using the '''TemplateName''' and one or more '''arguments'''.


To use a template in any document reference the template and separate arguments with pipes '''|'''.  
To use a template in any document reference the template and separate arguments with pipes '''|'''. The general format for injecting a template looks like this
The general format for using a template is <code>{{TemplateName|argument1|argument2}}</code>.
<pre>{{TemplateName|argument1|argument2}}</pre>


There is an exception - when the argument contains the '''=''' operator - in which case the template is using a named argument like <code>{{File|file=filename|content=content}}</code>
There are exceptions - when the argument contains the '''=''' operator - in which case the template is using named arguments and format for injecting a template with named arguments
<pre>{{File|file=filename|content=content}}</pre>


==Command templates==
==Command templates==
To emphazise a command in a document - to be run as either root or user
To emphazise if an example command in a document is assuming root or user context
{{RootCmd|command=command}}
{{RootCmd|command=command}}
{{UserCmd|command=command}}
{{UserCmd|command=command}}
Line 35: Line 38:
{{Important|It is not possible to run `makepkg` as root!}}
{{Important|It is not possible to run `makepkg` as root!}}


 
===Available boxes===
{{BoxPrimary|Header|This is a BoxPrimary template}}
{{BoxPrimary|Header|This is a BoxPrimary template}}
{{BoxSecondary|Header|This is a BoxSecondary template}}
{{BoxSecondary|Header|This is a BoxSecondary template}}
Line 44: Line 47:
{{BoxLight|Header|This is a BoxLight template}}
{{BoxLight|Header|This is a BoxLight template}}
{{BoxDark|Header|This is a BoxDark template}}
{{BoxDark|Header|This is a BoxDark template}}
You can examine how the templates are called by looking at the source of this document.
Moderators, translator
455

edits