Jump to content

Template talk:Script doc auto

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Amalthea (talk | contribs) at 18:12, 14 December 2009 (re Davidgothberg). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

About ((script doc))

For the discussion that lead to the creation of this template see MediaWiki talk:Clearyourcache#Script documentation.

1: I have done some more thinking and I think we can let this template do its detection in all namespaces. For the .css and .js pages in MediaWiki space we usually don't have a doc page. But if people start to add doc pages there then it would be convenient to have this template link to them too. (Well, we should not add doc pages in MediaWiki space for performance reasons, but redirects to doc pages are probably okay there.)

2: A possible extension of this template would be to detect if for instance a .js page has an accompanying .css page. Then it could output something like this:

And when there is no doc page but only an accompanying .css page:

A funny but useful effect would be that MediaWiki:Common.css and MediaWiki:Common.js would then automatically link to each other. If we don't want that then we can of course modify this behaviour in the MediaWiki space.

3: We could show the editnotice of a script, above the script. But we should probably only do that for MediaWiki space. See for instance MediaWiki:Common.css and its editnotice Template:Editnotices/Page/MediaWiki:Common.css. For all other spaces we should probably just link to the documentation for the script. Otherwise people might start to use the editnotice as the documentation page for the script, which would be weird.

--David Göthberg (talk) 13:41, 14 December 2009 (UTC)[reply]

Looks good! Concerning your last remarks at MediaWiki talk:Clearyourcache, and without having looked at the template source, some incoherent thoughts:
  • Only pages in User and MediaWiki space handle .js/.css specially and consequently show the Clearyourcache message, right? However, people might want to place scripts in Wikipedia space as well, but they'll need to invoke the template manually. Project space is probably too diverse, and things like (Wikipedia:Articles for deletion/User:Aditya Kabir/monobook.js should not automatically gain a documentation link anyway (even if we found a message where to transclude this template from).
  • Showing it in User and MediaWiki space if the doc page exists should be the desirable behavior. However, I'm unsure about the best course in MediaWiki space. What was the actual problem with the edit notices in MediaWiki space: the number of bytes in the cache, or the number of messages? If the latter, placing the documentation in MediaWiki talk right away would be a solution, but would be inconsistent, so for now, I agree we shouldn't worry about performance too much unless told otherwise.
  • Having a redlinked documentation page would go a long way to standardize script documentation here on en-wiki. However, displaying the redlink on people's skin scripts (monobook.js) and inviting them to document those would be weird in almost all circumstances, so those would need to be excluded. Not sure about the MediaWiki js files, documentation for the gadgets is usually in some Wikipedia page, since nobody ever uses the scripts there directly.
Amalthea 16:05, 14 December 2009 (UTC)[reply]
Oh, I wasn't aware of that MediaWiki only handled .js and .css pages as scripts when in User and MediaWiki space. But as you state, that kind of is a good thing, so we only need to think about those two spaces.
I don't know if the size or number of messages is the problem in MediaWiki space. What I do know is that the servers keep all the MediaWiki messages in RAM at all times, thus any message we add takes up RAM in the servers. So my guess is that both the number of messages and the size matters, since there probably is some overhead per message. But I know that loading from a template into MediaWiki space does not cost RAM in the servers, since that template only gets cached the normal way. So we don't need to worry much about the size of templates we use in MediaWiki space. But the number of .css and .js pages in MediaWiki space is pretty low, so if we would add documentation there by putting a redirect in the "doc page" of those pages, then it probably would not cost much. That redirect should then go to a page in "Wikipedia:" space or so. But personally I think it would be better to instead show the editnotice on top of the .css and .js pages in MediaWiki space. Then people can add links in those editnotices instead, and in many cases we already have such links in those editnotices.
Right, if we add red links to possible documentation pages, then we should not do that in MediaWiki space, and not on the standard user skin scripts like /monobook.js. The red links could look something like this:
The texts I use in these boxes might need some improvements, suggestions are as always welcome.
So what I am saying is this:
  • When in user space we should show links to doc pages and perhaps also red links to doc pages if they don't exist.
  • When in MediaWiki space we should instead load the editnotice of the page.
  • We can also link between .js and .css pages that has the same name. I think we can do so both in User space and in MediaWiki space. (For instance some gadgets have both a .js and a .css page so it would be neat to auto-link between them.)
--David Göthberg (talk) 17:29, 14 December 2009 (UTC)[reply]
Sounds good! And I looked it up in MediaWiki's Title.php, it's really only MediaWiki space pages and User space subpages ending with .css or .js (i.e. not User:Foo.js). Amalthea 18:12, 14 December 2009 (UTC)[reply]