This page is protected against editing.

Template:TemplateBox

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:TemplateBox/doc.
warning Warning:This page is shared between multiple wikis.
All changes to this page will be automatically copied to all wikis listed in the left side bar.

The template provides a uniform way to provide basic information about the use of a template. See: Commons:Template documentation and Commons:TemplateData.

Usage

{{TemplateBox
 |1                  =
 |1d                 =
 |1label             =
 |1aliases           =
 |1type              =
 |1set               =
 |1def               =
 |1stat              =
 |useTemplateData    =
 |name               =
 |desc               =
 |namespace          =
 |usergroup          =
 |placement          =
 |usage-notes        =
 |type               =
 |example            =
 |example-value      =
 |i18n-method        =
 |i18n-desc          =
 |i18n-mediawiki-msg =
 |i18n-subpage       =
 |i18n-data-file     =
 |seealso            =
 |setscats           =
 |print              =
 |shorthand          =
 |relieson           =
 |mustbesubst        =
 |docsub-page        =
}}

Usage notes: For a copy-paste form with short parameter descriptions see section Usage – with short parameter descriptions

Template parameters

ParameterDescriptionDefaultStatus
1name (param)parameter name (similarly 2, 3, …). Note that if all of the parameters beginning with a number are removed from the template, the usage notes will state "The template takes no parameters."emptyoptional
1d
1d-en
1description
1description-en
description (param)description of the parameter (similarly 2d, 3d, …) -langcodeemptyoptional
1d-td
1d-td-en
1description-td
1description-td-en
TemplateData description (param)description of the parameter (similarly 2d-td, 3d-td, …) for Extension:TemplateData which does not accept Wiki-markup. If this parameter is omitted, 1d is used. You can always override the defaults specifically for TemplateData by appending -td to the parameter-name. You can specify a language by appending your language-code. E.g. 3d-td-en would be the English translation of the description of parameter 3 which will be used in TemplateData. -langcodeemptyoptional
1label
1label-en
1label-td
1label-td-en
label (param)A (very) brief name for the parameter. Try to keep under 20-ish characters. 1label-de would be the German translation of this label. -langcodeemptyoptional
1aliasesaliases (param)An alias is an alternative name for the parameter that may be used instead of (not in addition to) the primary name. Name the aliases and separate them by "/"; e.g.d/desc/description.emptyoptional
1typetype (param)The type of the parameter, for (soft) type hinting. Please refer to the list of possible values.emptyoptional
1setset (param)Label and ID of a set in one. Multiple parameters can be grouped in a set, if either none or all of them must be supplied. Try to keep under 20-ish characters.emptyoptional
1def
1def-td
1default
default (param)default value for the parameter (similarly 2def, 3def, …) -langcodeemptyoptional
1stat
1stat-td
1deprecated
1required
status (param)status of the parameter (similarly 2stat, 3stat, …); possible values:
required
optional
optional-
optional and not present in the standard form
deprecated
optionaloptional
useTemplateDataexpose TemplateDataWhether the template should expose TemplateData - omitting means "false". Setting to 1, true, or yes means "true". Setting to only will suppress the house-made table. Setting useTemplateData to export will turn TemplateBox into a preformatted Copy & Paste template.emptysuggested
nametitle (template)name of the template (needed for viewing the documentation on another page than the template page, in particular for viewing the documentation page separately){{BASEPAGENAME}}required
desc
desc-en
description
description-en
desc-td
description-td
description (template)description of what the template does -langcodeemptyrequired
namespacenamespacenamespaces, the template is intended to be used in; possible values:
all
talks
contents
Main
Talk
User
User talk
Commons
Commons talk
File
File talk
MediaWiki
MediaWiki talk
Template
Template talk
Help
Help talk
Category
Category talk
Creator
Creator talk
Special
Any other values will show as “unknown”.
no namespace specifiedrequired
usergroupusergroupusergroup that is meant to use the template; possible values:
all
bot
administrator
admin
sysop
bureaucrat
crat
checkuser
licensereviewer
vrt
autoconfirmed
autopatrolled
filemover
oversight
patroller
rollbacker
steward
upwizcampeditors
no user group specifiedrequired
placementplacementplacement on the page; possible values:
top
bottom
licence
source
emptyoptional
usage-notesusage-notesNotes about the correct usage of the template; will be listed in the Usage-section beneath the code example and the shorthands, if given.emptyoptional
typetype (template)what type is the template (infobox, formatting, licence tag, …)emptyoptional
exampleexampleExample value for one single (unnamed) parameter; a possible value (e.g. for the Template:catseealso) can be: lakes. If there are more than one parameter you have to separate them with {{!}}; e.g 1=lakes{{!}}for=for more informations.
There is also example2 for a second example.
emptyoptional
example-valueexample-resultExample use of the template with the value of the example parameter; so according to the example above the value of example-value parameter will be {{catseealso|lakes}}; with two parameters it will be {{catseealso|lakes|for=for more informations}}. On the doc-page of the template it will render this code and show the result. If you keep example-value parameter empty, it will render {{catseealso|lakes}} by default.
There is also example2-value for a second example.
{{TEMPLATENAME|<example>}}optional
i18n-methodtranslation methodmethod the localization is achieved by. Known values:
autotranslate
using {{Autotranslate}} or applying a similar method
switch
using {{LangSwitch}} in the template itself
-
no localization needed
custommediawiki-msg
using MediaWiki namespace messages
mediawiki-msg
using MediaWiki namespace messages, translated on translatewiki.net
ext.translate
using {{Autotranslate}} or applying a similar method on a subpage that is marked for translation using the translate extension
TNT
Using Module:TNT and a tabular translations file on Wikimedia Commons.
emptyoptional
i18n-desctranslation infoadditional info about the localizationemptyoptional
i18n-mediawiki-msgmediawiki-messageWhen using “mediawiki-msg” as method, optionally put the name of the message here. Falls back to:emptyoptional
i18n-subpagetranslation subpageWhen using “ext.translate” as method, optionally put the name of the sub-page here. A dot (.) means that the current template hosts the translation on its subpages directly.i18noptional
i18n-data-fileI18n Data FileThe tabular data file on Wikimedia Commons in the Data namespace. The I18n/ prefix and the .tab file extension are added automatically if its missing.I18n/{{{name}}}.taboptional
seealsosee alsoList of relevant links (each on a new code line; e.g. * [[Commons:TemplateData]])emptyoptional
setscatscategorizes intoList of categories which are automatically set by the template (each on a new code line; e.g. * [[:Category:Rivers]])emptyoptional
printprintThe way the parameters are typically arranged in the Usage-section; possible values:
  • one - parameters arranged in one line (default):
 |1def= |1stat= |useTemplateData= 
  • multi - parameters arranged in multiple lines:
 |1def =
 |1stat =
 |useTemplateData = 
  • infobox - multiple lines, the equals signs are aligned with each other:
 |1def            =
 |1stat           =
 |useTemplateData = 
