Module:MilLeadership/doc
| This is a documentation subpage for Module:MilLeadership. It may contain usage information, categories and other content that is not part of the original module page. |
| This is a documentation subpage for Module:MilLeadership. It may contain usage information, categories and other content that is not part of the original module page. |
| This module is rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected. |
This module builds a unit leadership table (commanding officers, RSMs, chaplains, and similar posts) from a list of people and from/to dates. Award codes are looked up in Module:MilAward (post-nominals and optional ribbon stacks). Dates are display strings; they are not passed through {{date}}.
Do not invoke this module from articles except through the templates below (or their /sandbox pages).
Templates that call this module
[edit]| Template | Invoke | What it does |
|---|---|---|
| {{MilLeadership}} | {{#invoke:MilLeadership|table}} | Renders the whole wikitable: caption, post headings, rows, optional ribbon column. |
| {{MilLeadership/sandbox}} | same | Sandbox copy of the table wrapper. |
| {{MilLdr}} | {{#invoke:MilLeadership|line}} | Serialises one person to an internal list line (from // to // rank // name // key=value). Does not draw a table by itself. |
| {{MilLdr/sandbox}} | same | Sandbox copy of the row helper. |
User:BoonDock/MilLeadership and User:BoonDock/MilLdr redirect to the live templates. Module:Sandbox/BoonDock/MilLeadership forwards with require('Module:MilLeadership').
Why two templates
[edit]A raw pipe (|) inside {{MilLeadership}} is a new template parameter, so this cannot work:
* 1978 | 1978 | Cmdt | [[Frank Bestbier]]
{{MilLdr}} keeps those pipes on the row template. It calls p.line, which returns a line using the delimiter // (space-slash-slash-space). p.table then parses those lines. http:// in URLs is not split, because that form has no spaces around //.
How it fits together
[edit]Article
{{MilLeadership | caption=... | ribbons=yes | content= == Post == {{MilLdr|...}} }}
│
▼
Module:MilLeadership.table → HTML wikitable
│
├── {{MilAward PostNom}} for awards=SD, SM, MMM
└── {{MilAward Stack}} ribbon column when |ribbons=yes (default size x8px)
Incumbent lists stay on the article. This module does not store COs in a data module. Medal data lives in Module:MilAward/data.
Entry points
[edit]| Function | Called from | Role |
|---|---|---|
p.table / p.main | {{MilLeadership}} | Read template arguments and render the table. |
p.line | {{MilLdr}} | Turn from/to/rank/name (and named extras) into one list line. |
p._table | other Lua | Same renderer, from a Lua args table (optional src for argument order). |
p._parseLine | console / tests | Parse one member line into a row table. |
{{MilLeadership}} arguments
[edit]Passed through to p.table:
| Parameter | Description |
|---|---|
|caption= | Table caption |
|float= | right or left. Default: no float. Empty {{{1}}} is the same as omitting it. |
|color= / |colour= | Header and border colour. Default #CF9C65 |
|country= | Reserved (ZAR). Award lookup uses MilAward codes, which are global. |
|ribbons= | yes to add a right-hand Ribbon column. Default off. |
|ribbon_size= | File height for that column. Default x8px. Aliases: |ribbon-size=, |ribbonsize=, |size= |
|class= | Extra CSS class on the table |
|nocat= | yes suppresses tracking categories |
|content= / |posts= | Member lists grouped by == Post name == headings. Preferred when there is more than one post, so order is preserved. |
|title1= + |list1= | Numbered posts (|title2=/|list2=, …). Aliases: |post1=, |members1= |
| any other named parameter | Treated as a post heading; the value is that post’s member list. Do not rely on this for several posts: Lua 5.1 may not keep parameter order. |
Example
[edit]| From | Commanding Officers | To |
|---|---|---|
| 1978 | Cmdt Frank Bestbier [a] | 1978 |
| Jan 1981 | Cmdt Roland de Vries SD,SM,MMM [b] | 1982 |
| From | Chaplains | To |
| 1983 | No permanent Appointment | 1983 |
{{MilLeadership
| caption = Example
| content =
== Commanding Officers ==
{{MilLdr|1978|1978|Cmdt|[[Frank Bestbier]]|note=Veggroup Juliet}}
{{MilLdr|Jan 1981|1982|Cmdt|[[Roland de Vries]]|awards=SD, SM, MMM|note=Later Major General}}
== Chaplains ==
{{MilLdr|1983|1983||''No permanent Appointment''}}
}}
With ribbons:
{{MilLeadership
| caption = Example
| ribbons = yes
| content =
== Commanding Officers ==
{{MilLdr|Jan 1981|1982|Cmdt|[[Roland de Vries]]|awards=SD, SM, MMM}}
}}
Passed through to p.line:
| Field | Description |
|---|---|
|1= / |from= | From date (display string: 1978, Nov 1978) |
|2= / |to= | To date |
|3= / |rank= | Rank or style at the time of the posting (Cmdt, WO1, Ds, …). May be empty (vacancy). |
|4= / |name= | Name. Wikilink it yourself; this module will not invent links. Aliases: |incumbent=, |post-incumbent= |
|awards= | MilAward codes, comma-separated: SD, SM, MMM |
|note= | Explanatory footnote ({{efn}}) |
|note-name= | Named efn (e.g. RIP). First row should also set |note= to define the text; later rows use |note-name= only. Alias: |notename= |
|notes= | Extra footnotes, separated by ;; |
|ref= | Citation, wrapped in <ref>...</ref> unless it already contains one |
|link= | If the name is not already a wikilink: yes wraps [[name]], or a page title wraps [[title\|name]] |
|vacant= | yes shows ''No permanent appointment'' when the name is empty |
Compact year range (list form only): * 1978–1982 // Cmdt // [[Name]]
The article still needs {{notelist}} (and {{reflist}}) where footnotes and references are collected.
Dependencies
[edit]- Module:Arguments
- {{MilAward PostNom}} and {{MilAward Stack}} (and therefore Module:MilAward / Module:MilAward/data)
- {{Efn}} for notes
Tracking categories
[edit]On mainspace pages only, unless |nocat=yes:
- Category:Pages using MilLeadership
- Category:MilLeadership errors (unknown line fields, empty post lists, missing posts)
See also
[edit]- {{MilLeadership}} / {{MilLeadership/testcases}}
- {{MilLdr}}
- {{MilAward}}
- {{Post-start}} (legacy)
- User:BoonDock/sandbox/MilLeadership (61 Mech conversion demo)