Jump to content

Topic on Talk:ResourceLoader/Core modules/Archive 2

Capitalization of module names

5
He7d3r (talkcontribs)

I was wondering if the names of the modules on (section names on) this page shouldn't be using the same capitalization which is defined at /resources/Resources.php.

For example, "mediawiki.api" is the module name which should be used on e.g. mw.loader.using, but "mediaWiki.Api" is what someone would need to use inside of a JS code to access what is defined on that module.

Krinkle (talkcontribs)

I know what you mean. However this page primarily documents the code, not the module.

Main reason being that not all objects are in individual modules. Some modules provide multiple objects, others only extend existing ones.

Once we have migrated to a proper documentation system (RFC), we could include a piece of data showing which module(s) are required to use a function.

For now it is mainly documentation of the javascript code, not the module structure. But feel free to add that information :)

Mattflaschen (talkcontribs)

I'd certainly like to move to autogenerated (parsed along the lines of Doxygen) documention too. But until that happens, this should in fact document the modules. That means there should be a section for every module listed in Resources.php. Within that section, we should document any objects added or extended.

We should also fix the capitalization and spelling whenever discrepancies are noted.

This post was posted by Mattflaschen, but signed as Superm401.

Krinkle (talkcontribs)

@Superm401: Thanks for your recent reorganisation of the page. However a few minor points:

Your edits left the page in an inconsistent state. It used to be consistent. The section headings were capitalised after the javascript API they expose (e.g. Heading mediaWiki.Title is that way because the global variable is lowerCamelCase (window.mediaWiki) and the mediawiki.Title module defines mediaWiki.Title. These were not broken or discrepant.

You supposedly "fixed" some of them by changing them to their module namen and the result is an inconsistent mess where some are javascript identifiers, some are module names, and some are self-invented. Anchor links from other pages also stopped working properly (e.g. RL/DM#mediaWiki.Title no longer works).

Renaming headings like "api.get" to "mw.Api.get" introduced an incorrect and confusing image. Identifier "mw.Api.get" resolves to nothing. It is defined as "mw.Api.prototype.get". Referred to as "api.get" or "mw.Api#get" (where dot is a property, and hash a member of an instance, the constructed object from mw.Api) but not mw.Api.get since that is undefined.

Also don't include "?" or stuff "citation needed". If you're not sure, ask on the Talk page (this is not Wikipedia, we only deal with simple and verifiable facts).

I've fixed it now because it was easier to finish then to revert and let you fix it.

Mattflaschen (talkcontribs)

It's a work in progress, and I appreciate you continuing it.

There actually were some inconsistencies before. In this revision, I noticed (but there could have been more):

  • Some single-method scripts (mw.log) had nested headings while others did not (e.g. autoEllipsis, placeholder).
  • Some method headings had context (e.g. api.get) while others did not (e.g. addCSS).
  • Some method names weren't even headings (still true).
  • There was one random example heading, which I see you fixed.

Note that I've been adding modules and other information as well, which is part of what has been taking the time. There are still some missing modules. I may add them when I have an opportunity, but if I am able to get auto-generated documentation working, it will not be necessary.

I suggest we expand the TOC depth, perhaps to 4. I think there are some important methods (e.g. log, the loader methods) that are not shown currently. I realize this will make the TOC longer, but I think it's worth it.

Anyway, I'm glad we have been able to make it more usable.

This post was posted by Mattflaschen, but signed as Superm401.

Reply to "Capitalization of module names"