Template:TemplateData/entry/doc: Difference between revisions

From Fyra Wiki
Jump to navigation Jump to search
c2dl>Streetclaw
(→‎Examples: unused param removed)
m (2 revisions imported: TemplateData carryovers)
 
(No difference)

Latest revision as of 18:35, 6 June 2023

Template for creating a unified parameter format for templates

About

Creates a list that displays Template parameter in a unified format. This template creates a single entry for the Required template 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 title name Specify a title for a parameter of the template documentation

Default: NULL

Example: no example

String Required
Parameter name param Specify a name for a parameter of the template documentation

Default: NULL

Example: no example

String Required
Parameter alias1 alias1 Specify a alias for a parameter of the template documentation

Default: NULL

Example: no example

String Optional
Parameter alias2 alias2 Specify a alias for a parameter of the template documentation

Default: NULL

Example: no example

String Optional
Parameter alias3 alias3 Specify a alias for a parameter of the template documentation

Default: NULL

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 Example example Specify an example for a parameter of the template documentation

Default: no example

Example: no example

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

Default: NULL

Example: no example

DDNCode Required
Parameter status status Specify a status for a parameter of the template documentation

Default: NULL

Example: no example

["Required" | "Recommended" | "Optional" | "Deprecated" ] Required
Auto pre autoPre Automatic pre for examples

Default: 0

Example: no example

Boolean Optional

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

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
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|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|name=Auto pre name B|alias1=B alias 1|alias2=B alias 2|alias3=B alias 3|param=B param|desc=B description|def=NULL|example=
* List example with containing templates and HTML tags
|type=String|status=Required|autoPre=1}}
{{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}}
}}

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
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 [ 1 {NonzeroDigit} 1 | 2 {Digit} ] Any natural number without zero
SignedNumber [ "-" + 1 {NonzeroDigit} 1 | 1 {Digit} 1 | ("-") + 2 {Digit} ] Any Integer (doesn't allow -0 only 0)
PercentValue [ 1 {Digit} 2 | "100" ] Any natural number from 0 to 100
SignedPercentValue [ "-" + 1 {NonzeroDigit} 1 | 1 {Digit} 1 | ("-") + 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 ["0" | "1"] 0 (off) or 1 (on)
True "1" 1 (on)
False "0" 0 (off)
Month [ 1 {NonzeroDigit} 1 | "10" | "11" | "12"] 1 - 12
Monthfill ["0" + 1 {NonzeroDigit} 1 | "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" ] ) + 1 {Digit} 1 | "30" | "31" ] 1 - 31
Dayfill [ [ "0" | 1" | "2" ] + 1 {Digit} 1 | "30" | "31" ] 01, 02, 03 ... - 31
Year 1 {Digit} Any year
LabeledYear Year + [" AD" | " BC" | " AC"] Any year with label
LevelNumber [ 1 {NonzeroDigit} 1 | 2 {Digit} 2 ] 1, 2, ... - 99
LevelNumberFill [ "0" + 1 {NonzeroDigit} 1 | 2 {Digit} 2 ] 01, 02, ... - 99

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)