Template:TemplateData/entry/doc: Difference between revisions

From CrossCode Wiki
Jump to navigation Jump to search
(→‎Examples: List example added)
(Document `label` alias for the `name` paramter)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{doc/start}}
{{doc/start}}
Template for creating a unified parameter format for templates
Template for creating unified table rows for template parameter documentation.


== About ==
== About ==
Creates a list that displays Template parameter in a unified format.
Creates a table row that displays Template parameter documentation in a unified format.
This template creates a single entry for the Required template [[Template:TemplateData]].
This template creates a single entry for the main template {{tlx|TemplateData}}.


== Parameter ==
== Parameter ==
{{TemplateData|
{{TemplateData
{{TemplateData/entry|name=Parameter title|param=name|desc=Specify a title for a parameter of the template documentation|def=NULL|type=String|status=Required}}
| desc  =
{{TemplateData/entry|name=Parameter name|param=param|desc=Specify a name for a parameter of the template documentation|def=NULL|type=String|status=Required}}
Template for creating unified table rows for template parameter documentation.
{{TemplateData/entry|name=Parameter alias1|param=alias1|desc=Specify a alias for a parameter of the template documentation|def=NULL|type=String|status=Optional}}
This template creates a single entry for the main template {{((}}TemplateData{{))}}.
{{TemplateData/entry|name=Parameter alias2|param=alias2|desc=Specify a alias for a parameter of the template documentation|def=NULL|type=String|status=Optional}}
| format =
{{TemplateData/entry|name=Parameter alias3|param=alias3|desc=Specify a alias for a parameter of the template documentation|def=NULL|type=String|status=Optional}}
{{((}}_
{{TemplateData/entry|name=Parameter Description|param=desc|desc=Specify a description for a parameter of the template documentation|def=no description|type=WikiCode|status=Recommended}}
{{!}} ______ = _
{{TemplateData/entry|name=Parameter Example|param=example|desc=Specify an example for a parameter of the template documentation|def=no example|type=WikiCode|status=Recommended}}
{{))}}
{{TemplateData/entry|name=Parameter type|param=type|desc=Specify a type for a parameter of the template documentation: [[#Data_Dictionary_Notation_.28DDN.29_for_types|Data Dictionary Notation]]|def=NULL|type=[[#Data_Dictionary_Notation_.28DDN.29_for_types|DDNCode]]|status=Required}}
| params =
{{TemplateData/entry|name=Parameter status|param=status|desc=Specify a status for a parameter of the template documentation|def=NULL|type=<nowiki>["Required" | "Recommended" | "Optional" | "Deprecated" ]</nowiki>|status=Required}}
{{TemplateData/entry
| label  = Parameter label
| param = label
| alias1 = name
| desc   = Specify a label for a parameter of the template documentation
| type   = String
| status = Required
}}
{{TemplateData/entry
| label  = Parameter name
| param = param
| desc   = Specify a name for a parameter of the template documentation
| type   = String
| status = Required
}}
{{TemplateData/entry
| label  = Parameter alias1
| param = alias1
| desc   = Specify a alias for a parameter of the template documentation
| type   = String
| status = Optional}}
{{TemplateData/entry
| label  = Parameter alias2
| param = alias2
| desc   = Specify a alias for a parameter of the template documentation
| type   = String
| status = Optional
}}
{{TemplateData/entry
| label  = Parameter alias3
| param = alias3
| desc   = Specify a alias for a parameter of the template documentation
| type   = String
| status = Optional
}}
{{TemplateData/entry
| label  = Parameter Description
| param = desc
| desc   = Specify a description for a parameter of the template documentation
| def   = no description
| type   = WikiCode
| status = Recommended
}}
{{TemplateData/entry
| label  = Parameter Default
| param  = default
| alias1 = def
| desc  = Specify the parameter's default value
| type  = WikiCode
| status = Optional
}}
{{TemplateData/entry
| label  = Parameter Example
| param = example
| desc   = Specify an example for a parameter of the template documentation
| def   = no example
| type   = WikiCode
| status = Optional
}}
{{TemplateData/entry
| label  = Parameter type
| param = type
| desc   = Specify a type for a parameter of the template documentation: [[#Data Dictionary Notation (DDN) for types|Data Dictionary Notation]]
| type  = [[#Data Dictionary Notation (DDN) for types|DDNCode]]
| status = Required
}}
{{TemplateData/entry
| label  = MediaWiki Parameter type
| param  = mwType
| desc  = Specify the [[mw:Help:TemplateData#Type parameter|MediaWiki TemplateData]] type for a parameter of the template.
| type  = <!--
-->&#91; "[[mw:Help:TemplateData#unknown|unknown]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#number|number]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#string|string]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#line|line]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#boolean|boolean]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#date|date]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#url|url]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#wiki-page-name|{{nowrap|wiki-page-name}}]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#wiki-file-name|{{nowrap|wiki-file-name}}]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#wiki-template-name|{{nowrap|wiki-template-name}}]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#wiki-user-name|{{nowrap|wiki-user-name}}]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#content|content]]" <!--
-->&#124;&nbsp;"[[mw:Help:TemplateData#unbalanced-wikitext|{{nowrap|unbalanced-wikitext}}]]" <!--
-->&#93;
| mwType = string
| status = Recommended
}}
{{TemplateData/entry
| label  = Parameter status
| param = status
| desc   = Specify a status for a parameter of the template documentation
| type   = <nowiki>["Required" | "Recommended" | "Optional" | "Deprecated" ]</nowiki>
| mwType = string
| status = Required
}}
{{TemplateData/entry
| label  = Auto pre
| param  = autoPre
| desc  = Automatic pre for examples
| def    = 0
| type  = Boolean
| status = Optional
}}
}}
}}


Line 24: Line 127:


{{TemplateData|
{{TemplateData|
{{TemplateData/entry|name=Example name|alias1=Example alias 1|alias2=Example alias 2|alias3=Example alias 3|param=example param|desc=example description|def=NULL|example=xyz|type=String|status=Required}}
{{TemplateData/entry
{{TemplateData/entry|name=Example name B|alias1=B alias 1|alias2=B alias 2|alias3=B alias 3|param=B param|desc=B description|def=NULL|example=
| label  = Example name
| param  = example param
| alias1 = Example alias 1
| alias2 = Example alias 2
| alias3 = Example alias 3
| desc   = example description
| default = NULL
| example = xyz
| type   = String
| status = Required
}}
{{TemplateData/entry
| label  = Auto pre name B
| param  = B param
| alias1 = B alias 1
| alias2 = B alias 2
| alias3 = B alias 3
| desc   = B description
| def     = NULL
| example =
* List example with containing templates and HTML tags
* List example with containing templates and HTML tags
* No Icon (<code>1</code>): {{ItemLink|Ginger Tom. Salad|noIcon=1}}
* No Icon (<code>1</code>): {{ItemLink|Ginger Tom. Salad|noIcon=1}}
* Icon (<code>0</code>): {{ItemLink|Ginger Tom. Salad|noIcon=0}}
* Icon (<code>0</code>): {{ItemLink|Ginger Tom. Salad|noIcon=0}}
* Default (parameter not used / <code>0</code>): {{ItemLink|Ginger Tom. Salad}}
* Default (parameter not used / <code>0</code>): {{ItemLink|Ginger Tom. Salad}}
|type=String|status=Required}}
| type   = String
{{TemplateData/entry|name=Deprecated Example name|alias1=Deprecated alias 1|alias2=Deprecated alias 2|alias3=Deprecated alias 3|param=deprecated param|desc=deprecated description|def=NULL|example=xyz|type=String|status=Deprecated}}
| status = Required
| autoPre = 1
}}
{{TemplateData/entry
| label  = Deprecated Example name
| param  = deprecated param
| alias1 = Deprecated alias 1
| alias2 = Deprecated alias 2
| alias3 = Deprecated alias 3
| desc   = deprecated description
| def     = NULL
| example = xyz
| type   = String
| status = Deprecated
}}
| noConvert = 1
}}
}}


<pre>
<pre>
{{TemplateData|
{{TemplateData|
{{TemplateData/entry|name=Example name|alias1=Example alias 1|alias2=Example alias 2|alias3=Example alias 3|param=example param|desc=example description|def=NULL|example=xyz|type=String|status=Required}}
{{TemplateData/entry
{{TemplateData/entry|name=Example name B|alias1=B alias 1|alias2=B alias 2|alias3=B alias 3|param=B param|desc=B description|def=NULL|example=
| name   = Example name
| param  = example param
| alias1 = Example alias 1
| alias2 = Example alias 2
| alias3 = Example alias 3
| desc   = example description
| default = NULL
| example = xyz
| type   = String
| status = Required
}}
{{TemplateData/entry
| name   = Auto pre name B
| param  = B param
| alias1 = B alias 1
| alias2 = B alias 2
| alias3 = B alias 3
| desc   = B description
| def     = NULL
| example =
* List example with containing templates and HTML tags
* List example with containing templates and HTML tags
* No Icon (<code>1</code>): {{ItemLink|Ginger Tom. Salad|noIcon=1}}
* No Icon (<code>1</code>): {{ItemLink|Ginger Tom. Salad|noIcon=1}}
* Icon (<code>0</code>): {{ItemLink|Ginger Tom. Salad|noIcon=0}}
* Icon (<code>0</code>): {{ItemLink|Ginger Tom. Salad|noIcon=0}}
* Default (parameter not used / <code>0</code>): {{ItemLink|Ginger Tom. Salad}}
* Default (parameter not used / <code>0</code>): {{ItemLink|Ginger Tom. Salad}}
|type=String|status=Required}}
| type   = String
{{TemplateData/entry|name=Deprecated Example name|alias1=Deprecated alias 1|alias2=Deprecated alias 2|alias3=Deprecated alias 3|param=deprecated param|desc=deprecated description|def=NULL|example=xyz|type=String|status=Deprecated}}
| status = Required
| autoPre = 1
}}
{{TemplateData/entry
| name   = Deprecated Example name
| param  = deprecated param
| alias1 = Deprecated alias 1
| alias2 = Deprecated alias 2
| alias3 = Deprecated alias 3
| desc   = deprecated description
| def     = NULL
| example = xyz
| type   = String
| status = Deprecated
}}
}}
}}
</pre>
</pre>
Line 101: Line 271:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Type
! scope="col" | Type
! Definition
! scope="col" | Definition
! Comment
! scope="col" | Comment
|-
|-
| NULL
! scope="row" style="text-align: left;" | NULL
| <nowiki>""</nowiki>
| <code><nowiki>""</nowiki></code>
| Empty
| Empty
|-
|- id="LineFeed"
| NonzeroDigit
! scope="row" style="text-align: left;" | LineFeed
| <nowiki>["1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"]</nowiki>
| <code style="white-space: pre;">"&#10;"</code>
| The Unicode character 'LINE FEED (LF)' (U+000A)
|- id="NonzeroDigit"
! scope="row" style="text-align: left;" | NonzeroDigit
| <code><nowiki>[ "1" |&nbsp;"2" |&nbsp;"3" |&nbsp;"4" |&nbsp;"5" |&nbsp;"6" |&nbsp;"7" |&nbsp;"8" |&nbsp;"9" ]</nowiki></code>
| Single character, 1 - 9
| Single character, 1 - 9
|-
|- id="Digit"
| Digit
! scope="row" style="text-align: left;" | Digit
| <nowiki>["0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"]</nowiki>
| <code><nowiki>[ "0" |&nbsp;"1" |&nbsp;"2" |&nbsp;"3" |&nbsp;"4" |&nbsp;"5" |&nbsp;"6" |&nbsp;"7" |&nbsp;"8" |&nbsp;"9" ]</nowiki></code>
| Single character, 0 - 9
| Single character, 0 - 9
|-
|- id="LowerAlphabet"
| LowerAlphabet
! scope="row" style="text-align: left;" | LowerAlphabet
| <nowiki>["a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" ]</nowiki>
| <code><nowiki>[ "a" |&nbsp;"b" |&nbsp;"c" |&nbsp;"d" |&nbsp;"e" |&nbsp;"f" |&nbsp;"g" |&nbsp;"h" |&nbsp;"i" |&nbsp;"j" |&nbsp;"k" |&nbsp;"l" |&nbsp;"m" |&nbsp;"n" |&nbsp;"o" |&nbsp;"p" |&nbsp;"q" |&nbsp;"r" |&nbsp;"s" |&nbsp;"t" |&nbsp;"u" |&nbsp;"v" |&nbsp;"w" |&nbsp;"x" |&nbsp;"y" |&nbsp;"z" ]</nowiki></code>
| Single character, a - z
| Single character, a - z
|-
|- id="UpperAlphabet"
| UpperAlphabet
! scope="row" style="text-align: left;" | UpperAlphabet
| <nowiki>["A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"]</nowiki>
| <code><nowiki>[ "A" |&nbsp;"B" |&nbsp;"C" |&nbsp;"D" |&nbsp;"E" |&nbsp;"F" |&nbsp;"G" |&nbsp;"H" |&nbsp;"I" |&nbsp;"J" |&nbsp;"K" |&nbsp;"L" |&nbsp;"M" |&nbsp;"N" |&nbsp;"O" |&nbsp;"P" |&nbsp;"Q" |&nbsp;"R" |&nbsp;"S" |&nbsp;"T" |&nbsp;"U" |&nbsp;"V" |&nbsp;"W" |&nbsp;"X" |&nbsp;"Y" |&nbsp;"Z" ]</nowiki></code>
| Single character, A - Z
| Single character, A - Z
|-
|- id="Alphabet"
| Alphabet
! scope="row" style="text-align: left;" | Alphabet
| <nowiki>[LowerAlphabet | UpperAlphabet]</nowiki>
| <code>{{!(}} {{AnchorLink|LowerAlphabet}} &#124;&nbsp;{{AnchorLink|UpperAlphabet}} {{)!}}</code>
| Single character, a - z / A - Z
| Single character, a - z / A - Z
|-
|- id="Ascii"
| Ascii
! scope="row" style="text-align: left;" | Ascii
| <nowiki>1 {Ascii} 1</nowiki>
| <code>1&nbsp;{{(}}'''Ascii'''{{)}}&nbsp;1</code>
| [https://en.wikipedia.org/wiki/ASCII ASCII] character
| [[wikipedia:ASCII|ASCII]] character
|-
|- id="Char"
| Char
! scope="row" style="text-align: left;" | Char
| <nowiki>1 {Char} 1</nowiki>
| <code>1&nbsp;{{(}}'''Char'''{{)}}&nbsp;1</code>
| [https://en.wikipedia.org/wiki/UTF-8 UTF-8] character
| [[wikipedia:UTF-8|UTF-8]] character
|-
|- id="String"
| String
! scope="row" style="text-align: left;" | String
| <nowiki>1 {Char}</nowiki>
| <code>1&nbsp;{{(}}{{AnchorLink|Char}}{{)}}</code>
| One or more UTF-8 characters
| One or more UTF-8 characters
|-
|- id="AsciiString"
| AsciiString
! scope="row" style="text-align: left;" | AsciiString
| <nowiki>1 {Ascii}</nowiki>
| <code>1&nbsp;{{(}}{{AnchorLink|Ascii}}{{)}}</code>
| One or more ASCII characters
| One or more ASCII characters
|-
|- id="WikiCode"
| WikiCode
! scope="row" style="text-align: left;" | WikiCode
| <nowiki>1 {WikiCode} 1</nowiki>
| <code>1&nbsp;{{(}}'''WikiCode'''{{)}}&nbsp;1</code>
| Any wiki code
| Any wiki code
|-
|- id="DDNCode"
| DDNCode
! scope="row" style="text-align: left;" | DDNCode
| <nowiki>1 {DDNCode} 1</nowiki>
| <code>1&nbsp;{{(}}'''DDNCode'''{{)}}&nbsp;1</code>
| Any DDNCode (links are allowed)
| Any DDNCode (links are allowed)
|-
|- id="Number"
| Number
! scope="row" style="text-align: left;" | Number
| <nowiki>1 {Digit}</nowiki>
| <code>1&nbsp;{{(}}{{AnchorLink|Digit}}{{)}}</code>
| Any natural number with zero
| Any natural number with zero
|-
|- id="Decimal"
| Decimal
! scope="row" style="text-align: left;" | Decimal
| <nowiki>1 {Digit} + ( "." + 1 {Digit} )</nowiki>
| <code>1&nbsp;{{(}}{{AnchorLink|Digit}}{{)}} +&nbsp;(&nbsp;"." +&nbsp;1&nbsp;{{(}}{{AnchorLink|Digit}}{{)}} )</code>
| Any natural number with zero
| Any natural number with zero
|-
|- id="NonzeroNumber"
| NonzeroNumber
! scope="row" style="text-align: left;" | NonzeroNumber
| <nowiki>[ 1 {NonzeroDigit} 1 | 2 {Digit} ]</nowiki>
| <code>{{!(}} {{AnchorLink|NonzeroDigit}} &#124;&nbsp;2&nbsp;{{(}}{{AnchorLink|Digit}}{{)}} {{)!}}</code>
| Any natural number without zero
| Any natural number without zero
|-
|- id="SignedNumber"
| SignedNumber
! scope="row" style="text-align: left;" | SignedNumber
| <nowiki>[ "-" + 1 {NonzeroDigit} 1 | 1 {Digit} 1 | ("-") + 2 {Digit} ]</nowiki>
| <code><nowiki>[ "-" +&nbsp;</nowiki>{{AnchorLink|NonzeroDigit}} &#124;&nbsp;{{AnchorLink|Digit}} &#124;&nbsp;("-") +&nbsp;&nbsp;2&nbsp;{{(}}{{AnchorLink|Digit}}{{)}} {{)!}}</code>
| Any Integer (doesn't allow -0 only 0)
| Any Integer (doesn't allow -0 only 0)
|-
|- id="PercentValue"
| PercentValue
! scope="row" style="text-align: left;" | PercentValue
| <nowiki>[ 1 {Digit} 2 | "100" ]</nowiki>
| <code><nowiki>[ 1&nbsp;{</nowiki>{{AnchorLink|Digit}}<nowiki>}&nbsp;2 |&nbsp;"100" ]</nowiki></code>
| Any natural number from 0 to 100
| Any natural number from 0 to 100
|-
|- id="SignedPercentValue"
| SignedPercentValue
! scope="row" style="text-align: left;" | SignedPercentValue
| <nowiki>[ "-" + 1 {NonzeroDigit} 1 | 1 {Digit} 1 | ("-") + 2 {Digit} 2 | ("-") + "100" ]</nowiki>
| <code><nowiki>[ "-" +&nbsp;</nowiki>{{AnchorLink|NonzeroDigit}} &#124;&nbsp;{{AnchorLink|Digit}}<nowiki> |&nbsp;("-") +&nbsp;2&nbsp;{</nowiki>{{AnchorLink|Digit}}<nowiki>}&nbsp;2 |&nbsp;("-") +&nbsp;"100" ]</nowiki></code>
| Any natural number from 0 to 100 and from -1 to -100
| Any natural number from 0 to 100 and from -1 to -100
|-
|- id="Percent"
| Percent
! scope="row" style="text-align: left;" | Percent
| <nowiki>PercentValue + "%"</nowiki>
| <code>{{AnchorLink|PercentValue}} +&nbsp;"%"</code>
| From 0% to 100% (natural number)
| From 0% to 100% (natural number)
|-
|- id="SignedPercent"
| SignedPercent
! scope="row" style="text-align: left;" | SignedPercent
| <nowiki>SignedPercentValue + "%"</nowiki>
| <code>{{AnchorLink|SignedPercentValue}} +&nbsp;"%"</code>
| From 0% to 100% and from -1% to -100% (natural number)
| From 0% to 100% and from -1% to -100% (natural number)
|-
|- id="Boolean"
| Boolean
! scope="row" style="text-align: left;" | Boolean
| <nowiki>["0" | "1"]</nowiki>
| <code>{{!(}} {{AnchorLink|False}} &#124;&nbsp;{{AnchorLink|True}} {{)!}}</code>
| 0 (off) or 1 (on)
| 0 (off) or 1 (on)
|-
|- id="True"
| True
! scope="row" style="text-align: left;" | True
| <nowiki>"1"</nowiki>
| <code><nowiki>"1"</nowiki></code>
| 1 (on)
| 1 (on)
|-
|- id="False"
| False
! scope="row" style="text-align: left;" | False
| <nowiki>"0"</nowiki>
| <code><nowiki>"0"</nowiki></code>
| 0 (off)
| 0 (off)
|-
|- id="Month"
| Month
! scope="row" style="text-align: left;" | Month
| <nowiki>[ 1 {NonzeroDigit} 1 | "10" | "11" | "12"]</nowiki>
| <code>{{!(}} {{AnchorLink|NonzeroDigit}}<nowiki> |&nbsp;"10" |&nbsp;"11" |&nbsp;"12" ]</nowiki></code>
| 1 - 12
| 1 - 12
|-
|- id="Monthfill"
| Monthfill
! scope="row" style="text-align: left;" | Monthfill
| <nowiki>["0" + 1 {NonzeroDigit} 1 | "10" | "11" | "12"]</nowiki>
| <code><nowiki>[ "0" +&nbsp;</nowiki>{{AnchorLink|NonzeroDigit}}<nowiki> |&nbsp;"10" |&nbsp;"11" |&nbsp;"12" ]</nowiki></code>
| 01, 02, 03 ... - 12
| 01, 02, 03 ... - 12
|-
|- id="Monthname"
| Monthname
! scope="row" style="text-align: left;" | Monthname
| <nowiki>["January" | "February" | "March" | "April" | "May" | "June" | "July" | "August" | "September" | "October" | "November" | "December"]</nowiki>
| <code><nowiki>[ "January" |&nbsp;"February" |&nbsp;"March" |&nbsp;"April" |&nbsp;"May" |&nbsp;"June" |&nbsp;"July" |&nbsp;"August" |&nbsp;"September" |&nbsp;"October" |&nbsp;"November" |&nbsp;"December" ]</nowiki></code>
| Month (name)
| Month (name)
|-
|- id="Day"
| Day
! scope="row" style="text-align: left;" | Day
| <nowiki>[ ( [ "1" | "2" ] ) + 1 {Digit} 1 | "30" | "31" ]</nowiki>
| <code><nowiki>[ ( [ "1" |&nbsp;"2" ] ) +&nbsp;</nowiki>{{AnchorLink|Digit}}<nowiki> |&nbsp;"30" |&nbsp;"31" ]</nowiki></code>
| 1 - 31
| 1 - 31
|-
|- id="Dayfill"
| Dayfill
! scope="row" style="text-align: left;" | Dayfill
| <nowiki>[ [ "0" | 1" | "2" ] + 1 {Digit} 1 | "30" | "31" ]</nowiki>
| <code><nowiki>[ [ "0" |&nbsp;1" |&nbsp;"2" ] +&nbsp;</nowiki>{{AnchorLink|Digit}}<nowiki> |&nbsp;"30" |&nbsp;"31" ]</nowiki></code>
| 01, 02, 03 ... - 31
| 01, 02, 03 ... - 31
|-
|- id="Year"
| Year
! scope="row" style="text-align: left;" | Year
| <nowiki>1 {Digit}</nowiki>
| <code>1 {{(}}{{AnchorLink|Digit}}{{)}}</code>
| Any year
| Any year
|-
|- id="LabeledYear"
| LabeledYear
! scope="row" style="text-align: left;" | LabeledYear
| <nowiki>Year + [" AD" | " BC" | " AC"]</nowiki>
| <code>{{AnchorLink|Year}} {{nowrap|+ [" AD"}} {{nowrap|&#124; " BC"}} {{nowrap|&#124; " AC"}}]</code>
| Any year with label
| Any year with label
|-
|- id="LevelNumber"
| LevelNumber
! scope="row" style="text-align: left;" | LevelNumber
| <nowiki>[ 1 {NonzeroDigit} 1 | 2 {Digit} 2 ]</nowiki>
| <code>{{!(}} {{AnchorLink|NonzeroDigit}} &#124;&nbsp;2&nbsp;{{(}}{{AnchorLink|Digit}}{{)}}&nbsp;2 {{)!}}</code>
| 1, 2, ... - 99
| 1, 2, ... - 99
|-
|- id="LevelNumberFill"
| LevelNumberFill
! scope="row" style="text-align: left;" | LevelNumberFill
| <nowiki>[ "0" + 1 {NonzeroDigit} 1 | 2 {Digit} 2 ]</nowiki>
| <code>{{!(}} "0" +&nbsp;{{AnchorLink|NonzeroDigit}} &#124;&nbsp;2&nbsp;{{(}}{{AnchorLink|Digit}}{{)}}&nbsp;2 {{)!}}</code>
| 01, 02, ... - 99
| 01, 02, ... - 99
|- id="FormatString"
! scope="row" style="text-align: left;" | FormatString
| <code>{{AnchorLink|FormatStringStart}} +&nbsp;{{AnchorLink|FormatStringParam}} +&nbsp;{{AnchorLink|FormatStringEnd}}</code>
| rowspan="5" | See [https://github.com/wikimedia/mediawiki-extensions-TemplateData/blob/master/Specification.md#37-formatstring MediaWiki TemplateData specification]
|- id="FormatStringStart"
! scope="row" style="text-align: left;" | FormatStringStart
| <code>({{AnchorLink|LineFeed}}) +&nbsp;"{{(}}<nowiki/>{{(}}" {{nowrap|+ (1 {" "})}} +&nbsp;{{AnchorLink|FormatStringHole}}</code>
|- id="FormatStringParam"
! scope="row" style="text-align: left;" | FormatStringParam
| <code>({{AnchorLink|LineFeed}}) {{nowrap|+ (1 {{(}}" "{{)}})}} +&nbsp;"&#124;" +&nbsp;({{AnchorLink|LineFeed}}) {{nowrap|+ (1 {{(}}" "{{)}})}} +&nbsp;{{AnchorLink|FormatStringHole}} {{nowrap|+ (1 {{(}}" "{{)}})}} +&nbsp;"=" {{nowrap|+ (1 {{(}}" "{{)}})}} +&nbsp;{{AnchorLink|FormatStringHole}}</code>
|- id="FormatStringEnd"
! scope="row" style="text-align: left;" | FormatStringEnd
| <code>({{AnchorLink|LineFeed}}) {{nowrap|+ (1 {{(}}" "{{)}})}} +&nbsp;"{{)}}<nowiki/>{{)}}" +&nbsp;({{AnchorLink|LineFeed}})</code>
|- id="FormatStringHole"
! scope="row" style="text-align: left;" | FormatStringHole
| <code><nowiki>1&nbsp;{"_"}</nowiki></code>
|}
|}


Line 261: Line 451:


{{doc/end}}
{{doc/end}}
<includeonly>
[[Category:Documentation templates]]
</includeonly>

Latest revision as of 22:32, 15 June 2021

File:Template-info.svg Template Documentation

Template for creating unified table rows for template parameter documentation.

About

Creates a table row that displays Template parameter documentation in a unified format. This template creates a single entry for the main template {{TemplateData}}.

Parameter

Do not use named parameter for 1 ... x. The first Parameter will be automatically marked as 1, the second as 2 and so on.

Parameter Description Type Status
Parameter label label
name

Specify a label for a parameter of the template documentation

Example:
no example
String Required
Parameter name param

Specify a name for a parameter of the template documentation

Example:
no example
String Required
Parameter alias1 alias1

Specify a alias for a parameter of the template documentation

Example:
no example
String Optional
Parameter alias2 alias2

Specify a alias for a parameter of the template documentation

Example:
no example
String Optional
Parameter alias3 alias3

Specify a alias for a parameter of the template documentation

Example:
no example
String Optional
Parameter Description desc

Specify a description for a parameter of the template documentation

Default:
no description
Example:
no example
WikiCode Recommended
Parameter Default default
def

Specify the parameter's default value

Example:
no example
WikiCode Optional
Parameter Example example

Specify an example for a parameter of the template documentation

Default:
no example
Example:
no example
WikiCode Optional
Parameter type type

Specify a type for a parameter of the template documentation: Data Dictionary Notation

Example:
no example
DDNCode Required
MediaWiki Parameter type mwType

Specify the MediaWiki TemplateData type for a parameter of the template.

Example:
no example
[ "unknown" | "number" | "string" | "line" | "boolean" | "date" | "url" | "wiki-page-name" | "wiki-file-name" | "wiki-template-name" | "wiki-user-name" | "content" | "unbalanced-wikitext" ] Recommended
Parameter status status

Specify a status for a parameter of the template documentation

Example:
no example
["Required" | "Recommended" | "Optional" | "Deprecated" ] Required
Auto pre autoPre

Automatic pre for examples

Default:
0
Example:
no example
Boolean Optional
Format:
Custom:
{{_
| ______ = _
}}

See Template:TemplateData and Template:TemplateData/entry for more information about the parameter list and DDNCode for more information about types and the DDN Notation

Test of raw TemplateData output:

Template for creating unified table rows for template parameter documentation. This template creates a single entry for the main template {{TemplateData}}.

Template parameters

This template has custom formatting.

ParameterDescriptionTypeStatus
Parameter labellabel name

Specify a label for a parameter of the template documentation

Stringrequired
Parameter nameparam

Specify a name for a parameter of the template documentation

Stringrequired
Parameter alias1alias1

Specify a alias for a parameter of the template documentation

Stringoptional
Parameter alias2alias2

Specify a alias for a parameter of the template documentation

Stringoptional
Parameter alias3alias3

Specify a alias for a parameter of the template documentation

Stringoptional
Parameter Descriptiondesc

Specify a description for a parameter of the template documentation

Default
no description
Contentsuggested
Parameter Defaultdefault def

Specify the parameter's default value

Contentoptional
Parameter Exampleexample

Specify an example for a parameter of the template documentation

Default
no example
Contentoptional
Parameter typetype

Specify a type for a parameter of the template documentation: [[#Data Dictionary Notation (DDN) for types|Data Dictionary Notation]]

Contentrequired
MediaWiki Parameter typemwType

Specify the [[mw:Help:TemplateData#Type parameter|MediaWiki TemplateData]] type for a parameter of the template.

Stringsuggested
Parameter statusstatus

Specify a status for a parameter of the template documentation

Stringrequired
Auto preautoPre

Automatic pre for examples

Default
0
Booleanoptional

Examples

Complete example:

Do not use named parameter for 1 ... x. The first Parameter will be automatically marked as 1, the second as 2 and so on.

Parameter Description Type Status
Example name example param
Example alias 1
Example alias 2
Example alias 3

example description

Default:
NULL
Example:
xyz
String Required
Auto pre name B B param
B alias 1
B alias 2
B alias 3

B description

Default:
NULL
Example:
* List example with containing templates and HTML tags
* No Icon (<code>1</code>): <span class="nowrap" style="white-space:nowrap">[[Ginger Tom. Salad|Ginger Tom. Salad]]</span>
* Icon (<code>0</code>): <span class="nowrap" style="white-space:nowrap"><span class="itemLinkIcon" style="image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges;">[[File:Ginger Tom. Salad.png|24x24px]]</span>[[Ginger Tom. Salad|Ginger Tom. Salad]]</span>
* Default (parameter not used / <code>0</code>): <span class="nowrap" style="white-space:nowrap"><span class="itemLinkIcon" style="image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges;">[[File:Ginger Tom. Salad.png|24x24px]]</span>[[Ginger Tom. Salad|Ginger Tom. Salad]]</span>
String Required
Deprecated Example name deprecated param
Deprecated alias 1
Deprecated alias 2
Deprecated alias 3

deprecated description

Default:
NULL
Example:
xyz
String Deprecated

See Template:TemplateData and Template:TemplateData/entry for more information about the parameter list and DDNCode for more information about types and the DDN Notation

{{TemplateData|
{{TemplateData/entry
| name    = Example name
| param   = example param
| alias1  = Example alias 1
| alias2  = Example alias 2
| alias3  = Example alias 3
| desc    = example description
| default = NULL
| example = xyz
| type    = String
| status  = Required
}}
{{TemplateData/entry
| name    = Auto pre name B
| param   = B param
| alias1  = B alias 1
| alias2  = B alias 2
| alias3  = B alias 3
| desc    = B description
| def     = NULL
| example =
* List example with containing templates and HTML tags
* No Icon (<code>1</code>): {{ItemLink|Ginger Tom. Salad|noIcon=1}}
* Icon (<code>0</code>): {{ItemLink|Ginger Tom. Salad|noIcon=0}}
* Default (parameter not used / <code>0</code>): {{ItemLink|Ginger Tom. Salad}}
| type    = String
| status  = Required
| autoPre = 1
}}
{{TemplateData/entry
| name    = Deprecated Example name
| param   = deprecated param
| alias1  = Deprecated alias 1
| alias2  = Deprecated alias 2
| alias3  = Deprecated alias 3
| desc    = deprecated description
| def     = NULL
| example = xyz
| type    = String
| status  = Deprecated
}}
}}

Data Dictionary Notation (DDN) for types

The Data Dictionary Notation (DDN) is a modified modified BNF notation (which is used in Data Dictionaries) to describes the structure of data entries. The BNF and DDN notation is used in the field of Software engineering (SWE). In this case it describes how types have to be structured.

The used DDN Notation is slightly different than the linked DDN Notation:

  • The upper limit is not superscript
  • Can have a lower limit
  • Can have optional parts
Type Notation Description
Sequence + Sequence of definitions
Alternative [...|...] Only one element out of this list
Repetition {...} Repetition of the definition
Repetition 2 {...} Repetition of the definition with the minimum of two
Repetition {...} 5 Repetition of the definition with the maximum of five
Repetition 1 {...} 6 Repetition of the definition with the minimum of one and the maximum of six
Option (...) Optional definition
Specific value "..." fix definition

Predefined

All predefined Types can be used directly or inside DDNCode

Type Definition Comment
NULL "" Empty
LineFeed " " The Unicode character 'LINE FEED (LF)' (U+000A)
NonzeroDigit [ "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ] Single character, 1 - 9
Digit [ "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ] Single character, 0 - 9
LowerAlphabet [ "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" ] Single character, a - z
UpperAlphabet [ "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" ] Single character, A - Z
Alphabet [ LowerAlphabetUpperAlphabet ] Single character, a - z / A - Z
Ascii 1 {Ascii} 1 ASCII character
Char 1 {Char} 1 UTF-8 character
String 1 {Char} One or more UTF-8 characters
AsciiString 1 {Ascii} One or more ASCII characters
WikiCode 1 {WikiCode} 1 Any wiki code
DDNCode 1 {DDNCode} 1 Any DDNCode (links are allowed)
Number 1 {Digit} Any natural number with zero
Decimal 1 {Digit} + ( "." + 1 {Digit} ) Any natural number with zero
NonzeroNumber [ NonzeroDigit | 2 {Digit} ] Any natural number without zero
SignedNumber [ "-" + NonzeroDigitDigit | ("-") +  2 {Digit} ] Any Integer (doesn't allow -0 only 0)
PercentValue [ 1 {Digit} 2 | "100" ] Any natural number from 0 to 100
SignedPercentValue [ "-" + NonzeroDigitDigit | ("-") + 2 {Digit} 2 | ("-") + "100" ] Any natural number from 0 to 100 and from -1 to -100
Percent PercentValue + "%" From 0% to 100% (natural number)
SignedPercent SignedPercentValue + "%" From 0% to 100% and from -1% to -100% (natural number)
Boolean [ FalseTrue ] 0 (off) or 1 (on)
True "1" 1 (on)
False "0" 0 (off)
Month [ NonzeroDigit | "10" | "11" | "12" ] 1 - 12
Monthfill [ "0" + NonzeroDigit | "10" | "11" | "12" ] 01, 02, 03 ... - 12
Monthname [ "January" | "February" | "March" | "April" | "May" | "June" | "July" | "August" | "September" | "October" | "November" | "December" ] Month (name)
Day [ ( [ "1" | "2" ] ) + Digit | "30" | "31" ] 1 - 31
Dayfill [ [ "0" | 1" | "2" ] + Digit | "30" | "31" ] 01, 02, 03 ... - 31
Year 1 {Digit} Any year
LabeledYear Year + [" AD" | " BC" | " AC"] Any year with label
LevelNumber [ NonzeroDigit | 2 {Digit} 2 ] 1, 2, ... - 99
LevelNumberFill [ "0" + NonzeroDigit | 2 {Digit} 2 ] 01, 02, ... - 99
FormatString FormatStringStartFormatStringParamFormatStringEnd See MediaWiki TemplateData specification
FormatStringStart (LineFeed) + "{{" + (1 {" "})FormatStringHole
FormatStringParam (LineFeed) + (1 {" "}) + "|" + (LineFeed) + (1 {" "})FormatStringHole + (1 {" "}) + "=" + (1 {" "})FormatStringHole
FormatStringEnd (LineFeed) + (1 {" "}) + "}}" + (LineFeed)
FormatStringHole 1 {"_"}

Special Predefined

These predefines are based on the current Template

Type Definition Comment
<name> "{{{<name>}}}" All parameter names of the current template (this means: use the same type as in <name>)
<Template:<name>> "[[Template:<name>]]" Other templates (link required for type; this means: use these template as type; used in nested templates)

Examples

  • String + Number + {param}
  • Number + param

(param is in this example an other parameter of the template)

  • String + " = " + 1 {String} 2
  • String + (Number)