Problem
Consider:
- {{#expr: 3.1416 * {{#invoke:Math|compute|{{{d}}}}}}}
- {{#if: {{#invoke:Wikidata|retrieve|{{{p}}}}} | ...}}
If there is any error with those parameters {{{d}}} or {{{p}}}, there is no way to complain via error message nor maintenance category.
- The one and only hack is to transclude or query for a (perhaps not existing) page and trace back Whatlinkshere for such page. This is no reasonable approach in eternity.
- I want
- Category:Maintenance, compute@Module:Math, invalid number
- Category:Maintenance, retrieve@Module:Wikidata, bad property
Those are visible for editors at least if hidden categories are shown, trigger warnings by evaluating PAGESINCATEGORY, and category description may explain causes and remedies. In list of maintenance categories I am told which are not empty.
Solutions
Lua library
Something like
mw.category( title [, sortkey] )
may be introduced.
- Lua modules could trigger such category.
- By wrapping such auxilary module a template could categorize as well.
Parser function
Introduce
{{#category:title|optional sortkey}}
That may be used within templates.
- Lua modules can issue any parser function within frame.
The name of the parser function can be localized easily by re-using the well known 14 namespace names.
- No clash with other function name is expected.
- Localized function names have high acceptance among authors.
This approach offers the solution of a two decades old mystery:
- There are internal links like [[Category:Things]] but they vanish in rendered text and there are strange hints to insert a : somewhere for a clickable link towards description page.
- By slow migration towards parser function within a decade, inserting when touched by VisualEditor, and whereever source code is generated or manipulated by software, common understanding of wikisyntax may change.
- AWB etc. need to learn the additional syntax.
- {{#category:Things}} is not a link but a function call which says Categorize me!
- The link format will need maintenance in eternity.
- Invention of category link format is older than parser function format and, from current viewpoint, a quite confusing idea.
XML tag
A third approach could be
<category title="Things" sort="Key" />
L10N is less obvious, and keywords would need translation as well.
- Both Lua and templates could use this.