Module:Collapsible: Difference between revisions
From Chalo Chatu, Zambia online encyclopedia
Chalochatu (talk | contribs) Created page with "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 li..." |
Chalochatu (talk | contribs) No edit summary |
||
| Line 2: | Line 2: | ||
function p.collapsible(frame) | function p.collapsible(frame) | ||
-- Prefer | -- Prefer Collapsible list → main | ||
local ok, | local ok, mod = pcall(require, 'Module:Collapsible list') | ||
if ok and | if ok and mod and type(mod.main) == 'function' then | ||
return | return mod.main(frame) | ||
end | end | ||
-- | -- Optional fallback: Navbox → navbox (if present on your wiki) | ||
local ok2, nav = pcall(require, 'Module:Navbox') | local ok2, nav = pcall(require, 'Module:Navbox') | ||
if ok2 and nav and type(nav.navbox) == 'function' then | if ok2 and nav and type(nav.navbox) == 'function' then | ||
return nav.navbox(frame) | return nav.navbox(frame) | ||
end | end | ||
return 'Module error: expected Module:Collapsible list.main or Module:Navbox.navbox to handle "collapsible".' | |||
return 'Module error: | |||
end | end | ||
return p | return p | ||
