Jump to content

Module:Reliability/doc

From SchitzoPunk Wiki

This is the documentation page for Module:Reliability

Documentation for Module:Reliability, which is the only executable code on this wiki and the single source of truth for the reliability tags.

What it does

The module holds one table of tags. Each entry carries a label, a colour, the meaning shown on hover, and the tracking category the tag files a page into. Two functions read that table:

p.tag
Called by {{R}}

. Renders one tag as an inline chip and, in the main namespace only, adds the tracking category.

p.legend
Called by {{Legend}}

. Renders the whole table as the legend shown on the Main Page and in Help:Reading this wiki.

Both read the same table, which is the point: the legend cannot fall out of step with the tags in use. Add a tag to the module and it appears in the legend by itself.

Adding a tag

Add an entry to tags and its key to order. The order is the order of the legend, and it is not alphabetical — it runs from what one person will swear to down through what nobody will stand behind. Put a new tag where it belongs on that scale.

Then create the tracking category named in the entry, and give it a description, and file it under Category:Reliability tags.

Aliases go in aliases. Anything unrecognised falls back to unverified, which is also the default when the first parameter is empty or missing.

Notes for anyone editing it

  • TemplateStyles is not installed on this wiki. All styling is inline, deliberately. Do not extract it into a stylesheet that does not exist.
  • Colours are dark with light text so they survive whatever skin a reader is using. They are also required to be visually distinct from each other — with one exception, noted in the source: astroturf is deliberately close to firsthand, because that is what astroturf is built to resemble.
  • Categories are added in the main namespace only. A template or help page demonstrating a tag should not appear as though it were making a claim.
  • p.tag accepts being called either through {{R}}
or directly via #invoke, and does not assume a parent frame exists.

Testing

The module is plain Lua 5.1 apart from its use of mw.text, mw.ustring and mw.title. It can be exercised outside the wiki by stubbing those three, which is how the current version was checked before it was imported — 52 assertions covering tag resolution, aliases, defaults, namespace gating, attribute escaping, the direct-invoke path, and that every chip colour is still distinct.

If you change the module, run something equivalent. A broken module does not fail quietly here: it puts a script error on every page that carries a tag, which is most of them.