Template:TemplateData/entry/doc: Difference between revisions
(→Parameter: Add `mwType`) |
(Document `label` alias for the `name` paramter) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{doc/start}} | {{doc/start}} | ||
Template for creating | Template for creating unified table rows for template parameter documentation. | ||
== About == | == About == | ||
Creates a | Creates a table row that displays Template parameter documentation in a unified format. | ||
This template creates a single entry for the | This template creates a single entry for the main template {{tlx|TemplateData}}. | ||
== Parameter == | == Parameter == | ||
{{TemplateData | {{TemplateData | ||
| desc = | |||
Template for creating unified table rows for template parameter documentation. | |||
This template creates a single entry for the main template {{((}}TemplateData{{))}}. | |||
| format = | | format = | ||
{{((}}_ | {{((}}_ | ||
Line 14: | Line 17: | ||
| params = | | params = | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Parameter label | ||
| param = name | | param = label | ||
| desc = Specify a | | alias1 = name | ||
| desc = Specify a label for a parameter of the template documentation | |||
| type = String | | type = String | ||
| status = Required | | status = Required | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Parameter name | ||
| param = param | | param = param | ||
| desc = Specify a name for a parameter of the template documentation | | desc = Specify a name for a parameter of the template documentation | ||
Line 28: | Line 32: | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Parameter alias1 | ||
| param = alias1 | | param = alias1 | ||
| desc = Specify a alias for a parameter of the template documentation | | desc = Specify a alias for a parameter of the template documentation | ||
Line 34: | Line 38: | ||
| status = Optional}} | | status = Optional}} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Parameter alias2 | ||
| param = alias2 | | param = alias2 | ||
| desc = Specify a alias for a parameter of the template documentation | | desc = Specify a alias for a parameter of the template documentation | ||
Line 41: | Line 45: | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Parameter alias3 | ||
| param = alias3 | | param = alias3 | ||
| desc = Specify a alias for a parameter of the template documentation | | desc = Specify a alias for a parameter of the template documentation | ||
Line 48: | Line 52: | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Parameter Description | ||
| param = desc | | param = desc | ||
| desc = Specify a description for a parameter of the template documentation | | desc = Specify a description for a parameter of the template documentation | ||
Line 56: | Line 60: | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Parameter Default | ||
| param = default | | param = default | ||
| alias1 = def | | alias1 = def | ||
Line 64: | Line 68: | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Parameter Example | ||
| param = example | | param = example | ||
| desc = Specify an example for a parameter of the template documentation | | desc = Specify an example for a parameter of the template documentation | ||
| def = no example | | def = no example | ||
| type = WikiCode | | type = WikiCode | ||
| status = | | status = Optional | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Parameter type | ||
| param = type | | param = type | ||
| desc = Specify a type for a parameter of the template documentation: [[#Data Dictionary Notation (DDN) for types|Data Dictionary Notation]] | | desc = Specify a type for a parameter of the template documentation: [[#Data Dictionary Notation (DDN) for types|Data Dictionary Notation]] | ||
Line 79: | Line 83: | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = MediaWiki Parameter type | ||
| param = mwType | | param = mwType | ||
| desc = Specify the [[mw:Help:TemplateData#Type parameter|MediaWiki TemplateData]] type for a parameter of the template. | | desc = Specify the [[mw:Help:TemplateData#Type parameter|MediaWiki TemplateData]] type for a parameter of the template. | ||
Line 101: | Line 105: | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Parameter status | ||
| param = status | | param = status | ||
| desc = Specify a status for a parameter of the template documentation | | desc = Specify a status for a parameter of the template documentation | ||
| type = <nowiki>["Required" | "Recommended" | "Optional" | "Deprecated" ]</nowiki> | | type = <nowiki>["Required" | "Recommended" | "Optional" | "Deprecated" ]</nowiki> | ||
| mwType = string | |||
| status = Required | | status = Required | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Auto pre | ||
| param = autoPre | | param = autoPre | ||
| desc = Automatic pre for examples | | desc = Automatic pre for examples | ||
Line 123: | Line 128: | ||
{{TemplateData| | {{TemplateData| | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Example name | ||
| param = example param | | param = example param | ||
| alias1 = Example alias 1 | | alias1 = Example alias 1 | ||
Line 135: | Line 140: | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Auto pre name B | ||
| param = B param | | param = B param | ||
| alias1 = B alias 1 | | alias1 = B alias 1 | ||
Line 152: | Line 157: | ||
}} | }} | ||
{{TemplateData/entry | {{TemplateData/entry | ||
| | | label = Deprecated Example name | ||
| param = deprecated param | | param = deprecated param | ||
| alias1 = Deprecated alias 1 | | alias1 = Deprecated alias 1 |
Latest revision as of 22:32, 15 June 2021
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
|
String | Required |
Parameter name | param
|
Specify a name for a parameter of the template documentation
|
String | Required |
Parameter alias1 | alias1
|
Specify a alias for a parameter of the template documentation
|
String | Optional |
Parameter alias2 | alias2
|
Specify a alias for a parameter of the template documentation
|
String | Optional |
Parameter alias3 | alias3
|
Specify a alias for a parameter of the template documentation
|
String | Optional |
Parameter Description | desc
|
Specify a description for a parameter of the template documentation
|
WikiCode | Recommended |
Parameter Default | default def
|
Specify the parameter's default value
|
WikiCode | Optional |
Parameter Example | example
|
Specify an example for a parameter of the template documentation
|
WikiCode | Optional |
Parameter type | type
|
Specify a type for a parameter of the template documentation: Data Dictionary Notation
|
DDNCode | Required |
MediaWiki Parameter type | mwType
|
Specify the MediaWiki TemplateData type for a parameter of the template.
|
[ "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
|
["Required" | "Recommended" | "Optional" | "Deprecated" ] | Required |
Auto pre | autoPre
|
Automatic pre for examples
|
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
Template for creating unified table rows for template parameter documentation. This template creates a single entry for the main template {{TemplateData}}.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Parameter label | label name | Specify a label for a parameter of the template documentation | String | required |
Parameter name | param | Specify a name for a parameter of the template documentation | String | required |
Parameter alias1 | alias1 | Specify a alias for a parameter of the template documentation | String | optional |
Parameter alias2 | alias2 | Specify a alias for a parameter of the template documentation | String | optional |
Parameter alias3 | alias3 | Specify a alias for a parameter of the template documentation | String | optional |
Parameter Description | desc | Specify a description for a parameter of the template documentation
| Content | suggested |
Parameter Default | default def | Specify the parameter's default value | Content | optional |
Parameter Example | example | Specify an example for a parameter of the template documentation
| Content | optional |
Parameter type | type | Specify a type for a parameter of the template documentation: [[#Data Dictionary Notation (DDN) for types|Data Dictionary Notation]] | Content | required |
MediaWiki Parameter type | mwType | Specify the [[mw:Help:TemplateData#Type parameter|MediaWiki TemplateData]] type for a parameter of the template. | String | suggested |
Parameter status | status | Specify a status for a parameter of the template documentation | String | required |
Auto pre | autoPre | Automatic pre for examples
| Boolean | optional |
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
|
String | Required |
Auto pre name B | B param B alias 1 B alias 2 B alias 3
|
B description
|
String | Required |
Deprecated Example name | deprecated param Deprecated alias 1 Deprecated alias 2 Deprecated alias 3
|
deprecated description
|
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 | [ LowerAlphabet | UpperAlphabet ]
|
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 | [ "-" + NonzeroDigit | Digit | ("-") + 2 {Digit} ]
|
Any Integer (doesn't allow -0 only 0) |
PercentValue | [ 1 {Digit} 2 | "100" ]
|
Any natural number from 0 to 100 |
SignedPercentValue | [ "-" + NonzeroDigit | Digit | ("-") + 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 | [ False | True ]
|
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 | FormatStringStart + FormatStringParam + FormatStringEnd
|
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)