Module wikitrek-CaseExpander
Parses a CasesList page and returns structured case data Reads a template's /CasesList subpage and creates mappings for codes, aliases, and expansions.
Supports case-insensitive lookups.
CasesList format: CODE1, CODE2 = Expansion text for both codes CODE3 = Expansion text for CODE3
Functions
| p.expand (frame) | Expands a single case/code to its full text Performs case-insensitive lookup of a code and returns its expansion. |
| p.listAll (frame) | Generates a formatted list or table of all cases Creates a display of all available cases and their expansions. |
Functions
- p.expand (frame)
-
Expands a single case/code to its full text
Performs case-insensitive lookup of a code and returns its expansion.
If the code is not found, returns the default value.
Usage from template: {{#invoke:CaseExpander|expand|CODENAME|DefaultText}} OR if called from a different context: {{#invoke:CaseExpander|expand|CODENAME|DefaultText|Template:Ship}}
Parameters:
- frame frame object from MediaWiki with args: - [1]: the code to expand (required) - [2]: the default text if code not found (optional, default: "Unknown case") - [3]: the template name (optional, auto-detected if not provided)
Returns:
-
string The expansion text or default value
- p.listAll (frame)
-
Generates a formatted list or table of all cases
Creates a display of all available cases and their expansions.
Can output as a formatted HTML table or a bullet list.
Usage from template: {{#invoke:CaseExpander|listAll|format=table}} OR if called from a different context: {{#invoke:CaseExpander|listAll|Template:Ship|format=table}}
Parameters:
- frame frame object from MediaWiki with args: - [1]: the template name (optional, auto-detected if not provided) - format: output format - "table" or "list" (optional, default: "table")
Returns:
-
string HTML or wikitext formatted list of all cases