one (if type parameter ≠ infoboxthis dependency is not working, everytime "one" by default)optional
linesDeprecated! Use parameter print instead.emptyoptional
shorthandshorthandShorthand(s) for easy use (redirects to main template), separated by comma, e.g. {{tl|catseealso}}, {{tl|csa}} for Template:Cat see also. On the doc-pages they will be listed in the Usage-section directly beneath the code example (and above the usage-notes if given), see examples of lists of redirects here and with an additional searches-for-more-redirects here.emptyoptional
reliesonrelies onList of templates on which the template's basic functionality relies (each on a new code line; e.g. * [[Module:TemplateBox]])emptyoptional
mustbesubstmust be substSet to yes (or any value) if the template must be substituted. This puts "subst:" into the template example under Usage-section.emptyoptional
docsub-pagedocsub-pagepage parameter from {{Documentation subpage}}{{NAMESPACE}}:{{BASEPAGENAME}}optional
Template data
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.

Discussion
There is an ongoing discussion about that matter. Feel invited to comment if you are experienced in either way, your time permits and if you like to share your opinion or to make a suggestion.


Wikipedia's help about TemplateDataCommons-specific information

The template provides a uniform way to provide basic information about the use of a template. See: [[Commons:Template documentation]] and [[Commons:TemplateData]].

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
name (param)1

