Module:Collapsible
This module is a small compatibility shim that exposes a function named collapsible. It forwards calls to an available renderer so that legacy templates using Script error: No such module "…". do not break.
Purpose
Some imported templates call:
or
Script error: The function "collapsible" does not exist.
On Chalo Chatu the primary entrypoint is main in Module:Collapsible list. This shim looks for that first; if unavailable, it may fall back to a compatible function in Module:Navbox (if present). If neither exists, it returns a clear error message.
Usage
Prefer the direct entrypoint:
Only use this shim for legacy code that cannot be edited:
Parameters
Identical to Module:Collapsible list’s main:
- title / header
- Heading text.
- collapsed
- yes / no. Adds class collapsed when yes.
- 1..50
- Positional items.
- class, id, list_style, item_style
- Optional styling hooks passed through when supported.
Behavior
- If Module:Collapsible list with function main(frame) exists, all arguments are forwarded to it.
- Else, if Module:Navbox with function navbox(frame) exists, arguments are forwarded as-is (output may differ).
- Else, a readable Module error string is returned.
Migration guidance
Where possible, update templates to call:
This reduces indirection and makes behavior explicit.
Troubleshooting
- If you still see "Script error: The function 'collapsible' does not exist", ensure this page (Module:Collapsible) is created and that Module:Collapsible list exists with a main function.
- If output appears but styling looks plain, add CSS for .chalo-collapsible classes in MediaWiki:Common.css.
See also
local p = {}
function p.collapsible(frame)
-- Prefer your local Module:Collapsible list if it exists
local ok, m = pcall(require, 'Module:Collapsible list')
if ok and m and type(m.main) == 'function' then
return m.main(frame)
end
-- Fallback to Module:Navbox if your setup routes collapsible lists via Navbox
local ok2, nav = pcall(require, 'Module:Navbox')
if ok2 and nav and type(nav.navbox) == 'function' then
-- Pass through unchanged; may not render as a list but avoids hard failure
return nav.navbox(frame)
end
-- Last resort: fail clearly
return 'Module error: no handler available for "collapsible". Ensure Module:Collapsible list (with main) or Module:Navbox is installed.'
end
return p