Module:Alternating rows table section/doc
From Chalo Chatu, Zambia online encyclopedia
Jump to navigationJump to search
This is the documentation page for Module:Alternating rows table section
This module emits table rows with alternating classes/styles (zebra striping). It is a lightweight fallback compatible with templates that expect a function named "main" (and alias "section").
Overview
Invoke inside a wikitable to output multiple rows. Each positional parameter (1, 2, 3, …) should contain one or more table cells (e.g., `!` or `|` lines).
Basic form:
Parameters
All parameters are optional unless noted.
- 1..N
- Positional row definitions. Each should contain complete cell markup for that row (e.g., `!` and `|` cells).
- start
- First positional index to read. Default 1.
- limit
- Maximum rows to process. Default 200.
Styling hooks:
- rowstyle
- Inline CSS applied to every row.
- oddclass / odd
- CSS class for odd rows (1st, 3rd, …).
- evenclass / even
- CSS class for even rows (2nd, 4th, …).
- oddstyle
- Inline CSS appended on odd rows.
- evenstyle
- Inline CSS appended on even rows.
Examples
Minimal
Party | Votes | % |
---|
With classes
Assuming site CSS defines .row-odd and .row-even:
Party | Votes | % |
---|
With inline styles
Party | Votes | % |
---|
Notes
- This module does not build cells; each positional parameter should supply full cell markup for its row.
- If your template used a function named "section", this module provides an alias: works the same as "main".
- To change the visual look, define classes in MediaWiki:Common.css and pass them via oddclass/evenclass.
Troubleshooting
- Lua error: attempt to call field 'main' (a nil value)
- Ensure the code page at Module:Alternating rows table section contains a function `p.main` and returns `p`. The /doc subpage should not contain Lua.
- Rows appear but no zebra effect
- Provide oddclass/evenclass and define those classes in site CSS, or use oddstyle/evenstyle inline.
- Nothing renders
- Check that each positional parameter includes valid table cell markup (e.g., starts with `|` or `!`).