Content deleted Content added
sync with live |
No edit summary |
||
Line 535:
function p._icon(args, frame)
local system = args[1] or args.system
local
local line_type = args[3] or args.type▼
return
▲ if system or data then
data = data or getData(system)▼
local icon▼
local icon_format▼
local line_name = args[2] or args.line
▲ line = (getLine(data, line))
local default = data.lines._default or {}
if line_type then▼
if default and default.icon then
line_type = data['aliases'] and data['aliases'][mw.ustring.lower(line_type)] or line_type▼
line_type = line['types'] and line['types'][line_type] -- If there's no type table or entry for this type, then it can't have its own icon▼
icon_format = line_type['icon format'] or data['type icon format']▼
icon = line_type['icon']▼
▲ end
icon_format = line['icon format'] or data['line icon format']▼
▲
icon = line['icon']▼
▲ if line_type.icon then
end
end
▲ if not (icon_format or icon) then
icon_format = data['system icon format']▼
icon = data['system icon']▼
end
if not icon then
if icon_format ~= 'image' then return p._box({data = data, [2] = (args[2] or args.line), [3] = icon_format, type = (args[3] or args.type), bold = args.bold, link = args.link}, frame) end▼
if not icon then
if icon_format then
if icon_format ~= 'image' then
▲
end
end
▲ end
-- Upright values are to be disabled until there is use of upright scaling in subpages; doesn't seem to work anyway as of 2018-08-10▼
local tmp = {▼
'|%s*%d*x?%d+px%s*([%]|])', -- '|%s*upright=%d+%.?%d*%s*([%]|])', '|%s*upright%s*([%]|])'▼
▲ }
if mw.ustring.match(icon, tmp[1]) then▼
▲ icon = mw.ustring.gsub(icon, tmp[1], size .. '%1')
-- elseif mw.ustring.match(icon, tmp[2]) then▼
-- icon = gsub(icon, tmp[2], size .. '%1')▼
-- elseif mw.ustring.match(icon, tmp[3]) then▼
-- icon = gsub(icon, tmp[3], size .. '%1')▼
else▼
icon = mw.ustring.gsub(icon, '(%[%[[^%]|]+)([%]|])', '%1' .. size .. '%2')▼
▲ end
end
▲
}
icon = mw.ustring.gsub(icon, tmp[1], size .. '%1')
end
end
▲ end
end
end
▲ end
end
end
▲ end
end
return icon .. " " .. data["system title"]
end
return icon
end
|