parameter name (similarly <code>2</code>, <code>3</code>, …). Note that if all of the parameters beginning with a number are removed from the template, the usage notes will state "The template takes no parameters."

Stringoptional
aliases (param)1aliases

An alias is an alternative name for the parameter that may be used instead of (not in addition to) the primary name. Name the aliases and separate them by "'''/'''"; e.g.'''d/desc/description'''.

Stringoptional
description (param)1d 1d-en 1description 1description-en

description of the parameter (similarly 2d, 3d, …)

Stringoptional
TemplateData description (param)1d-td 1d-td-en 1description-td 1description-td-en

description of the parameter (similarly 2d-td, 3d-td, …) for the TemplateData extension which does not accept Wiki-markup. If this parameter is omitted, 1d is used. You can always override the defaults specifically for TemplateData by appending "-td" to the parameter-name. You can specify a language by appending your language-code. E.g. "3d-td-en" would be the English translation of the description of parameter 3 which will be used in TemplateData.

Stringoptional
default (param)1def 1def-td 1default

default value for the parameter (similarly "2def", "3def", …)

Unknownoptional
label (param)1label 1label-en 1label-td 1label-td-en

A (very) brief name for the parameter. Try to keep under 20-ish characters. "1label-de" would be the German translation of this label.

Stringoptional
set (param)1set

Label and ID of a set in one. Multiple parameters can be grouped in a set, if either none or all of them must be supplied. Try to keep under 20-ish characters.

Stringoptional
status (param)1stat 1stat-td 1deprecated 1required

status of the parameter (similarly <code>2stat</code>, <code>3stat</code>, …); possible values:

required
optional
optional-
optional and not present in the standard form
deprecated

Suggested values
required suggested optional optional- deprecated
Default
optional
Stringoptional
type (param)1type

