Module:Room features: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
m (BlackHawk moved page Module:Location features to Module:Room features without leaving a redirect)
(hide loc qty if 1, add version name)
Line 56: Line 56:
local image = v.image_sub or v.image or 'File:Section anchor light.svg'
local image = v.image_sub or v.image or 'File:Section anchor light.svg'
local quantity = ''
local quantity = ''
if v['Location quantity'] and v['Location quantity'] ~= 'Unknown' then
if v['Location quantity'] and (v['Location quantity'] ~= 'Unknown' and v['Location quantity'] ~= '1') then
quantity = string.format('%s × ', v['Location quantity'])
quantity = string.format('%s × ', v['Location quantity'])
end
end
gallery = gallery .. string.format('%s|%s[[%s|%s]]\n', image, quantity, v['Location object'] or v[1], v.name_sub or v.name)
local obj_name = v['Location object'] or v[1]
local version_name = ''
local version = string.match(obj_name, "[^#]+%#([^#]+)")
if version then
version_name = string.format(" <sub>''%s''</sub>", version)
end
local display_name = v.name_sub or v.name
gallery = gallery .. string.format('%s|%s[[%s|%s%s]]\n', image, quantity, obj_name, display_name, version_name)
end
end
gallery = gallery .. '</gallery>\n\n'
gallery = gallery .. '</gallery>\n\n'
Line 67: Line 74:
end
end
end
end
mw.log(ret)
return frame:preprocess(ret)
return frame:preprocess(ret)