Jump to content

Template:Script doc auto/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Davidgothberg (talk | contribs) at 12:34, 14 December 2009 (Adding "{{used in system}}".). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

This is the {{script doc}} template.

It is meant to be used in the MediaWiki:Clearyourcache system message that is shown on top of .css and .js pages.

This template detects if a script page has an accompanying documentation page. If the doc page exists it shows a small green doc box with a link to the doc page. If no doc page exists then this template returns an empty string.

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.

When this template is called on top of User:Davidgothberg/clock.js it produces this output:

For testing and demonstration purposes this template can take a parameter named page. Like this:

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

The page parameter makes this template behave exactly as if on that page.

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/core}} which contains most of the code for this template.

See also