The type of the parameter, for (soft) type hinting. Please refer to the [https://github.com/wikimedia/mediawiki-extensions-TemplateData/blob/master/Specification.md#34-type list of possible values].

Stringoptional
description (template)desc desc-en description description-en desc-td description-td

description of what the template does

Stringrequired
docsub-pagedocsub-page

“page” parameter from {{Documentation subpage}}

Default
{{NAMESPACE}}:{{BASEPAGENAME}}
Page nameoptional
exampleexample

Example value for one single (unnamed) parameter; a possible value (e.g. for the [[Template:catseealso]]) can be: '''lakes'''. If there are more than one parameter you have to separate them with '''{{!}}'''; e.g '''1=lakes{{!}}for=for more informations'''.<br>There is also <code>example2</code> for a second example.

Stringoptional
example-resultexample-value

Example use of the template with the value of the <code>example</code> parameter; so according to the example above the value of <code>example-value</code> parameter will be '''{{catseealso|lakes}}'''; with two parameters it will be '''{{catseealso|lakes|for=for more informations}}'''. On the doc-page of the template it will render this code and show the result. If you keep <code>example-value</code> parameter empty, it will render {{catseealso|lakes}} by default.<br>There is also <code>example2-value</code> for a second example.

Default
{{TEMPLATENAME|&lt;example&gt;}}
Stringoptional
I18n Data Filei18n-data-file

The tabular data file on Wikimedia Commons in the Data namespace. The “I18n/” prefix and the “.tab” file extension is added automatically if its missing.

Default
I18n/{{{name}}}.tab
Auto value
I18n/{{subst:ROOTPAGENAME}}.tab
Stringoptional
translation infoi18n-desc

additional info about the localization

Stringoptional
mediawiki-messagei18n-mediawiki-msg

When using “mediawiki-msg” as method, optionally put the name of the message here. Falls back to:

Stringoptional
translation methodi18n-method

method the localization is achieved by. Known values:

autotranslate
using [[:Template:Autotranslate|<span style="font-family:monospace,monospace;">&#123;&#123;Autotranslate&#125;&#125;</span>]] or applying a similar method
switch
using [[:Template:LangSwitch|<span style="font-family:monospace,monospace;">&#123;&#123;LangSwitch&#125;&#125;</span>]] in the template itself
-
no localization needed
custommediawiki-msg
using MediaWiki namespace messages
mediawiki-msg
using MediaWiki namespace messages, translated on [[translatewiki:|translatewiki.net]]
ext.translate
using [[:Template:Autotranslate|<span style="font-family:monospace,monospace;">&#123;&#123;Autotranslate&#125;&#125;</span>]] or applying a similar method on a subpage that is marked for translation using the translate extension
TNT
Using [[Module:TNT]] and a tabular translations file on Wikimedia Commons.

Suggested values
- autotranslate ext.translate switch mediawiki-msg custommediawiki-msg TNT
Stringoptional
translation subpagei18n-subpage

When using “ext.translate” as method, optionally put the name of the sub-page here. A dot ('''.''') means that the current template hosts the translation on its subpages directly.

Default
i18n
Stringoptional
lines

''Deprecated!'' Use parameter <code>print</code> instead.

Unknownoptional
must be substmustbesubst

Set to '''yes''' (or any value) if the template must be substituted. This puts "subst:" into the template example under [[#Usage|Usage]]-section.

Stringoptional
title (template)name

name of the template <small>''(needed for viewing the documentation on another page than the template page, in particular for viewing the documentation page separately)''</small>

Default
<small>{{'''BASE'''PAGENAME}}</small>
Page namerequired
namespacenamespace

namespaces, the template is intended to be used in; possible values:

all
talks
contents
Main
Talk
User
User talk
Commons
Commons talk
File
File talk
MediaWiki
MediaWiki talk
Template
Template talk
Help
Help talk
Category
Category talk
Creator
Creator talk
Special
Any other values will show as “unknown”.

Default
no namespace specified
Stringrequired
placementplacement

placement on the page; possible values:

top
bottom
licence
source

Suggested values
top bottom license source
Stringoptional
printprint

The way the parameters are typically arranged in the [[#Usage|Usage]]-section; possible values:

  • '''one''' - parameters arranged in one line (default):
  • '''multi''' - parameters arranged in multiple lines:
  • '''infobox''' - multiple lines, the equals signs are aligned with each other:

Suggested values
multi one infobox
Default
one (if type parameter ≠ '''infobox'''<sup>[[Template talk:TemplateBox#Parameter "print" - dependency with "type"-parameter not working|this dependency is not working, everytime "one" by default]]</sup>)
Stringoptional
relies onrelieson

List of templates on which the template's basic functionality relies (each on a new code line; e.g. '''* [[Module:TemplateBox]]''')

Stringoptional
see alsoseealso

List of relevant links (each on a new code line; e.g. '''* [[Commons:TemplateData]]''')

Stringoptional
categorizes intosetscats

List of categories which are automatically set by the template (each on a new code line; e.g. '''* [[:Category:Rivers]]''')

Stringoptional
shorthandshorthand

Shorthand(s) for easy use (redirects to main template), separated by comma, e.g. '''{{tl|catseealso}}, {{tl|csa}}''' for [[Template:Cat see also]]. On the doc-pages they will be listed in the [[#Usage|Usage]]-section directly beneath the code example (and above the <code>usage-notes</code> if given), see examples of lists of redirects [[Template:CatDiffuse/doc|here]] and with an additional searches-for-more-redirects [[Template:Cat see also/doc|here]].

Stringoptional
type (template)type

what type is the template ('''infobox''', '''formatting''', '''licence tag''', …)

Stringoptional
usage-notesusage-notes

Notes about the correct usage of the template; will be listed in the [[#Usage|Usage]]-section beneath the code example and the shorthands, if given.

Stringoptional
expose TemplateDatauseTemplateData

Whether the template should expose TemplateData - Omitting means "false". Setting to “1”, “true”, or “yes” means "true". Setting to “only” will suppress the house-made table. Setting useTemplateData to “export” will turn TemplateBox into a preformatted Copy & Paste template.

Suggested values
1 only
Auto value
only
Stringsuggested
usergroupusergroup

usergroup that is meant to use the template; possible values:

all
bot
administrator
admin
sysop
bureaucrat
crat
checkuser
licensereviewer
vrt
autoconfirmed
autopatrolled
filemover
oversight
patroller
rollbacker
steward
upwizcampeditors

Suggested values
all bot administrator admin sysop bureaucrat crat checkuser licensereviewer otrs autoconfirmed autopatrolled filemover oversight patroller rollbacker steward upwizcampeditors
Default
no user group specified
Stringrequired

Additional information

The template is intended to be used in the following namespaces: the Template namespace

The template is intended to be used by the following user groups: all users

Placement:

in the '/doc' subpage of a template

Relies on:

See also

Localization

Boarisch  català  Bahasa Indonesia  Deutsch (Sie-Form)  dansk  čeština  Canadian English  Deutsch  Bahasa Melayu  sicilianu  italiano  русский  eesti  беларуская (тарашкевіца)  Tiếng Việt  português  euskara  English  magyar  Zazaki  Nederlands  português do Brasil  Türkçe  slovenščina  polski  latviešu  galego  slovenčina  македонски  norsk bokmål  Lëtzebuergesch  español  svenska  hrvatski  français  suomi  Plattdüütsch  occitan  norsk nynorsk  српски / srpski  українська  मराठी  বাংলা  ਪੰਜਾਬੀ  മലയാളം  ไทย  한국어  日本語  中文  中文(简体)  中文(繁體)  العربية  فارسی  +/−

This template makes use of {{Autotranslate}} and the translate extension. The layout of the template can be found under Template:TemplateBox/layout.

Usage – with short parameter descriptions

  • Standard form for copy & paste with comments explaining shortly each parameter
  • The parameter names are without language code:
{{TemplateBox
 <!-- TEMPLATE PARAMETERS SECTION (for 2nd parameter copy paste & change "1" → "2") -->
 |1          = <!-- parameter name -->
  |1d        = <!-- parameter description (+LANGUAGE CODE) -->
  |1d-td     = <!-- parameter description for TemplateData (+LANGUAGE CODE) -->
  |1label    = <!-- parameter label, very brief, preferably less than 20 characters -->
  |1aliases  = <!-- parameter alternative names that may be used, separated by "/" -->
  |1type     = <!-- parameter type (values: string, number,…) -->
  |1set      = <!-- parameter set ID / Label (to group multiple parameters in a set) -->
  |1def      = <!-- parameter default value (+LANGUAGE CODE) -->
  |1stat     = <!-- parameter status (values: required, optional, optional- or deprecated) -->
 <!-- TEMPLATE SECTION -->
 |useTemplateData    = <!-- expose TemplateData (values: true, export; default: false) -->
 |name               = <!-- template title -->
 |desc               = <!-- template description (+LANGUAGE CODE) -->
 |namespace          = <!-- namespaces, the template is intended to be used (values: all, File, Category,…) -->
 |usergroup          = <!-- usergroup that is meant to use the template (values: all, admin,…) -->
 |placement          = <!-- placement on the page (values: top, bottom, licence or source) -->
 |usage-notes        = <!-- notes about the correct usage of the template -->
 |type               = <!-- template type (values: infobox, formatting, licence tag,…) -->
 |example            = <!-- example value for one (unnamed) parameter -->
 |example-value      = <!-- example use of the template with the value of the example parameter -->
 |i18n-method        = <!-- translation method (values: mediawiki-msg, ext.translate, autotranslate,…) -->
 |i18n-desc          = <!-- translation info -->
 |i18n-mediawiki-msg = <!-- name of the message when using “mediawiki-msg” as method -->
 |i18n-subpage       = <!-- translation subpage when using "ext.translate" as method -->
 |i18n-data-file     = <!-- tabular data file on Wikimedia Commons in the Data namespace -->
 |seealso            = <!-- relevant links (each of them on a new code line with * in the beginning) -->
 |setscats           = <!-- categories which are automatically set by the template -->
 |print              = <!-- template code layout in the Usage-section (values: one, multi, infobox) -->
 |shorthand          = <!-- redirects to the main template -->
 |relieson           = <!-- list of templates on which the template's basic functionality relies -->
 |mustbesubst        = <!-- set to yes (or any value) if the template must be substituted. -->
 |docsub-page        = <!-- page parameter from {{Documentation subpage}} -->
}}
  • Standard form for copy & paste with very short comments explaining very shortly each parameter (for example if editing on mobile devices)
  • For the parameter names the language code is preset to English (-en):
{{TemplateBox
 <!--TEMPLATE PARAMETERS SECTION (for 2.param copy paste & "1"→"2")-->
 |1           = <!--param name-->
  |1d-en      = <!--param en-description (English)-->
  |1d-td-en   = <!--param en-description for TemplateData-->
  |1label     = <!--param label, preferably <20 characters-->
  |1aliases   = <!--param alternative names, separated by "/"-->
  |1type      = <!--param type (string/number/…)-->
  |1set       = <!--param set ID/Label for grouping parameters-->
  |1def-en    = <!--param default value (in English)-->
  |1stat      = <!--param status (required/optional/…)-->
 <!--TEMPLATE SECTION-->
 |useTemplateData    = <!--expose TemplateData (false/true/export)-->
 |name               = <!--template title-->
 |desc-en            = <!--template en-description (English)-->
 |namespace          = <!--template's namespaces (all/Category/…)-->
 |usergroup          = <!--template's usergroup (all/admin/…)-->
 |placement          = <!--template's placement (top/source/…)-->
 |usage-notes        = <!--notes about the correct usage-->
 |type               = <!--template type (infobox/formatting/…)-->
 |example            = <!--example value for one (unnamed) parameter-->
 |example-value      = <!--example use of the templatea-->
 |i18n-method        = <!--translation method-->
 |i18n-desc          = <!--translation info-->
 |i18n-mediawiki-msg = <!--name of the message (method=“mediawiki-msg”)-->
 |i18n-subpage       = <!--translation subpage (method="ext.translate")-->
 |i18n-data-file     = <!--tabular data file on Wikimedia Commons-->
 |seealso            = <!--list of relevant links-->
 |setscats           = <!--list of categories automatically set-->
 |print              = <!--template code layout (one/multi/infobox)-->
 |shorthand          = <!--redirects to the main template-->
 |relieson           = <!--list of templates the template relies on-->
 |mustbesubst        = <!--if template must be substituted: yes-->
 |docsub-page        = <!--{{Documentation subpage}} page parameter-->
}}

About: TemplateData

Every entity, except inherit that is documented at the TemplateData technical documentation, is supported by {{TemplateBox}}. Conversion to JSON is done by a LUA module. The LUA module automatically converts traditionally used parameters as well as the new ones to both, TemplateData, as well as the "historic table", on demand. The "historic table" is the table which was used to show parameter information at Wikimedia Commons before TemplateData was invented.

Required parameters
  • |desc= (or in its translated form), parameters and their description

Translation
  • Avoid {{LangSwitch}}. It doesn't work in TemplateData.
  • Append -langcode to the name of any translatable parameter, marked by -langcode in TemplateBox. For example, adding the French translation of the description of parameter 1, you would write |1d-fr=C'est la description pour paramètre un.. Supplying only |1d-en=This is the description of parameter 1. instead of |1d=This is the description of parameter 1. will also work. The -en-style is recommended because it eases the job for translators. They then recognize the structure behind it without having to consult the documentation.
  • The language code must be the last element. Valid: |1d-td-en=. Invalid: |1d-en-td=
Naming
  • Both, old names and new names are supported but treated differently if both of them are supplied.
    • For example, while creating the "historic table", if both 1def and 1default where supplied, the value for 1def would be used. For generating TemplateData, the preference is the other way around.
Overriding
  • It's possible to override a specific entity, either for the "historic table" or for TemplateData.
    • To override for TemplateData, append a -td to the parameter's default name.
    • On the other hand, if you coded something for TemplateData and want to use a link or other markup in the "historic table", use the parameter name without the -td or modify that, which should be only used for TemplateData appending -td.
Pay attention
  • TemplateData does not support parsing Wiki-Markup. Think of it as if it would expand all templates and finally putting a nowiki around all this.
  • When including templates, they must be wrapped them in <nowiki>s, if they should not be expanded (it's, on the other hand, a geeky feature that you can use, if having the expanded content inside TemplateData is exactly what you want).
  • Even though some tags, such as <pre> seem to be rendered as expected, avoid them.
Activation
  • TemplateData can be activated setting the useTemplateData parameter to 1 or to only. The former will add a collapsed version of the table; the latter one replaces the "historic table" with the TemplateData table. In both cases, TemplateData is available through the API.
Fetching TemplateData (e.g. for TemplateBox itself)

/w/api.php?action=templatedata&format=json&titles=Template%3ATemplateBox (raw result, pretty result)

Advantages
  • No type-mixture: Instead of inserting a new content-type, a template can be used.
  • Syntax: Less error-prone compared to editing JSON (without a special editor).
  • Schema: Always valid. TemplateBox always passes a structure matching the requested schema.
  • Flat structure.
  • Prepared for future changes. Adjustments to the LUA module can be made to support future changes. The power of control remains at Commons.
  • Inserting redundant information can be avoided.
  • Template traditionally used at Commons.
Issues
  • Grouping sets is currently not supported in the "historic table". Set labels are not supported to be multilingual (ideas how one could achieve this are truly welcome).
Example
{{TemplateBox

  | useTemplateData = 1
  | 1 = artist
  | 1aliases = Artist
  | 1label-en = Artist
  | 1type = string

  <!-- used as the parameter description in the main parameter area of the documentation -->
  <!-- and in the template data section unless overridden with 1d-td-langcode -->  
  | 1d-de = Künstler, der das ursprüngliche Kunstwerk geschaffen hat.<br/>Benutze möglichst immer {{Creator:Vorname Nachname}} mit der Vorlage {{Tl|Creator}}.
  | 1d-en = Artist who created the original artwork.<br/>Use {{Creator:Name Surname}} with {{Tl|Creator}} template whenever possible.
  | 1d-fr = Artiste ou artisan à l'origine de l'œuvre.<br/>Dans la mesure du possible, utiliser le modèle {{Tl|Creator}}.
  | 1d-sv = Artist som skapade originalverket.<br/>Använd {{Creator:Förnamn Efternamn}} med {{Tl|Creator}}-mallen om detta är möjligt.

  <!-- this overrides 1d-en in the Template data section -->
  <!-- and all other translations unless each is provided as desc-td-langcode -->
  | 1d-td-en = Artist who created the original artwork; this overrides "1d-en" in the Template data section; "1d-en" is used in the template "Parameter" section.

  | 1def-de = Freifeld, angezeigt als: "{{int:wm-license-information-author}}".
  | 1def-en = blank field presented as: "{{int:wm-license-information-author}}".
  | 1def-fr = champ vide: « {{int:wm-license-information-author}} »
  | 1def-sv = tomt fält, visas som: "{{int:wm-license-information-author}}"

  <!-- used as the description of the template in the main documentation area -->
  <!-- and in the Template data section unless overridden with desc-td-langcode -->
  | desc-de = Deutsche Übersetzung der {{tl|Vorlagen}}beschreibung
  | desc-en = English translation of the {{tl|template}} description

  <!-- this overrides desc-en in the Template data section -->
  <!-- and all other translations unless each is provided as desc-td-langcode -->
  | desc-td-en = English translation that is used in the Template data section instead of "desc-en". This will also replace all desc-langcode translations, unless corresponding "desc-td-langcode" is provided.

}}

A live example is Template:Information/doc (edit that enabled TemplateData through TemplateBox, API-result showing the JSON generated by the Lua Module behind TemplateBox)

Experimenting

You can use Special:ExpandTemplates to experiment with how the template will output the template documentation and the Template data section; e.g., copy the example above and paste it into the input text on the Special:ExpandTemplates page; then click on the ok button to see the result.

Complications

( NOTE : the {{sed|1}} template links appears HERE : >>> )

edit

A complication is that the template suppresses section editing links on the whole page of the documented template, and also on its documentation page, even for paragraphs outside the part produced by this template TemplateBox. Template:Sed can be used (as is done here) to create an edit link anyway.