Module:Param Parse: Difference between revisions

Fix image function bug for nil images
(Try to add image size support)
(Fix image function bug for nil images)
 
(2 intermediate revisions by the same user not shown)
Line 66:
function parse.image_name(img)
if img then
return string.match(img, '%[%[(File:(.+%.%w%w%w)|?%d*x?%d*p?x?%]%]')
end
return nil
Line 78:
function parse.image_width(img, default)
if img then
return string.match(img, '%[%[File:.+%.%w%w%w|(%d*)x?%d*px%]%]') or default
end
return default
Line 94:
size = '|x'..height..'px'
end
if imgname then
return '[['..name..size..']]'
end