Module:documentation/documentation

Serves and. is added to modules automatically (through MediaWiki:Scribunto-doc-page-show if the doc page exists, otherwise through MediaWiki:Scribunto-doc-page-does-not-exist); added to user JavaScript pages automatically (through MediaWiki:Clearyourcache); and manually added to template pages. It automatically adds categories, or categories and documentation, to some modules based on their titles.

More specifically, for modules:
 * 1) When there is no doc page for the module, Module:documentation checks for various sorts of special modules (based on the module title) and autogenerates the documentation and categories of those modules. If this check fails, the module is added to Category:Templates and modules needing documentation, and Module:module categorization is called to autogenerate the categories for lang-specific modules of the form, optionally with a subpage (e.g. , , , or any other subpage). If this check also fails, the module is added to Category:Uncategorized modules.
 * 2) When there is a doc page for the module, the contents of that page take precedence over any autogenerated content. However, if that page does not have an  section and does not have an invocation of module cat, the same checks are done as when no doc page exists (including checks for specially-titled modules and falling back to calling Module:module categorization), but only for the purposes of autogenerating categories. If no such categories could be determined, the module is added to Category:Uncategorized modules.

More specifically, for templates:
 * ... (DOCUMENT ME)

Ideas:
 * Make more usable on other Wiktionaries by creating data module with translations of text, and moving module regex to separate module.