Difference between revisions of "Template:Doc/Template"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Add Template:TemplateCase usage)
m (Add 6..10 examples)
 
(One intermediate revision by the same user not shown)
Line 44: Line 44:
 
{{#if:{{{example1|}}}{{{example2|}}}{{{example3|}}}{{{example4|}}}{{{example5|}}}
 
{{#if:{{{example1|}}}{{{example2|}}}{{{example3|}}}{{{example4|}}}{{{example5|}}}
 
|
 
|
{{{!}}
+
{{{!}} style{{=}}"border-spacing: 1em 0.5em"
 
{{!}}+ Examples
 
{{!}}+ Examples
 
{{!}}- style{{=}}"background-color: #EEE"
 
{{!}}- style{{=}}"background-color: #EEE"
Line 78: Line 78:
 
{{!}} {{{example5|}}}
 
{{!}} {{{example5|}}}
 
{{!}} {{{result5|}}}
 
{{!}} {{{result5|}}}
 +
{{!}}-
 +
}}
 +
{{#if: {{{example6|}}}
 +
|
 +
{{!}} {{{example6|}}}
 +
{{!}} {{{result6|}}}
 +
{{!}}-
 +
}}
 +
{{#if: {{{example7|}}}
 +
|
 +
{{!}} {{{example7|}}}
 +
{{!}} {{{result7|}}}
 +
{{!}}-
 +
}}
 +
{{#if: {{{example8|}}}
 +
|
 +
{{!}} {{{example8|}}}
 +
{{!}} {{{result8|}}}
 +
{{!}}-
 +
}}
 +
{{#if: {{{example9|}}}
 +
|
 +
{{!}} {{{example9|}}}
 +
{{!}} {{{result9|}}}
 +
{{!}}-
 +
}}
 +
{{#if: {{{example10|}}}
 +
|
 +
{{!}} {{{example10|}}}
 +
{{!}} {{{result10|}}}
 
{{!}}-
 
{{!}}-
 
}}
 
}}
Line 83: Line 113:
 
}}
 
}}
  
{{TemplateCase||[[Category: Templates|{{uc:{{PAGENAME}}}}]]}}</includeonly><noinclude>{{TOC|none}}
+
{{#ifeq: {{uc:{{FULLPAGENAME}}}} | TEMPLATE:DOC/TEMPLATE | | [[Category: Templates|{{uc:{{PAGENAME}}}}]] }}</includeonly><noinclude>{{TOC|none}}
 
Documents and categorises a [[:Category:Templates|Template]]. To be used within <tt><no<nowiki/>include></no<nowiki/>include></tt> tags, e.g:
 
Documents and categorises a [[:Category:Templates|Template]]. To be used within <tt><no<nowiki/>include></no<nowiki/>include></tt> tags, e.g:
 
  <include<nowiki/>only>'''*template's code*'''</include<nowiki/>only><no<nowiki/>include>{{<nowiki/>'''Doc/Template'''
 
  <include<nowiki/>only>'''*template's code*'''</include<nowiki/>only><no<nowiki/>include>{{<nowiki/>'''Doc/Template'''
Line 96: Line 126:
 
* param#: (# = number range 1..10) parameter name
 
* param#: (# = number range 1..10) parameter name
 
* descr#: (# = number range 1..10) parameter description
 
* descr#: (# = number range 1..10) parameter description
* example#: (# = number range 1..5) mediawiki code example - '''to be wrapped between nowiki tags!''' (e.g <tt><nowiki><nowiki>{{Doc/Template}}</nowiki></nowiki></tt>)
+
* example#: (# = number range 1..10) mediawiki code example - '''to be wrapped between nowiki tags!''' (e.g <tt><nowiki><nowiki>{{Doc/Template}}</nowiki></nowiki></tt>)
* result#: (# = number range 1..5) mediawiki code result - identical to example#, less nowiki tags (e.g <tt><nowiki>{{Doc/Template}}</nowiki></tt>)
+
* result#: (# = number range 1..10) mediawiki code result - identical to example#, less nowiki tags (e.g <tt><nowiki>{{Doc/Template}}</nowiki></tt>)
  
{| class="wikitable" style="min-width: 50em"
+
{| style="border-spacing: 1em 0.5em; min-width: 50em"
 
|+ Examples
 
|+ Examples
 +
|- style="background-color: #EEE"
 
! Code
 
! Code
 
! Result
 
! Result

Latest revision as of 00:00, 8 February 2021

Documents and categorises a Template. To be used within <noinclude></noinclude> tags, e.g:

<includeonly>*template's code*</includeonly><noinclude>{{Doc/Template
| ...
}}
</noinclude>

Usage

{{Doc/Template|name|descr|param#|descr#|example#|result#}}

  • name: (Optional, default {{PAGENAME}}) template name
  • descr: template text description
  • param#: (# = number range 1..10) parameter name
  • descr#: (# = number range 1..10) parameter description
  • example#: (# = number range 1..10) mediawiki code example - to be wrapped between nowiki tags! (e.g <nowiki>{{Doc/Template}}</nowiki>)
  • result#: (# = number range 1..10) mediawiki code result - identical to example#, less nowiki tags (e.g {{Doc/Template}})
Examples
Code Result
{{Doc/Template}}

This template is used on these pages.

Usage

{{Doc/Template}}



{{Doc/Template
| name = MyTemplate
| descr = Template description
| param1 = parameter1
| descr1 = this is the first parameter
| param2 = parameter2
| descr2 = (Optional) this is the second parameter
}}
Template description

This template is used on these pages.

Usage

{{MyTemplate|parameter1|parameter2}}

  • parameter1: this is the first parameter
  • parameter2: (Optional) this is the second parameter



{{Doc/Template
| name = MyTemplate
| descr = Template description
| param1 = parameter1
| descr1 = this is the first parameter
| param2 = parameter2
| descr2 = (Optional) this is the second parameter
| example1 = <nowiki>{{MyTemplate|Hello there!}}</nowiki>
| result1 = {{MyTemplate|Hello there!}}
}}
Template description

This template is used on these pages.

Usage

{{MyTemplate|parameter1|parameter2}}

  • parameter1: this is the first parameter
  • parameter2: (Optional) this is the second parameter
Examples
Code Result
{{MyTemplate|Hello there!}} Hello there!