• Home
  • Random
  • Recent changes
  • Special pages
  • Settings
  • About MOASSpedia
  • Disclaimers
MOASSpedia
  • 216.73.216.154
  • Talk
  • Watchlist
  • Contributions
  • Log in

Template:Script doc auto

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here


Template documentation[view] [edit] [history] [purge]
WarningThis template is used in system messages.
Changes to it can cause immediate changes to the Wikipedia user interface.
To avoid major disruption, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them.

This is the {{script doc auto}} template.

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.

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

Template-info.svgThe accompanying .css page for this skin can be added at User:Davidgothberg/monobook.css.

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

Template-info.svgDocumentation for this user script can be added at User:Davidgothberg/clock.

The above boxes are not transparent, instead they use the same background colour as the green doc box.

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.

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

{{script doc auto| 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 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.

See also

  • MediaWiki:Clearyourcache – The system message that uses this template.
  • mw:Help:Magic words – About {{padleft:||}} etc.
  • mw:Help:Extension:ParserFunctions – About {{#ifexpr:||}} etc.
  • Wikipedia:WikiProject User scripts/Scripts – Lists many user scripts.
The above documentation is transcluded from Template:Script doc auto/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://moasspedia.org/w/index.php?title=Template:Script_doc_auto&oldid=30092"
Categories:
  • Pages used in system messages needing protection
  • MediaWiki namespace templates
Last edited on 14 July 2019, at 20:25

MOASSpedia

Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • This page was last edited on 14 July 2019, at 20:25.
  • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • Privacy policy
  • About MOASSpedia
  • Disclaimers
  • Desktop