Template:Script doc auto

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search


Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:Script doc auto/doc.

It is used in the MediaWiki:Clearyourcache system message that is shown on top of .css and .js pages. This template is only loaded when in "User:" space. It produces the small green doc box seen on top of user .css and .js pages.

Usage

{{script doc auto}}

Template parameters

ParameterDescriptionDefaultStatus
pagePage title{{FULLPAGENAME}}optional
langlanguage code{{int:lang}}optional
<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.


Wikipedia's help about TemplateDataCommons-specific information

It is used in the [[MediaWiki:Clearyourcache]] system message that is shown on top of .css and .js pages. This template is only loaded when in "User:" space. It produces the small green doc box seen on top of user .css and .js pages.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
lang

language code

Default
<code>{{int:lang}}</code>
Lineoptional
page

Page title

Default
<code>{{FULLPAGENAME}}</code>
Page nameoptional

Additional information

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

The template is intended to be used by the following user groups: no user group specified

Examples

{{script doc auto|page=User:Davidgothberg/monobook.js}}

renders as:


{{script doc auto|page=User:Davidgothberg/clock.js}}

renders as:

See also

Localization

العربية  Deutsch  English  français  македонски  Nederlands  русский

This template makes use of {{Autotranslate}} and the translate extension.


When this template is called on a user skin file such as "/monobook.css" it gives a link to the accompanying "/monobook.js" file. It shows that link even if the accompanying skin file does not exist, but it then uses slightly different text.

For .css and .js pages in user space other than the skin files:

This template links to the documentation page for the script. It shows that link even if the documentation has not been created, but it then uses slightly different text. The doc pages of scripts are the page name but without the ending ".css" or ".js". For instance User:Davidgothberg/clock.js has its documentation at User:Davidgothberg/clock.

This template also detects if a .js page has an accompanying .css file and then links between them. It doesn't show that link if the other file does not exist.

Technical details

Internally this template uses the {{Str len}} template. Since {{str len}} is heavy on the servers this template only calls it once, then it feeds the result to {{Script doc auto/core}} which contains most of the code for this template, that template then in turn calls {{Script doc auto/core2}} which renders the green doc box and the actual text messages.

Note to admins: MediaWiki does not parse and convert HTML wikimarkup in system messages the same way as it does for normal pages. This means for instance that <br> is not automatically converted to <br /> and missing </td> and </tr> tags are not automatically added. Thus see to that any HTML code you use in this template is valid XHTML. That is, close all tags that you begin. However, regular wikimarkup works fine in most system messages.

For more technical details see the talk page.