Module:Icon box
fix bugs in icon/link handling
| ← Previous revision | Revision as of 19:28, 25 April 2026 | ||
| Line 59: | Line 59: | ||
local function getImage(item,args) |
local function getImage(item,args) |
||
local getPortalImage = require('Module:Portal')._image |
local getPortalImage = require('Module:Portal')._image |
||
local img = args.image or getPortalImage(item, true) |
|||
return '[[File:'..img..'|48x24px'..(args.ilink and '|'..args.ilink or '')..']]' |
|||
end |
end |
||
| Line 156: | Line 157: | ||
-- args.lh: line height |
-- args.lh: line height |
||
-- args.width: width of box. If bare number, interpreted as px |
-- args.width: width of box. If bare number, interpreted as px |
||
| ⚫ | |||
-- args.talign: alignment of link text, defaults to "center" |
-- args.talign: alignment of link text, defaults to "center" |
||
function p._main(items, args) |
function p._main(items, args) |
||
args = processArgs(args) |
args = processArgs(args) |
||
-- explicitly disallow image and ilink parameters for this function, |
|||
-- because it can generate more than one image |
|||
args.image = nil |
|||
args.ilink = nil |
|||
if not items[1] then |
if not items[1] then |
||
table.insert(items,'regional') |
table.insert(items,'regional') |
||
| Line 189: | Line 193: | ||
-- args[2] or args.wgname: name of work group or task force |
-- args[2] or args.wgname: name of work group or task force |
||
-- args.type: "workgroup" or "taskforce" depending on which is desired |
-- args.type: "workgroup" or "taskforce" depending on which is desired |
||
-- args.image: override image shown in box (without namespace prefix) |
|||
| ⚫ | |||
-- other optional arguments documented in p._main() above |
-- other optional arguments documented in p._main() above |
||
function p._workgroup(args) |
function p._workgroup(args) |
||
| Line 199: | Line 205: | ||
local list = createList(container, args) |
local list = createList(container, args) |
||
local row = createRow(list) |
local row = createRow(list) |
||
local img = |
local img = getImage(args.wgname,args) |
||
local text, wgExists |
local text, wgExists |
||
local groupType = '' |
local groupType = '' |
||